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

Build broken with setuptools v66 #571

Closed
strager opened this issue Mar 18, 2023 · 3 comments
Closed

Build broken with setuptools v66 #571

strager opened this issue Mar 18, 2023 · 3 comments

Comments

@strager
Copy link
Contributor

strager commented Mar 18, 2023

Python setuptools version 66 dropped support for wacky version numbers: https://github.com/pypa/setuptools/blob/be6c0218bcba78dbd4ea0b5a8bb9acd5d5306240/CHANGES.rst#v6600

Sapling uses a version number like "0.2.20230124-180750-hf8cd450a", which is not compatible with setuptools v66. I get this error when building Sapling with setuptools v67.4.0:

[snip]
   Compiling hgcommands v0.1.0 (/private/tmp/nix-build-sapling-0.2.20230124-180750-hf8cd450a.drv-0/source/eden/scm/lib/hgcommands)
    Finished release [optimized] target(s) in 3m 08sn(bin)
/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_normalization.py:93: SetuptoolsDeprecationWarning: Invalid version: '0.2.20230124-180750-hf8cd450a'.
        !!


        ###################
        # Invalid version #
        ###################
        '0.2.20230124-180750-hf8cd450a' is not valid according to PEP 440.

        Please make sure specify a valid version for your package.
        Also note that future releases of setuptools may halt the build process
        if an invalid version is given.


!!

  warnings.warn(cleandoc(msg), SetuptoolsDeprecationWarning)
Traceback (most recent call last):
  File "/private/tmp/nix-build-sapling-0.2.20230124-180750-hf8cd450a.drv-0/source/eden/scm/nix_run_setup", line 8, in <module>
    exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
  File "setup.py", line 1847, in <module>
    setup(
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/nix/store/rralnldyvbdjmn0s8p6kwjdc5zp30nix-python3.10-wheel-0.38.4/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 360, in run
    self.run_command("install")
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 708, in run
    self.run_command(cmd_name)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/dist.py", line 1221, in run_command
    super().run_command(command)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.ensure_finalized()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/command/install_egg_info.py", line 25, in finalize_options
    ei_cmd = self.get_finalized_command("egg_info")
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 220, in finalize_options
    parsed_version = packaging.version.Version(self.egg_version)
  File "/nix/store/j9wa8hdvjin2kb0pmywhfni4kksw2v9v-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/_vendor/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '0.2.20230124-180750-hf8cd450a'
@strager
Copy link
Contributor Author

strager commented Mar 18, 2023

To work around this issue, should I change SAPLING_VERSION from 0.2.20230124-180750-hf8cd450a to just 0.2.20230124?

thoughtpolice pushed a commit to NixOS/nixpkgs that referenced this issue Mar 18, 2023
Nixpkgs commit 451c632 upgraded setuptools from version 65.0.3 to
version 67.4.0. This upgrade introduced a breaking change in
setuptools [1] which causes the Sapling package's build to fail:

    setuptools.extern.packaging.version.InvalidVersion: Invalid version: '0.2.20230124-180750-hf8cd450a'

This is an upstream issue [2]. For now, work around this issue in
Nixpkgs by truncating Sapling's version number.

Before 451c632:

    $ nix-env -q sapling
    sapling-0.2.20230228-144002-h9440b05e

    $ sl --version
    Sapling 0.2.20230228-144002-h9440b05e

After this patch:

    $ nix-env -q sapling
    sapling-0.2.20230228-144002-h9440b05e

    $ sl --version
    Sapling 0.2.20230228

Refs: 451c632

[1] https://github.com/pypa/setuptools/blob/be6c0218bcba78dbd4ea0b5a8bb9acd5d5306240/CHANGES.rst#v6600
[2] facebook/sapling#571
@zzl0
Copy link
Contributor

zzl0 commented Mar 23, 2023

Hi @strager thanks the posting the issue and fixing the NixOS build.

should I change SAPLING_VERSION from 0.2.20230124-180750-hf8cd450a to just 0.2.20230124?

This looks good.

We don't have plan to make the version number compatible with PEP 440, since Sapling is not a Python dependency in the Python eco-system. In the longer term, we may want to remove the setuptools dependency.

@zzl0 zzl0 closed this as completed Apr 12, 2023
@sggutier
Copy link
Contributor

Should be fixed by #606

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

3 participants