-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update Python < 3.8 (3.2 to 3.7) obsolete code and comments #4096
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
Conversation
| import imp as _imp | ||
|
|
||
| try: | ||
| FileExistsError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileExistsError added in Python 3.3
setuptools/command/easy_install.py
Outdated
| 'sys_prefix': self.config_vars['prefix'], | ||
| 'sys_exec_prefix': self.config_vars['exec_prefix'], | ||
| # Only python 3.2+ has abiflags | ||
| # Only POSIX systems have abiflags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source: https://docs.python.org/3/library/sys.html#sys.abiflags + tested on Windows
setuptools/command/easy_install.py
Outdated
| # Only python 3.2+ has abiflags | ||
| # Only POSIX systems have abiflags | ||
| 'abiflags': getattr(sys, 'abiflags', ''), | ||
| # Only python 3.9+ has platlibdir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| """ | ||
| # import late to avoid circular imports on Python < 3.5 | ||
| msvc = import_module('setuptools.msvc') | ||
| from . import msvc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically a revert of b7b9cb2
Unless this still happens in newer versions, in which case the comment should be updated instead.
714420f to
01ca1f2
Compare
bb4ff2f to
05ca49d
Compare
05ca49d to
d97640a
Compare
| index = setuptools.package_index.PackageIndex(hosts=('www.example.com',)) | ||
|
|
||
| # issue #160 | ||
| if sys.version_info[0] == 2 and sys.version_info[1] == 7: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python 2.7 test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution. I see that you already started discussing with Jason about some of these changes, so I will leave it to him, but I just wanted to point out that some modifications on the docs might need some review. I left some comments (that also might also apply to the following parts of the documents, not only the preceeding lines in the Github diff).
2ffc63c to
c242f74
Compare
c242f74 to
7620221
Compare
I'm guessing coverage of |
| which is a part of the standard library since Python 3.8. For older versions of | ||
| Python, its backport :pypi:`importlib_metadata` should be used. While using the | ||
| backport, the only change that has to be made is to replace ``importlib.metadata`` | ||
| which is a part of the standard library since Python 3.8 and is non-provisional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue/reason to use importlib_metadata for Python older than 3.10 is python/importlib_metadata#396 ? Is that something we want to mention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are other reasons too - basically for early adoption of any behavior that was added to importlib_metadata but isn't yet in the supported Pythons. Still, that seems like something for cpython/importlib_metadata to advertise.
|
@abravalheri There's been some small updates since your last review, so I reset your vote. There's also a ton of overlap with #4138 from @jaraco |
|
Thanks for all the work here. Let's get this merged. We can tweak more later if needed. |
Summary of changes
Prompted by https://github.com/pypa/setuptools/pull/3979/files#r1257406447
Removing obsolete code and workarounds benefit type-checkers.
This PR avoids touching any of the
_vendor,_distutils,externordeprecatedfoldersMore details for specific changes are added as comments below.
Pull Request Checklist
newsfragments/.(See documentation for details)