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

Requirements File Providing global-option to Incorrect Requirements #3830

Closed
jayfo opened this issue Jul 3, 2016 · 1 comment · Fixed by #4579
Closed

Requirements File Providing global-option to Incorrect Requirements #3830

jayfo opened this issue Jul 3, 2016 · 1 comment · Fixed by #4579
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior

Comments

@jayfo
Copy link

jayfo commented Jul 3, 2016

  • Pip version: 8.1.2
  • Python version: 3.5.0
  • Operating System: Travis

Description:

A requirements file containing a --global-option passes that option to requirements other than that on which it was specified. This file will therefore fail:

pyyaml==3.11 --global-option='--without-libyaml'
requests==2.10.0

With the error:

Running setup.py install for requests ... error
    Complete output from command /home/travis/virtualenv/python3.5.0/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-aqgoiffd/requests/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" --without-libyaml install --record /tmp/pip-o_9poof_-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python3.5.0/include/site/python3.5/requests:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --without-libyaml not recognized

What I've Run:

I have created a small repository to reproduce the error:

https://github.com/jayfo/pip-requirements-bug

The current state of the repository is trivial. I have submitted two pull requests.

The pull which lists the global-option requirement first, as above, fails:

https://github.com/jayfo/pip-requirements-bug/pull/2

Swapping the order is enough in this case, as this passes:

https://github.com/jayfo/pip-requirements-bug/pull/1

@xavfernandez
Copy link
Member

Related to #3763

@pradyunsg pradyunsg added the type: bug A confirmed bug or unintended behavior label Jun 29, 2017
simnalamburt added a commit to devsisters/pip that referenced this issue Feb 1, 2018
Prevent '--install-option' and '--global-option' from leaking into the
next dependencies in the 'requirements.txt' file.

You should not mutate the parameters provided by the caller unless you
are aware of what you're doing.

    # BAD! Mutating the parameter!
    def bad(param):
        param += ['a']

    # OK. Binding a new object to the name.
    def good(param):
        param = param + ['a']

Fixes pypa#3763, pypa#3830, and pypa#4453.

Reference:
  https://github.com/simnalamburt/snippets/blob/master/python/pip-4453.py
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants