Skip to content

Conversation

@nakato
Copy link
Contributor

@nakato nakato commented Jun 29, 2015

Currently if the local package you are trying to install is listed in
the constraint file it will silently fail to install the local package
while installing its dependencies.

This process was caused by the has_requirement returning true when a
constraint with that name was defined, resulting in the local package
not being processed.

Closes #2928

@rbtcollins
Copy link

I think this is still buggy. The error you look for says to me that the code is trying to install the constrained version. But the users requested actions are actually inconsistent: we can't both install the constrained version and install the editable version.

So I think we specifically want an error like the error that occurs if you put the following in a requirements file:

foo==1
foo==2

@rbtcollins
Copy link

(test)robertc@trusty-64:~/work/pip$ git checkout FETCH_HEAD
Previous HEAD position was 40242fe... Merge pull request #2934 from jamezpolley/user_implies_null_prefix
HEAD is now at e2c154a... Attempt to install editable packge defined in constraints should error
(test)robertc@trusty-64:~/work/pip$ pip install -e .
Obtaining file:///home/robertc/work/pip
Installing collected packages: pip
  Running setup.py develop for pip
Successfully installed pip-7.1.0.dev0
(test)robertc@trusty-64:~/work/pip$ pip install -c constraints.txt -e . 
Obtaining file:///home/robertc/work/pip
Collecting pip==7.0.3 (from -c constraints.txt (line 1))
/home/robertc/work/pip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached pip-7.0.3-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.0.dev0
    Uninstalling pip-7.1.0.dev0:
      Successfully uninstalled pip-7.1.0.dev0
Successfully installed pip-7.1.0.dev0
(test)robertc@trusty-64:~/work/pip$ pip list | grep pip
pip (7.1.0.dev0)

So its -very- confused.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than making a new one, use singlemodule.

Its in an index in data/packages/ versions 0.0.0 and 0.0.1 and it's source is in data/src/singlemodule. So you can constrain to version 0.0.0 and use -f data/packages --no-index -e src/singlemodule.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite a bit cleaner than adding a new package. Done.

@rbtcollins
Copy link

Hey thats looking super close.

I wonder if its possible to make it support this test as well?

def test_constrained_to_url_install_same_url(script, data):
    to_install = data.src.join("singlemodule")
    script.scratch_path.join("constraints.txt").write(
        "file://%s#egg=singlemodule" % to_install
    )
    result = script.pip(
        'install', '--no-index', '-f', data.find_links, '-c',
        script.scratch_path / 'constraints.txt', to_install)
    assert 'Running setup.py install for singlemodule' in result.stdout

@rbtcollins
Copy link

\o/ this looks solid to me. @dstufft ?

@nakato
Copy link
Contributor Author

nakato commented Aug 11, 2015

I'm expecting this to fail.

Currently if the local package you are trying to install is listed in
the constraint file it will silently fail to install the local package
while installing its dependancies.

This process was caused by the has_requirement returning true when a
constraint with that name was defined, resulting in the local package
not being processed.

Closes #2928
@nakato
Copy link
Contributor Author

nakato commented Aug 17, 2015

Latest change is a rebase to top of develop. Just to get the updated dev-requirements.txt

When installing an editable from file:///path/to/file, pip currently does
not attempt to determine the name from #egg=NAME, just passing back
None.  This causes constraints code to completely ignore this line
resulting in unexpected installation behaviour.

This patch makes '-e file:///path#egg=name' function similarly to
'file:///path#egg=name' and '-e git+URL#egg=name'.  If #egg=name is not
defined, it returns None and the package becomes an unamed requirement,
which constraints will not parse but in the case of a requirement will
later be processed and determined.

Closes #3026
@nakato
Copy link
Contributor Author

nakato commented Sep 14, 2015

After a discussion with lifeless this morning, I found out that putting the controversial patch in a separate branch and create a pull request for it and things will just work. So I've split that off to a new PR. As far as I'm concerned these two are all good to go.

dstufft added a commit that referenced this pull request Sep 14, 2015
Attempt to install editable packge defined in constraints should error
@dstufft dstufft merged commit 11d96fb into pypa:develop Sep 14, 2015
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants