-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Egg-info location incorrect for modified package_dir in setup.py #464
Comments
edit: Sorry. Misread your post the first time around ... it's the other way around and you expect the same things as I would have, so there is definitely something strange going on. Will mark this as a bug for now. Just to give you quick feedback ... I did not read that blog post yet, but let me tell you that your posted setup settings look weird to me and I don't quite see the point. I will definitely look into that later, because I want to understand the reasoning behind that.
AFAIK the |
Edit: just read your edit lol. Will leave this here for future reference anyway. Thanks for the quick reply! It's not the most conventional setup settings perhaps, but setuptools' documentation itself has an example of using Regarding the location of
After reading that, I gather it is possible to modify it if calling Anyhow, I'd personally refrain from calling setup.py with the more advanced and obscure options XD. |
@obestwalter egg-info for develop is put into sys.path, if sys.path is a package dir like src, it goes there |
I don't understand. |
@obestwalter when you use package_dirs it does not unless you do a sdist as far as i understood |
o.k. thanks for the clarification @RonnyPfannschmidt. |
To expand on the $ python2.7 -m virtualenv ~/.venvs/srctest && source ~/.venvs/srctest/bin/activate
(srctests) $ ls mypackage
src setup.py
(srctests) $ cat mypackage/setup.py
from setuptools import find_packages, setup
setup(
name='in_src',
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=[
'requests',
'click==5.0'
]
)
(srctest) $ python -c "import sys; print '\n'.join(sys.path)"
/home/selimb/.venvs/srctest/lib/python27.zip
/home/selimb/.venvs/srctest/lib/python2.7
/home/selimb/.venvs/srctest/lib/python2.7/plat-cygwin
/home/selimb/.venvs/srctest/lib/python2.7/lib-tk
/home/selimb/.venvs/srctest/lib/python2.7/lib-old
/home/selimb/.venvs/srctest/lib/python2.7/lib-dynload
/usr/lib/python2.7
/usr/lib/python2.7/plat-cygwin
/home/selimb/.venvs/srctest/lib/python2.7/site-packages
(srctest) $ pip install --editable mypackage
Obtaining file:///cygdrive/d/scripts/tmp/mypackage
Collecting requests (from in-src==0.0.0)
Collecting click==5.0 (from in-src==0.0.0)
Installing collected packages: requests, click, in-src
Running setup.py develop for in-src
Successfully installed click-5.0 in-src requests-2.13.0
(srctest) $ python -c "import sys; print '\n'.join(sys.path)"
/home/selimb/.venvs/srctest/lib/python27.zip
/home/selimb/.venvs/srctest/lib/python2.7
/home/selimb/.venvs/srctest/lib/python2.7/plat-cygwin
/home/selimb/.venvs/srctest/lib/python2.7/lib-tk
/home/selimb/.venvs/srctest/lib/python2.7/lib-old
/home/selimb/.venvs/srctest/lib/python2.7/lib-dynload
/usr/lib/python2.7
/usr/lib/python2.7/plat-cygwin
/home/selimb/.venvs/srctest/lib/python2.7/site-packages
/cygdrive/d/scripts/tmp/mypackage/src
(srctest) $ tree mypackage
mypackage
├── setup.py
└── src
├── in_src
└── in_src.egg-info Notice how a line was appended to I purposefully didn't do |
Note that I also ran into something similar to this while doing some (admittedly awful) setup.py introspection. My solution (while slightly janky) worked pretty well for me and may benefit the tox project: out, srcdir = _call_setup_py(srcdir, _find_setup_py(), 'egg_info')
for line in out.decode('UTF-8').splitlines():
if line.startswith('writing ') and line.endswith('/PKG-INFO'):
_, pkg_info = line.split(' ')
egg_info_dir, _, _ = pkg_info.rpartition('/')
requires_txt = os.path.join(srcdir, egg_info_dir, 'requires.txt') The implementation of
I was of course searching for requires.txt -- I only skimmed the issue but I imagine the |
@selimb looks like a PR is on the horizon for this - great :) |
My Setup
My package lies inside an
src
directory. This decision was inspired by Ionel's blog post.The parts of my config relevant to this issue are:
In
setup.py
tox.ini
:Problem
I noticed that
develop-inst-nodeps
was being run on every call to tox, even though the docs mention:This is because it only looks for the
egg-info
in the same directory assetup.py
. However, it seems to mesetup.py develop
outputsegg-info
to thepackage_dir
, in my casesrc
. Here is the relevant part of the tox code (invenv.py
):Suggestions
Of course, it could be I'm just missing something and that this is not the recommended approach. Assuming this is indeed a bug, here are my suggestions.
The best way would be to find out what
package_dir
is and look foregg-info
in that directory. After a bit of digging it doesn't seem it can simply be extracted from thepython setup.py
command (like--name
for instance). Then, one could either parse thesetup.py
file or the output ofpython setup.py develop
, both of which I think are quite messy.The other, much much simpler way, is to allow a
package_dir
key intox.ini
. This results in duplicated information...but how often is that setting likely to be changed?I'd be up for submitting a PR for the latter approach.
The text was updated successfully, but these errors were encountered: