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

A Future without distutils #24

Closed
mdavidsaver opened this issue Nov 22, 2022 · 3 comments · Fixed by #31
Closed

A Future without distutils #24

mdavidsaver opened this issue Nov 22, 2022 · 3 comments · Fixed by #31
Assignees

Comments

@mdavidsaver
Copy link
Member

Currently setuptools_dso is importing a number of pieces directly from distutils, which is now be deprecated/removed in cpython 3.12. And the vendored/patched distutils shipped with setuptools has been causing problems for others (pypa/setuptools#3532). So it seems like it may be only a matter of time before some change to setuptools breaks this package.

My current thinking is to try to replace all distutils imports with setuptools imports.

@mdavidsaver mdavidsaver self-assigned this Nov 22, 2022
@mdavidsaver
Copy link
Member Author

The current state of things. I suspect the most likely place for problems will be src/setuptools_dso/compiler.py.

$ git grep distutils
documentation/usage.rst:A callable will be invoked during the `build_dso` phase with one argument of :py:class:`distutils.core.Command`.
documentation/usage.rst:and `distutils.core.Extension <https://docs.python.org/3/distutils/apiref.html#distutils.core.Extension>`_,
example/setup.py:    # 'cmd' is instance of distutils Command with attributes:
src/setuptools_dso/__init__.py:# import of setuptools implicitly monkey patches distutils...
src/setuptools_dso/__init__.py:from distutils import log
src/setuptools_dso/compiler.py:from distutils.ccompiler import (new_compiler as _new_compiler, gen_preprocess_options, CCompiler)
src/setuptools_dso/compiler.py:from distutils.dep_util import newer
src/setuptools_dso/compiler.py:from distutils.errors import DistutilsExecError, CompileError
src/setuptools_dso/compiler.py:from distutils.sysconfig import customize_compiler
src/setuptools_dso/compiler.py:from distutils import log
src/setuptools_dso/compiler.py:    """Replacement for default (no-op) distutils.msvccompiler.MSVCCompiler.preprocess()
src/setuptools_dso/compiler.py:    """Returns a instance of a sub-class of distutils.ccompiler.CCompiler
src/setuptools_dso/dsocmd.py:from distutils.dep_util import newer_group
src/setuptools_dso/dsocmd.py:from distutils import log
src/setuptools_dso/dsocmd.py:        # original setuptools/distutils don't call sub_commands for build_ext
src/setuptools_dso/dsocmd.py:#   distutils presents such a simple idea.  We just add 'build_dso' to build.sub_commands.
src/setuptools_dso/dsocmd.py:# _needs_builddso marks distutils/setuptools command to depend on build_dso.
src/setuptools_dso/dsocmd.py:from distutils.command.build import build
src/setuptools_dso/probe.py:from distutils.errors import DistutilsExecError, CompileError
src/setuptools_dso/probe.py:from distutils import log
src/setuptools_dso/probe.py:    """Directly copied from :py:class:`distutils.ccompiler.CCompiler.compiler_type`
src/setuptools_dso/test/test_probe.py:        from distutils import log

@OCopping
Copy link
Contributor

Has there been any progress on this issue?
I was attempting to build a project at Diamond Light Source against Python 3.12 and this is breaking pythonSoftIOC.
It is not urgent as the project only requires Python 3.11, but would be nice for the future.

    from softioc import asyncio_dispatcher, softioc
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/softioc/__init__.py", line 5, in <module>
    from setuptools_dso.runtime import find_dso
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/setuptools_dso/__init__.py", line 9, in <module>
    from .dsocmd import DSO, Extension, install, build, build_dso, build_ext, bdist_egg
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/setuptools_dso/dsocmd.py", line 29, in <module>
    from distutils.dep_util import newer_group
  File "/opt/hostedtoolcache/Python/3.12.2/x64/lib/python3.12/site-packages/setuptools/_distutils/dep_util.py", line 9, in __getattr__
    warnings.warn(
DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead.

@mdavidsaver
Copy link
Member Author

Has there been any progress on this issue?

No. It would be great if you have time to research the distutils -> setuptools equivalences.

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

Successfully merging a pull request may close this issue.

2 participants