-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Drop support for EOL Python 3.3 #3060
Conversation
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.
Thanks for this pull-request. Beside some minore remarks (see inline notes), there are some major issues:
-
Files in
PyInstaller/lib/modulegraph
andtests/unit/test_modulegraph
are incorporated from upstream and should not be changed. Otherwise applying upstream patches would become cumbersome. -
All places where
is_py34
is used need to be checked, too, and eventually changed intois_py3
or be removed.is_py34
basically means "is python 3, but not python3.3" and thus typically mark places where special treatment for Python 3.3 needs t be done. -
Please group the changes into several commits with each commit including related changes. E.g.
- drop continuous integration tests for Python 3.3.
- "Remove xfail and skip for Python 3.3 (needs better wording
- requirements: Remove special treatment for python 3.3.
- remove compat flags for Python3.3 (need better wordking).
For the commit messages please also have a look at old messages. git gui blame
and git log FILENAME
are your friends.
Thanks.
.pylintrc
Outdated
@@ -1,7 +1,7 @@ | |||
[MASTER] | |||
# Add files or directories to the blacklist. They should be base names, not | |||
# paths. | |||
ignore=CVS,altgraph,macholib,pefile.py,six.py,unittest2,ordlookup,modulegraph | |||
ignore=CVS,altgraph,macholib,pefile.py,six.py,ordlookup,modulegraph |
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.
Nice, obviously it's time to clean this up, but then we clean up all outdated stuff: pefile.py and six.py are gone, too, CVS we never had.
And please put this into a separate commit, since it is not related to dropping support for any python version. Even unittest2 is not part of PyInstaller since long now.
PyInstaller/compat.py
Outdated
@@ -28,7 +28,7 @@ | |||
is_py3 = sys.version_info[0] == 3 | |||
# Distinguish specific code for various Python versions. | |||
is_py27 = sys.version_info >= (2, 7) and sys.version_info < (3, 0) | |||
# PyInstaller supports only Python 3.3+ | |||
# PyInstaller supports only Python 3.4+ | |||
# Variables 'is_pyXY' mean that Python X.Y and up is supported. | |||
is_py34 = sys.version_info >= (3, 4) |
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.
This can be removed, too.
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.
is_py34
is used here:
pyinstaller/PyInstaller/compat.py
Lines 172 to 180 in 8e199eb
# In Python 3.4 module 'imp' is deprecated and there is another way how | |
# to obtain magic value. | |
if is_py34: | |
import importlib.util | |
BYTECODE_MAGIC = importlib.util.MAGIC_NUMBER | |
else: | |
# This fallback should work with Python 2.7 and 3.3. | |
import imp | |
BYTECODE_MAGIC = imp.get_magic() |
Should that be reversed into something like this?
# In Python 3.4 module 'imp' is deprecated and there is another way how
# to obtain magic value.
if is_py27:
# This fallback should work with Python 2.7.
import imp
BYTECODE_MAGIC = imp.get_magic()
else:
# Python 3.4+
import importlib.util
BYTECODE_MAGIC = importlib.util.MAGIC_NUMBER
And shall we delete is_py27
and replace it with is_py2
?
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.
Reversing is a good idea. I'd use is_py2, since it is clearer.
@@ -133,7 +133,7 @@ | |||
"import sys,types,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('", | |||
"import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('", | |||
"import sys, types, os;p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('", | |||
"import sys, types, os;pep420 = sys.version_info > (3, 3);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('", | |||
"import sys, types, os;pep420 = sys.version_info > (3, 4);p = os.path.join(sys._getframe(1).f_locals['sitedir'], *('", |
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.
This must not be changed. These are pattern to match files generated by setuptools. And setuptools (or some version of it out in the wild) may still generate this code.
@@ -158,6 +155,7 @@ def run(self): | |||
|
|||
setup( | |||
install_requires=REQUIREMENTS, | |||
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', |
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.
Adding this keyword argument will requires a quite recent version of setuptools, which might not be a available on enterprise GNU/Linux distributions. Thus this should not be used.
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.
If you have old setuptools, I believe this will be ignored, where it makes no difference.
If you have a recent setuptools, then this is useful and will help people install the correct version.
Shall I leave it or remove it?
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've left it in for now, can remove it if necessary.
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 verified: Old setuptools will issue a warning, which is okay.
tests/requirements-libraries.txt
Outdated
# sphinx 1.5 requires Python 2.7 or >= 3.4 | ||
sphinx==1.6.3; python_version != '3.3' | ||
sphinx==1.4.9; python_version == '3.3' # pyup: ignore | ||
sphinx==1.6.3 | ||
|
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.
Please also remove the empty lines. There is no use in keeping them, now the "block" is gone. Same below.
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.
Thanks for the quick update. There are still some left-overs of is_py34
in the code, e.g. a now unused import. Please remove it where no longer necessary.
The only place I'm spotting where is_py34 is used is tests/functional/test_multiprocess.py
So I suggest using is_py3
there and drop is_py34
(this can go into one commit).
Regarding the commit messages: Please mind the subsystem prefixes, see https://pyinstaller.readthedocs.io/en/latest/development/commit-messages.html#commit-messages. Thanks.
PyInstaller/compat.py
Outdated
@@ -28,7 +28,7 @@ | |||
is_py3 = sys.version_info[0] == 3 | |||
# Distinguish specific code for various Python versions. | |||
is_py27 = sys.version_info >= (2, 7) and sys.version_info < (3, 0) | |||
# PyInstaller supports only Python 3.3+ | |||
# PyInstaller supports only Python 3.4+ | |||
# Variables 'is_pyXY' mean that Python X.Y and up is supported. | |||
is_py34 = sys.version_info >= (3, 4) |
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.
Reversing is a good idea. I'd use is_py2, since it is clearer.
# Python 3.3 | ||
self.pymagic = _frozen_importlib._MAGIC_BYTES | ||
elif sys.version_info[1] == 4: | ||
if sys.version_info[:2] == (3, 4): |
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.
Minor nitpick: Hmm, we could leave the test as version_info[1] == 4
, since the version_info[0]
is already tested above.
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.
Should this run on Python 4.4, or only Python 3.4?
https://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/
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.
Since Python 3.4 is EOL 2019-03-16, and not even Python 4.0 is even planned. Thus I'm convinced this code will be dropped much earlier then 4.4 will appear :-)
@@ -73,12 +64,9 @@ ipython==5.4.1; python_version == '2.7' # pyup: ignore | |||
# dateutil.tz is a package in 2.5.0 and does not play nice with PyInstaller. | |||
python-dateutil==2.6.1 | |||
|
|||
pandas==0.20.3; python_version != '3.3' | |||
pandas==0.16.2; python_version == '3.3' # pyup: ignore | |||
pandas==0.20.3 | |||
|
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.
Please remove the blank lines around these blocks, too.
By chance I found another place, where Py 3.3 code is used: See just below PY3_BASE_MODULES in compat.py. So I suggest greping the code for sys.version_info. |
|
||
|
||
if not is_py34: | ||
class suppress(object): |
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.
This PR cannot be merged int it's current state because it removes this compatibility function. This should not be removed because it is required to run on Python 2.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.
Yes, that was a mistake in the rebase that needs sorting.
@hugovk Thanks again for taking the time for this pull-request. I had had planed to incorporate this for release 3.4 only, but now here are many test failing due to other packages dropping Pyhton 3.3. support. May I ask you to finish the clean up soon, so I can merge?! Thanks. Cleanup to do:
I can do this for you, but then this pull-request will be credited to you (github restriction). |
@htgoebel I can take care of it if this will be merged quickly. |
Sure. Fixing the CI is a priority though. |
It'd be great if you could finish this off, that'd be quickest. Sorry to leave this hanging for so long. I'm not too bothered about the credit. Thank you! |
Closed in favour of #3288. |
Continuation of #3045.
Tests are failing due to pytest (or rather py) dropping support for EOL Python 3.3 (pytest-dev/py#159 pytest-dev/py#165).
Here's the pip installs for pyinstaller from PyPI for the last month (via
pypinfo --percent --pip pyinstaller pyversion
), showing a very small fraction for 3.3:This also cleans up some redundant code for Python <= 2.6.