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

prevent installation of latest version on Python 2.7 #318

Open
marunguy opened this issue May 14, 2021 · 7 comments
Open

prevent installation of latest version on Python 2.7 #318

marunguy opened this issue May 14, 2021 · 7 comments

Comments

@marunguy
Copy link

Windows 10 20H2 64bit, python 2.7.18.

In 2021.5.13 version, python 2.7 support is stopped.
When I tried to install it on Python 2.7 I got the error below.
I think that the previous version (2019.4.18) must be installed instead of the 2021.5.13 version.

py -2.7-32 -m pip install -U pefile
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting pefile
  Using cached pefile-2021.5.13.tar.gz (66 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\devtool\py27x86\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'d:\\users\\marunguy\\appdata\\local\\temp\\pip-install-ntlal5\\pefile\\setup.py'"'"'; __file__='"'"'d:\\users\\marunguy\\appdata\\local\\temp\\pip-install-ntlal5\\pefile\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'd:\users\marunguy\appdata\local\temp\pip-pip-egg-info-e2ku0w'
         cwd: d:\users\marunguy\appdata\local\temp\pip-install-ntlal5\pefile\
    Complete output (12 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:\users\marunguy\appdata\local\temp\pip-install-ntlal5\pefile\setup.py", line 86, in <module>
        long_description = "\n".join(_read_doc().split('\n')),
      File "d:\users\marunguy\appdata\local\temp\pip-install-ntlal5\pefile\setup.py", line 30, in _read_doc
        tree = ast.parse(f.read())
      File "D:\devtool\py27x86\lib\ast.py", line 37, in parse
        return compile(source, filename, mode, PyCF_ONLY_AST)
      File "<unknown>", line 3789
        f'Export directory contains more than 10 repeated entries '
                                                                  ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
@itamarst
Copy link

The way to fix this is to:

  1. Yank the current release, whcih I think PyPI does these days?
  2. Add python_requires=">=3.6.0", to the setup() function in setup.py (assuming you have one, or just configure this metadata elsewhere).
  3. Do another release.

The result will be:

  1. Python 2 users get latest release that supports Python 2 (I encountered this working on project I'm helping port).
  2. Python 3 users get latest release.

@digitalsleuth
Copy link

Looks like the reason for this is the usage of the f-string interpolation which is only available in Python 3. However, modifying lines 3789 and 3790 to replace the f' string formatting with .format() then everything works as it should. These lines would now read:

'Export directory contains more than 10 repeated entries '
'({}, {:02x}). Assuming corrupt.'.format(symbol_name, symbol_address))

@erocarrera
Copy link
Owner

The way to fix this is to:

  1. Yank the current release, whcih I think PyPI does these days?
  2. Add python_requires=">=3.6.0", to the setup() function in setup.py (assuming you have one, or just configure this metadata elsewhere).
  3. Do another release.

The result will be:

  1. Python 2 users get latest release that supports Python 2 (I encountered this working on project I'm helping port).
  2. Python 3 users get latest release.

Thanks!! I'll do that.

erocarrera added a commit that referenced this issue May 24, 2021
* Fixed is_driver(), I was comparing bytes to decoded strings.
* Add test for is_driver() check
* Fixed some types in warning messages
* Made Python >=3.6 a requirement
@digitalsleuth
Copy link

Hi @erocarrera , The way to actually fix this error, is to fix the formatting issues which cause the error in python 2, as seen in PR #319. This will fix the installation issue for Python2.7. The fix methods above identified by @itamarst won't fix the cause of this issue, they will just allow the proper separation between Python 2 and Python 3.

@erocarrera
Copy link
Owner

Hi, I am no longer supporting Python 2. I prefer to focus the code on Python 3 and slowly take advantage of its features. I have yanked the version incompatible with Python 2 from PyPi, as suggested (thanks @itamarst ), so those systems can use a version that runs on them. All future fixes an improvements will only be tested to work under Python 3.

@digitalsleuth
Copy link

digitalsleuth commented May 24, 2021

While I can appreciate that you no longer wish to support Python 2, and I understand it, it's a shame that you pulled the last release because all that was needed to leave that as the last Python 2 supported pefile was to fix the formatting on two lines, merging that pull request, and the 2021.5.13 release would have been the last python 2 release.

As it stands now, the last compatible python 2 release you left is from 2019, which doesn't have any of the features or updates you added in the last two years.

Either way, I appreciate your work on the project. Thank you.

@erocarrera
Copy link
Owner

Thank you for understanding, I wish I had the cycles to keep it compatible a while longer but I had to drop Python 2 at some point. I hope it's not too annoying for you, maybe extra motivation to move to Python 3? ;-)

crwood added a commit to gridsync/gridsync that referenced this issue May 31, 2021
Since version 2019.4.18 is the last version that supports python2:

erocarrera/pefile#318
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

No branches or pull requests

4 participants