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

Work around requirementslib AttributeError #334

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Thynix
Copy link

@Thynix Thynix commented Jul 12, 2023

(This also fixes bumping setup.py version but not the module's __version__, intended for squashing.)

See pypa/pipenv#5167 (comment)

This could lead to failures like

$ pipenv install
Pipfile.lock (6c5d3c) out of date, updating to (dd7943)...
Locking [packages] dependencies...
⠸ Resolving dependencies...
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 845, in <module>
    main()
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 831, in main
    _main(
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 811, in _main
    resolve_packages(
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 759, in resolve_packages
    results, resolver = resolve(
                        ^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 738, in resolve
    return resolve_deps(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 1100, in resolve_deps
    results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
                                                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 888, in actually_resolve_deps
    resolver = Resolver.create(
               ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 458, in create
    constraints, skipped, index_lookup, markers_lookup = resolver.get_metadata(
                                                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 246, in get_metadata
    constraint_update, lockfile_update = self.get_deps_from_req(
                                         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 325, in get_deps_from_req
    req_list, lockfile = get_vcs_deps(reqs=[req])
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/dependencies.py", line 125, in get_vcs_deps
    with temp_path(), locked_repository(requirement) as repo:
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/utils/dependencies.py", line 375, in locked_repository
    with requirement.req.locked_vcs_repo(src_dir=src_dir) as repo:
  File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2203, in locked_vcs_repo
    self._parsed_line.vcsrepo = vcsrepo
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 903, in vcsrepo
    setupinfo = SetupInfo.create(
                ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1564, in create
    created.get_initial_info()
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1393, in get_initial_info
    parsed.update(self.parse_setup_py())
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1118, in parse_setup_py
    parsed = ast_parse_setup_py(self.setup_py.as_posix())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 839, in ast_parse_setup_py
    return SetupReader.read_setup_py(Path(path), raising)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 180, in read_setup_py
    "install_requires": caller(cls._find_install_requires, setup_call, body),
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 172, in caller
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 335, in _find_install_requires
    return [el.s for el in value.elts]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 335, in <listcomp>
    return [el.s for el in value.elts]
            ^^^^
AttributeError: 'IfExp' object has no attribute 's'

See pypa/pipenv#5167 (comment)

This could lead to failures like

    $ pipenv install
    Pipfile.lock (6c5d3c) out of date, updating to (dd7943)...
    Locking [packages] dependencies...
    ⠸ Resolving dependencies...
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 845, in <module>
        main()
      File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 831, in main
        _main(
      File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 811, in _main
        resolve_packages(
      File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 759, in resolve_packages
        results, resolver = resolve(
                            ^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 738, in resolve
        return resolve_deps(
               ^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 1100, in resolve_deps
        results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
                                                             ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 888, in actually_resolve_deps
        resolver = Resolver.create(
                   ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 458, in create
        constraints, skipped, index_lookup, markers_lookup = resolver.get_metadata(
                                                             ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 246, in get_metadata
        constraint_update, lockfile_update = self.get_deps_from_req(
                                             ^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/resolver.py", line 325, in get_deps_from_req
        req_list, lockfile = get_vcs_deps(reqs=[req])
                             ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/dependencies.py", line 125, in get_vcs_deps
        with temp_path(), locked_repository(requirement) as repo:
      File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
        return next(self.gen)
               ^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/utils/dependencies.py", line 375, in locked_repository
        with requirement.req.locked_vcs_repo(src_dir=src_dir) as repo:
      File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
        return next(self.gen)
               ^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 2203, in locked_vcs_repo
        self._parsed_line.vcsrepo = vcsrepo
        ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/requirements.py", line 903, in vcsrepo
        setupinfo = SetupInfo.create(
                    ^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1564, in create
        created.get_initial_info()
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1393, in get_initial_info
        parsed.update(self.parse_setup_py())
                      ^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 1118, in parse_setup_py
        parsed = ast_parse_setup_py(self.setup_py.as_posix())
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 839, in ast_parse_setup_py
        return SetupReader.read_setup_py(Path(path), raising)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 180, in read_setup_py
        "install_requires": caller(cls._find_install_requires, setup_call, body),
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 172, in caller
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 335, in _find_install_requires
        return [el.s for el in value.elts]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/pipenv/vendor/requirementslib/models/setup_info.py", line 335, in <listcomp>
        return [el.s for el in value.elts]
                ^^^^
    AttributeError: 'IfExp' object has no attribute 's'
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

Successfully merging this pull request may close these issues.

1 participant