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

python 3.10 deprecates distutils #259

Closed
frozencemetery opened this issue Aug 4, 2021 · 7 comments · Fixed by #265
Closed

python 3.10 deprecates distutils #259

frozencemetery opened this issue Aug 4, 2021 · 7 comments · Fixed by #265

Comments

@frozencemetery
Copy link
Member

python-3.10 implements PEP 632 ("Deprecate distutils module"). However, our Windows build currently depends on distutils in order to monkey-patch it: https://github.com/pythongssapi/python-gssapi/blob/main/setup.py#L79-L85

@aiudirog Do you think you'd be able to look into this? We've got some time, but it'll presumably start throwing warnings on 3.10 release.

@aiudirog
Copy link
Member

It looks like setuptools is now vendoring distutils internally as setuptools._distutils. In theory, we should just try to apply the patch to that one and fallback to the plain distutils module if it isn't available.

@jborean93
Copy link
Contributor

Looking at https://github.com/pypa/setuptools/blob/a4dbe3457d89cf67ee3aa571fdb149e6eb544e88/docs/deprecated/distutils-legacy.rst and it looks like we can do something like

os.environ['SETUPTOOLS_USE_DISTUTILS'] = 'local'

# import setuptools (which will load the shim here)
import disutils

This should avoid loading in the deprecated distutils in the stdlib and use the vendored copy of distutils in setuptools. Might be a good idea to see if https://github.com/pythongssapi/python-gssapi/blob/main/setup.py#L79-L85 is still required and whether we can achieve the same thing through setuptools directly at some point in the future.

@aiudirog
Copy link
Member

aiudirog commented Oct 5, 2021

That sounds good to me. Open a PR for 3.10 support?

@jborean93
Copy link
Contributor

Yea now that GHA has released 3.10 I was going to modify #263 then look into this. Because you know more about the Windows stuff it would be great if you could validate that env var does what it should on 3.10.

@aiudirog
Copy link
Member

aiudirog commented Oct 5, 2021

Just gave it a quick test on my work machine and the code you gave works. As long as the environment variable is set before setuptools is imported, it assigns setuptools._distutils as distutils in sys.modules.

@jborean93
Copy link
Contributor

Thanks for confirming, will hopefully a PR up with that in there soon.

@jborean93
Copy link
Contributor

#265 should solve this issue.

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

Successfully merging a pull request may close this issue.

3 participants