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 modules check: Assert exit code, not empty output #329

Closed
wants to merge 1 commit into from

Conversation

hroncok
Copy link

@hroncok hroncok commented Apr 15, 2021

Distutils is deprecated in Python 3.10+:
https://www.python.org/dev/peps/pep-0632/

When importing it, there is a warning:

DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

The configure script falsely assumed this is an error.
Instead, we now check for the exit code, which is more explicit.

In the long term, we need to migrate away from distutils, this is a stopgap measure only.

Distutils is deprecated in Python 3.10+:
https://www.python.org/dev/peps/pep-0632/

When importing it, there is a warning:

    DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

The configure script falsely assumed this is an error.
Instead, we now check for the exit code, which is more explicit.

In the long term, we need to migrate away from distutils, this is a stopgap measure only.
@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

I've edited this trough GitHub's web UI, somebody please regenerate configure with this change when merging. Thanks

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

So what you're saying is that the change itself hasn't been tested? I'm not a fan of that!

Sorry about that. It hasn't. I've assumed a CI will test it.

They wouldn't have deprecated something for which there isn't already a preferred replacement. Do you know what it is?

Oh, they did :D

But nevertheless, for this use case, you should use sysconfig (not distutils.sysconfig). All the information this script queries is there, but the API is different.

https://docs.python.org/3/library/sysconfig.html#installation-paths

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

When was sysconfig introduced?

2.7: https://docs.python.org/3.10/whatsnew/2.7.html#new-module-sysconfig

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

This should work:

sysconfig.get_path('include')  # instead of distutils.sysconfig.get_python_inc()
sysconfig.get_path('stdlib')  # instead of distutils.sysconfig.get_python_lib(0,1)
sysconfig.get_path('platlib')  # instead of distutils.sysconfig.get_python_lib(1,0)
sysconfig.get_config_var('LIBS')  # instead of distutils.sysconfig.get_config_var('LIBS')

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

purelib is distutils.sysconfig.get_python_lib(0,0)
stdlib is distutils.sysconfig.get_python_lib(0,1)

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

yes, in site-packages, i.e. into platlib.

@hroncok
Copy link
Author

hroncok commented Apr 15, 2021

I've sent the PR to make it build. I am not available to invest any more time than that, sorry about that.

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@DaveMielke
Copy link
Member

DaveMielke commented Apr 15, 2021 via email

@DaveMielke DaveMielke closed this Apr 15, 2021
@hroncok hroncok deleted the patch-1 branch April 15, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants