Issue
I am getting an error when trying to install a python package with pip.
It is looking in a certain directory for "setup.py" after untaring the package and it can't find it there. The setup.py file is actually one directory down.
It's looking in:
'virtualenvs/pyling/build/nltk/setup.py'
but it's actually in:
virtualenvs/pyling $ ls build/nltk/nltk-2.0b9/
INSTALL.txt javasrc LICENSE.txt nltk PKG-INFO README.txt setup.py
Is there a way to make pip aware of this nested folder structure in the package?
Thanks
Solution
i added a little function and call it in the property definition for setup_py in the pip/req.py file.
this seems to make it work the way i expect, that is if the setup.py file is only one layer deeper. hopefully nothing gets busted when bundling and freezing...
import os
def get_setup_path(in_path):
print "starting path is %s"%in_path
fileList=os.listdir(in_path)
if fileList.__contains__("setup.py"):
print "setup.py is indeed there"
return in_path
for f in fileList:
f=os.path.join(in_path,f)
if os.path.isdir(f):
contents=os.listdir(f)
if contents.__contains__("setup.py"):
out_path=os.path.join(in_path,f)
return out_path
print "could not find setup.py by looking one level deeper"
return in_path
and then call it here in req.py
(around line 195 in req.py)
@property
def setup_py(self):
self.source_dir= get_setup_path(self.source_dir)
return os.path.join(self.source_dir, 'setup.py')
Answered By - dave