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

Building with setuptools >= 66 fails with InvalidVersion #2960

Closed
Lucki opened this issue Jun 11, 2023 · 2 comments
Closed

Building with setuptools >= 66 fails with InvalidVersion #2960

Lucki opened this issue Jun 11, 2023 · 2 comments

Comments

@Lucki
Copy link
Contributor

Lucki commented Jun 11, 2023

There are a few deprecation warnings as expected for such an old project but the version warning actually raises an exception and prevents building the project.

  File "/usr/lib/python3.11/site-packages/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '2019-dev-154-gc2f4d607b'

Reference: pypa/setuptools#3772

Non-PEP 440 compliant versions are still deprecated and no-longer supported when building packages.
Projects that don't comply with PEP 440 are urged to change.

Full log
==> Starting package()...
/build/unknown-horizons-git/src/unknown-horizons-git/setup.py:44: DeprecationWarning: distro.linux_distribution() is deprecated. It should only be used as a compatibility shim with Python's platform.linux_distribution(). Please use distro.id(), distro.version() and distro.name() instead.
  if distro.linux_distribution(full_distribution_name=False)[0] in ('debian', 'mint', 'ubuntu'):
/usr/lib/python3.11/site-packages/setuptools/dist.py:520: SetuptoolsDeprecationWarning: Invalid version: '2019-dev-154-gc2f4d607b'.
!!

        ********************************************************************************
        The version specified is not a valid version according to PEP 440.
        This may not work as expected with newer versions of
        setuptools, pip, and PyPI.

        By 2023-Sep-26, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://peps.python.org/pep-0440/ for details.
        ********************************************************************************

!!
  self._validate_version(self.metadata.version)
/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer, pypa/build or
        other standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
/usr/lib/python3.11/site-packages/setuptools/_distutils/command/build.py:130: SetuptoolsDeprecationWarning: Direct usage of `distutils` commands
!!

        ********************************************************************************
        It seems that you are using `distutils.command.build` to add
        new subcommands. Using `distutils` directly is considered deprecated,
        please use `setuptools.command.build`.

        By 2023-Dec-13, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://peps.python.org/pep-0632/ for details.
        ********************************************************************************

!!
  for cmd_name in self.get_sub_commands():
Merging translations into build/share/applications/unknown-horizons.desktop.
/usr/lib/python3.11/site-packages/setuptools/command/egg_info.py:131: SetuptoolsDeprecationWarning: Invalid version: '2019-dev-154-gc2f4d607b'.
!!

        ********************************************************************************
        Version '2019-dev-154-gc2f4d607b' is not valid according to PEP 440.

        Please make sure to 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.

        By 2023-Sep-26, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.

        See https://peps.python.org/pep-0440/ for details.
        ********************************************************************************

!!
  return _normalization.best_effort_version(tagged)
Traceback (most recent call last):
  File "/build/unknown-horizons-git/src/unknown-horizons-git/setup.py", line 242, in <module>
    setup(
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.11/site-packages/setuptools/command/install.py", line 74, in run
    return orig.install.run(self)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/command/install.py", line 708, in run
    self.run_command(cmd_name)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
    super().run_command(command)
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3.11/site-packages/setuptools/command/install_egg_info.py", line 25, in finalize_options
    ei_cmd = self.get_finalized_command("egg_info")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 305, in get_finalized_command
    cmd_obj.ensure_finalized()
  File "/usr/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 219, in finalize_options
    parsed_version = packaging.version.Version(self.egg_version)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/packaging/version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '2019-dev-154-gc2f4d607b'
==> ERROR: A failure occurred in package().
@Lucki
Copy link
Contributor Author

Lucki commented Jun 13, 2023

"eoc" recommends to also tackle the other deprecation warnings:

[…]
I'm afraid that having the "old" UH around is a rather good point to start at when it comes to attracting new talent for the eventual port to another engine. Requiring outdated machinery just to see what we built back in the day might act as a deterrent when the project probably would like all the help/PR it can get its hands on
(Docs => https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata )
[…]
Without wanting to promise anything, I might be able occasionally to help somebody else who's willing to tackle that project. If it's "just" a problem on UH side, anyhow. […]

@LinuxDonald
Copy link
Member

Godot engine port is going really slow happening. But it will still take a lot of work. Before it will be playable. I accept every help that I can get. For this versions of UH and the Godot one.

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