ambv / bitrot

Detects bit rotten files on the hard drive to save your precious photo and music collection from slow decay.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

“python_requires” should be set with “>=3”, as bitrot 1.0.0 is not compatible with all Python versions.

PyVCEchecker opened this issue · comments

Currently, the keyword argument python_requires of setup() is not set, and thus it is assumed that this distribution is compatible with all Python versions.
However, I found it is not compatible with Python2. My local Python version is 2.7, and I encounter the following error when executing “pip install bitrot”

Collecting bitrot
  Downloading bitrot-1.0.0.tar.gz (11 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v9p1bP/bitrot/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v9p1bP/bitrot/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 /tmp/pip-install-v9p1bP/bitrot/pip-egg-info
         cwd: /tmp/pip-install-v9p1bP/bitrot/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-v9p1bP/bitrot/setup.py", line 39, in <module>
        from bitrot import VERSION
      File "/tmp/pip-install-v9p1bP/bitrot/src/bitrot.py", line 190, in <module>
        class Bitrot(object):
      File "/tmp/pip-install-v9p1bP/bitrot/src/bitrot.py", line 193, in Bitrot
        chunk_size=DEFAULT_CHUNK_SIZE, workers=os.cpu_count(),
    AttributeError: 'module' object has no attribute 'cpu_count'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I noticed that bitrot.py used the function os.cpu_count. os.cpu_count only exists in Python 3, resulting in installation failure of bitrot in Python2.

Way to fix:
modify setup() in setup.py, add python_requires keyword argument:

setup(…
     python_requires='>=3',
     …)

Thanks for your attention.
Best regrads,
PyVCEchecker