-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Support egg/setuptools packages for PEP 561 searching. #5282
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
Conversation
mypy/test/testpep561.py
Outdated
| install_cmd.append('-e') | ||
| install_cmd.append('.') | ||
| else: | ||
| install_cmd = [python_executable, 'setup.py', 'install'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be develop if editable is True?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that would be better, but the test should just use pip and editable (since pip install -e . calls python setup.py develop). But just to be safe, I will change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, just one question about make_abspath().
mypy/build.py
Outdated
| if os.path.abspath(path) == path: | ||
| return path | ||
| else: | ||
| return os.path.join(root, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit complicated (perhaps in part because you're assigning to a parameter). Is the intention this?
if os.path.isabs(path):
return os.path.normpath(path)
else:
return os.path.join(root, os.path.normpath(path))
While that looks like more code the flow feels a bit clearer. Also it's possible that in one of the branches you don't actually care about normpath, but I can't tell. (Or possibly you might want to call it after calling join.) Finally I note that presumably root is assumed to be absolute itself, else the function name would be misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when I wrote this I didn't know isabs existed. :) But that is much better than what I was doing. I will use your suggested code.
This adds support for setuptool's egg format, which includes support for editable installs (
pip install -e ./python setup.py develop)!Setuptools creates its own directory to put the package we want to find. These directories are listed in
easy-install.pthin a site-package directory.Fixes #5007