andreafrancia / trash-cli

Command line interface to the freedesktop.org trashcan.
GNU General Public License v2.0
3.65k stars 178 forks source link

Consider specyfing python_version for typing dependency in setup.cfg #292

Closed aelspire closed 1 year ago

aelspire commented 1 year ago

Describe the bug

typing is part of Python's standard library and simply specifying it as dependency here: https://github.com/andreafrancia/trash-cli/blob/master/setup.cfg#L30 causes pip check do display such error message:

trash-cli 0.23.2.13.2 requires typing, which is not installed.

please consider changing this line to:

typing;python_version<'3.5'

As per documentation: https://setuptools.pypa.io/en/latest/userguide/quickstart.html#basic-use

andreafrancia commented 1 year ago

Please tell me more about this error. Does pip install trash-cli anyway or it is stopped by this error?

What is exactly the command that fails? What are the conditions in which this happen, does it depends from python version? Can you send a pull request with the modification you suggested?

Can you also add to the scripts/test-sdist the pip check command?

Thank you.

aelspire commented 1 year ago

Does pip install trash-cli anyway or it is stopped by this error?

It completes, and trash-cli works the error causes other problems.

What is exactly the command that fails? What are the conditions in which this happen, does it depends from python version?

$ python --version
Python 3.11.2
$ pip check
trash-cli 0.23.2.13.2 requires typing, which is not installed.

And now the thing is: Building firefox with MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system fails. This option causes firefox's build to use system's installed python packages and it checks if those packages don't have any compatibility problems and fails with log:

Package               Version     Location                                                                                    Installer
--------------------- ----------- ------------------------------------------------------------------------------------------- ---------
aiohttp               3.7.4.post0 /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/aiohttp
ansicon               1.89.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/ansicon
appdirs               1.4.4       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/appdirs
async-timeout         3.0.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/async_timeout
attrs                 19.2.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/attrs
blessed               1.19.1      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/blessed
cbor2                 4.0.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/cbor2
certifi               2018.4.16   /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/certifi
chardet               4.0.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/chardet
click                 7.1.2       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/click
colorama              0.4.5       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/colorama
compare-locales       8.2.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/compare_locales
cookies               2.2.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/cookies
cram                  0.7         /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/cram
diskcache             4.1.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/diskcache
distro                1.4.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/distro
docutils              0.19        /usr/lib/python3.11/site-packages
ecdsa                 0.15        /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/ecdsa
esprima               4.0.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/esprima
fluent.migrate        0.11        /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/fluent.migrate
fluent.syntax         0.18.1      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/fluent.syntax
giturlparse           0.10.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/giturlparse
idna                  2.10        /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/idna
idna-ssl              1.1.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/idna-ssl
importlib-metadata    1.7.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/importlib_metadata
iso8601               0.1.14      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/iso8601
Jinja2                2.11.3      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/Jinja2
jinxed                1.2.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/jinxed
jsmin                 2.1.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/jsmin
json-e                2.7.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/json-e
jsonschema            3.2.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/jsonschema
looseversion          1.0.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/looseversion
Mako                  1.2.4       /usr/lib/python3.11/site-packages
MarkupSafe            2.0.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/MarkupSafe/src
meson                 1.0.1       /usr/lib/python3.11/site-packages
mohawk                0.3.4       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/mohawk
mozilla-repo-urls     0.1.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/mozilla_repo_urls
mozilla-version       0.3.4       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/mozilla_version
multidict             5.1.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/multidict
packaging             20.9        /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/packaging
pathspec              0.9.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pathspec
pip                   21.2.4      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pip
pip-tools             5.5.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pip_tools
ply                   3.10        /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/ply
psutil                5.9.4       /usr/lib/python3.11/site-packages
pyasn1                0.4.8       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pyasn1
pyasn1-modules        0.2.8       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pyasn1_modules
pyparsing             2.4.7       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pyparsing
pyrsistent            0.16.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pyrsistent
pytoml                0.1.10      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/pytoml
PyYAML                5.4.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/PyYAML/lib3
redo                  2.0.3       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/redo
requests              2.25.1      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/requests
requests-unixsocket   0.2.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/requests_unixsocket
responses             0.10.6      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/responses
rsa                   3.1.4       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/rsa
sentry-sdk            0.14.3      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/sentry_sdk
setuptools            51.2.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/setuptools
six                   1.13.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/six
slugid                2.0.0       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/slugid
taskcluster           44.2.2      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/taskcluster
taskcluster-taskgraph 3.5.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/taskcluster_taskgraph
taskcluster-urls      13.0.1      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/taskcluster_urls
toml                  0.10.2      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/toml
tqdm                  4.62.3      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/tqdm
trash-cli             0.23.2.13.2 /usr/lib/python3.11/site-packages
typing-extensions     3.10.0.0    /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/typing_extensions
urllib3               1.26.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/urllib3
voluptuous            0.12.1      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/voluptuous
wcwidth               0.2.5       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/wcwidth
wheel                 0.37.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/wheel
yamllint              1.23.0      /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/yamllint
yarl                  1.6.3       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/yarl
zipp                  3.4.1       /home/aelspire/.cache/kiss/proc/2902/build/firefox/third_party/python/zipp
trash-cli 0.23.2.13.2 requires typing, which is not installed.

Creating global state directory from environment variable: /home/aelspire/.cache/kiss/proc/2902/build/firefox/state
Running "pip check" to verify compatibility between the system Python and the "mach" site.
Traceback (most recent call last):
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/./mach", line 94, in <module>
    main(sys.argv[1:])
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/./mach", line 86, in main
    mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/./mach", line 33, in check_and_get_mach
    return load_mach(dir_path, mach_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/./mach", line 19, in load_mach
    return mach_initialize.initialize(dir_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/build/mach_initialize.py", line 147, in initialize
    _activate_python_environment(
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/build/mach_initialize.py", line 93, in _activate_python_environment
    mach_environment.activate()
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/python/mach/mach/site.py", line 369, in activate
    self.ensure()
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/python/mach/mach/site.py", line 347, in ensure
    result = self._up_to_date()
             ^^^^^^^^^^^^^^^^^^
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/python/mach/mach/site.py", line 335, in _up_to_date
    _assert_pip_check(self._sys_path(), "mach", self._requirements)
  File "/home/aelspire/.cache/kiss/proc/2902/build/firefox/python/mach/mach/site.py", line 1235, in _assert_pip_check
    raise Exception(
Exception: According to "pip check", the current Python environment has package-compatibility issues.

But I think that pip check command shouldn't report any problems and trash-cli's typing dependency causes this error.

Can you send a pull request with the modification you suggested? Can you also add to the scripts/test-sdist the pip check command?

I'll try to send a pull request soon. I'm little busy now (family and other things) so it will take a few days.

Thanks for your response.