Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependance of obsolete python-setuptools < 74 #26

Closed
Popolon opened this issue Nov 19, 2024 · 4 comments
Closed

Dependance of obsolete python-setuptools < 74 #26

Popolon opened this issue Nov 19, 2024 · 4 comments

Comments

@Popolon
Copy link

Popolon commented Nov 19, 2024

The current code of mozjpeg-losless-optimization has python-setuptools < 74 as requirement.

Current release of setuptools is 75, this is the version used on ArchLinux, so it's a blocker to have it still compiled or upgraded on at least this Linux distribution.

@flozz
Copy link
Member

flozz commented Nov 21, 2024

Setuptools 74 & 75 break the Windows build... I am trying something to limit the version only on this platform

@flozz
Copy link
Member

flozz commented Nov 22, 2024

I found a solution to our problem. I will release a new version of the lib in few days. :)


Notes if someone is searching for a solution.

I improved the way I search for the MSBuild location:

def _find_msbuild(plat_spec="x64"):
    from setuptools import msvc

    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")

But I still have an issue with older PyPy versions on Windows. The problem is related to CFFI and newer setuptools versions. It is fixed in newer releases of CFFI, but as PyPy embed its own CFFI version, there is no fix for older PyPy versions so we have to pin the setuptools version for this implementation.

Here is how to pin setuptools version only for pypy on windows:

[build-system]
requires = [
    "setuptools",
    "setuptools<74; platform_system=='Windows' and implementation_name=='pypy'",
]
build-backend = "setuptools.build_meta"

More reading:

@flozz
Copy link
Member

flozz commented Nov 22, 2024

Finally I was able to release this today. The v1.1.5 fixes the issue, the build of the packages is in progress :)

https://github.com/wanadev/mozjpeg-lossless-optimization/releases/tag/v1.1.5

@Popolon
Copy link
Author

Popolon commented Nov 24, 2024

Sadly an header is missing in 1.1.5, see #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants