Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 3, 2024
2 parents d901698 + 91bc99a commit 40ee221
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setuptools/_distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _get_vc_env(plat_spec):
stderr=subprocess.STDOUT,
).decode('utf-16le', errors='replace')
except subprocess.CalledProcessError as exc:
log.error(exc.output)
log.error(exc.output) # noqa: RUF100, TRY400
raise DistutilsPlatformError(f"Error executing {exc.cmd}")

env = {
Expand Down
2 changes: 1 addition & 1 deletion setuptools/_distutils/command/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def prune_file_list(self):
build = self.get_finalized_command('build')
base_dir = self.distribution.get_fullname()

self.filelist.exclude_pattern(None, prefix=build.build_base)
self.filelist.exclude_pattern(None, prefix=os.fspath(build.build_base))
self.filelist.exclude_pattern(None, prefix=base_dir)

if sys.platform == 'win32':
Expand Down
17 changes: 7 additions & 10 deletions setuptools/_distutils/tests/test_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@


class Testmsvccompiler(support.TempdirManager):
def test_no_compiler(self):
def test_no_compiler(self, monkeypatch):
# makes sure query_vcvarsall raises
# a DistutilsPlatformError if the compiler
# is not found
def _find_vcvarsall(plat_spec):
return None, None

old_find_vcvarsall = _msvccompiler._find_vcvarsall
_msvccompiler._find_vcvarsall = _find_vcvarsall
try:
with pytest.raises(DistutilsPlatformError):
_msvccompiler._get_vc_env(
'wont find this version',
)
finally:
_msvccompiler._find_vcvarsall = old_find_vcvarsall
monkeypatch.setattr(_msvccompiler, '_find_vcvarsall', _find_vcvarsall)

with pytest.raises(DistutilsPlatformError):
_msvccompiler._get_vc_env(
'wont find this version',
)

@needs_winreg
def test_get_vc_env_unicode(self):
Expand Down

0 comments on commit 40ee221

Please sign in to comment.