Skip to content

Commit

Permalink
misc(deps): Pin setuptools only for PyPy on Windows platform (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
flozz committed Nov 22, 2024
1 parent f9f5adc commit 5f61043
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Changelog

* **[NEXT]** (changes on master but not released yet):

* Nothing yet ;)
* misc(deps): Pin setuptools only for PyPy on Windows platform (@flozz, #26)

* **v1.1.4:**

Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[build-system]
requires = ["setuptools<74"]
requires = [
"setuptools",
# ↓ See https://github.com/wanadev/mozjpeg-lossless-optimization/issues/26
"setuptools<74; platform_system=='Windows' and implementation_name=='pypy'",
]
build-backend = "setuptools.build_meta"
25 changes: 19 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@
def _find_msbuild(plat_spec="x64"):
from setuptools import msvc

vc_env = msvc.msvc14_get_vc_env(plat_spec)
if "vsinstalldir" not in vc_env:
raise Exception("Unable to find any Visual Studio installation")
return os.path.join(
vc_env["vsinstalldir"], "MSBuild", "Current", "Bin", "MSBuild.exe"
)
if hasattr(msvc, "msvc14_get_vc_env"):
vc_env = msvc.msvc14_get_vc_env(plat_spec)
if "vsinstalldir" in vc_env:
msbuild_path = os.path.join(
vc_env["vsinstalldir"], "MSBuild", "Current", "Bin", "MSBuild.exe"
)
if os.path.isfile(msbuild_path):
return msbuild_path

for path in msvc.EnvironmentInfo(plat_spec).VCTools:
if "\\VC\\" not in path:
continue
msbuild_path = os.path.join(
path[: path.index("\\VC\\")], "MSBuild", "Current", "Bin", "MSBuild.exe"
)
if os.path.isfile(msbuild_path):
return msbuild_path

raise Exception("Unable to find any Visual Studio installation")


class CustomBuildExt(build_ext):
Expand Down

0 comments on commit 5f61043

Please sign in to comment.