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

distutils package is deprecated #1

Open
hegjon opened this issue Dec 6, 2022 · 4 comments
Open

distutils package is deprecated #1

hegjon opened this issue Dec 6, 2022 · 4 comments

Comments

@hegjon
Copy link

hegjon commented Dec 6, 2022

From build log when building RPM package

/builddir/build/BUILD/auto_remote_sync-1.0.5/setup.py:3: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils
@hegjon
Copy link
Author

hegjon commented Dec 6, 2022

It might be that the RPM build macros are the issue

@gotmax23
Copy link

gotmax23 commented Dec 6, 2022

It might be that the RPM build macros are the issue

They are not. The setup.py imports distutils, which is deprecated and will be removed in Python 3.12. This should use setuptools.setup() instead.

Other suggestions:

@hegjon
Copy link
Author

hegjon commented Dec 7, 2022

The setup.py imports the package itself to extract version. That is not the correct way to extract version from the package and is bad practice that has multiple potential pitfalls

One of the pitfalls is that the RPM tool that want to read the dependencies, will fail if the dependency is not installed:

+ /usr/bin/python3 -Bs /usr/lib/rpm/redhat/pyproject_buildrequires.py --generate-extras --python3_pkgversion 3 --wheeldir /builddir/build/BUILD/auto_remote_sync-1.0.5/pyproject-wheeldir
Handling setuptools >= 40.8 from default build backend
Requirement satisfied: setuptools >= 40.8
   (installed: setuptools 59.6.0)
Handling wheel from default build backend
Requirement satisfied: wheel
   (installed: wheel 0.37.1)
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 501, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 415, in generate_requires
    generate_build_requirements(backend, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 265, in generate_build_requirements
    new_reqs = get_requires()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
    return self._get_build_requires(
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 5, in <module>
    from autorsync import __version__
  File "/builddir/build/BUILD/auto_remote_sync-1.0.5/autorsync/__init__.py", line 9, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'
error: Bad exit status from /var/tmp/rpm-tmp.wHpst0 (%generate_buildrequires)
    Bad exit status from /var/tmp/rpm-tmp.wHpst0 (%generate_buildrequires)

See https://bugzilla.redhat.com/show_bug.cgi?id=2151315#c6 for details

@avibrazil
Copy link
Owner

avibrazil commented Feb 4, 2023 via email

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