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

Cannot access file exception after missing egg-info warning #2075

Closed
Redundancy opened this Issue Sep 29, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@Redundancy

Redundancy commented Sep 29, 2014

I haven't found any reference to this issue through searching, so I'm submitting it here.
https://mail.python.org/pipermail/distutils-sig/2013-August/022528.html

I have a reproduction case installing the awacs library:
Could not find .egg-info directory in install record for awacs==0.4.2

which then causes the exception attempting to remove the install-record.txt file.
This was with pip 1.5.6 (on Windows 8)

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Sep 29, 2014

Contributor

Couple notes:

I've taken a look in the code and found the source of the warning message seems to be that pip relies on the egg-info directory being present in the record file:

https://github.com/pypa/pip/blob/develop/pip/req/req_install.py#L801

 f = open(record_filename)
for line in f:
    line = line.strip()
    if line.endswith('.egg-info'):
        egg_info_dir = prepend_root(line)
        break
else:
    logger.warning('Could not find .egg-info directory in install record for '
            '%s', self,)

If the "no directories in record file" change goes back in we'll need to change this to something like:

    try:
        offset = line.find('.egg-info/PKG-INFO')
    except:
        pass
    else:
        egg_info_dir = prepend_root(line[:offset+len('.egg-info')])
        break

I'll produce a pull request in a bit.

Contributor

abadger commented Sep 29, 2014

Couple notes:

I've taken a look in the code and found the source of the warning message seems to be that pip relies on the egg-info directory being present in the record file:

https://github.com/pypa/pip/blob/develop/pip/req/req_install.py#L801

 f = open(record_filename)
for line in f:
    line = line.strip()
    if line.endswith('.egg-info'):
        egg_info_dir = prepend_root(line)
        break
else:
    logger.warning('Could not find .egg-info directory in install record for '
            '%s', self,)

If the "no directories in record file" change goes back in we'll need to change this to something like:

    try:
        offset = line.find('.egg-info/PKG-INFO')
    except:
        pass
    else:
        egg_info_dir = prepend_root(line[:offset+len('.egg-info')])
        break

I'll produce a pull request in a bit.

@abadger

This comment has been minimized.

Show comment
Hide comment
@abadger

abadger Sep 29, 2014

Contributor

I went with a more conservative version of checking. As long as we can depend on PKG-INFO being in the eggdir, checking that the line ends with .egg-info/PKG-INFO should have less chances of a false positive. If my asusmption about PKG-INFO always existing is wrong, we'd be better off using something based on offset = line.index('.egg-info/')

Contributor

abadger commented Sep 29, 2014

I went with a more conservative version of checking. As long as we can depend on PKG-INFO being in the eggdir, checking that the line ends with .egg-info/PKG-INFO should have less chances of a false positive. If my asusmption about PKG-INFO always existing is wrong, we'd be better off using something based on offset = line.index('.egg-info/')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment