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

Replace distutils.sysconfig.get_python_lib with sysconfig.get_path #1452

Merged
merged 5 commits into from
Apr 12, 2021

Conversation

chigozienri
Copy link
Contributor

Fixes #1449

Removes the dependence on distutils, by replacing distutils.sysconfig.get_python_lib with sysconfig.get_path

distutils.sysconfig.get_python_lib with no flags defaults to plat_specific=0, standard_lib=0
https://github.com/pypa/distutils/blob/main/distutils/sysconfig.py

This is equivalent to sysconfig.get_path('purelib')
https://docs.python.org/3/library/sysconfig.html?highlight=purelib

Checklist

  • [ n/a ] Tests
  • [ n/a ] Update API reference (docs/source/traits_api_reference)
  • [ n/a ] Update User manual (docs/source/traits_user_manual)
  • [ n/a ] Update type annotation hints in traits-stubs

Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I tried this out locally and it looks correct. I'm not sure this code path is tested by the docs though.

traits/util/resource.py Outdated Show resolved Hide resolved
traits/util/resource.py Outdated Show resolved Hide resolved
Poruri Sai Rahul and others added 3 commits April 6, 2021 10:52
@mdickinson
Copy link
Member

LGTM as a quick fix, though I think we need to revisit find_resource and its uses.

I took the liberty of making a drive-by style fix, changing the from sysconfig import to a plain import sysconfig. (Very much a personal thing, but my preference is to use plain import for std. lib. modules where there's no reason to do otherwise.)

@mdickinson mdickinson merged commit 17c6078 into master Apr 12, 2021
@mdickinson mdickinson deleted the 1449-remove-distutils branch April 12, 2021 07:58
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 this pull request may close these issues.

Fix dependence on distutils.
3 participants