Page MenuHomePhabricator

Don't clutter /usr/lib/python2.7/site-packages/
Closed, ResolvedPublic

Description

Author: yardenack

Description:
It's reasonable to expect setup.py to install things in this directory:

/usr/lib/python2.7/site-packages/pywikibot/

But it's not reasonable for it to also put things in these directories:

/usr/lib/python2.7/site-packages/externals/
/usr/lib/python2.7/site-packages/scripts/
/usr/lib/python2.7/site-packages/tests/

What if every python project tried to do that?


Version: core-(2.0)
Severity: normal
OS: Linux
URL: https://github.com/yardenac/pkgbuilds/blob/master/packages/python2-pywikibot-git/

Details

Reference
bz55584

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:25 AM
bzimport set Reference to bz55584.
bzimport added a subscriber: Unknown Object (????).

Setting packages=['pywikibot'],
in setup.py does not seem to solve this.

Simple way to reproduce:

valhallasw@lisilwen:~/src/pwb/pywikibot-core$ virtualenv test
New python executable in test/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
valhallasw@lisilwen:~/src/pwb/pywikibot-core$ source test/bin/activate
valhallasw@lisilwen:~/src/pwb/pywikibot-core$ python setup.py install
(...)
(test)valhallasw@lisilwen:~/src/pwb/pywikibot-core$ ls -l test/lib/python2.7/site-packages/
total 40
drwxrwxr-x 4 valhallasw valhallasw 4096 Oct 10 22:03 distribute-0.6.24-py2.7.egg
-rw-rw-r-- 1 valhallasw valhallasw 235 Oct 10 22:03 easy-install.pth
drwxrwxr-x 3 valhallasw valhallasw 4096 Oct 10 22:04 externals
drwxrwxr-x 4 valhallasw valhallasw 4096 Oct 10 22:03 pip-1.1-py2.7.egg
drwxrwxr-x 7 valhallasw valhallasw 4096 Oct 10 22:04 pywikibot
drwxrwxr-x 2 valhallasw valhallasw 4096 Oct 10 22:04 Pywikipediabot-2.0b1-py2.7.egg-info
drwxrwxr-x 2 valhallasw valhallasw 4096 Oct 10 22:04 Pywikipediabot.egg-info
drwxrwxr-x 3 valhallasw valhallasw 4096 Oct 10 22:04 scripts
-rw-rw-r-- 1 valhallasw valhallasw 30 Oct 10 22:03 setuptools.pth
drwxrwxr-x 6 valhallasw valhallasw 4096 Oct 10 22:04 tests

Change 101661 had a related patch set uploaded by Merlijn van Deen:
(bug 55584) only install pywikibot.*

https://gerrit.wikimedia.org/r/101661

Change 101661 merged by jenkins-bot:
(bug 55584) only install pywikibot.*

https://gerrit.wikimedia.org/r/101661

yardenack wrote:

Thanks, I'm trying again with commit b7bff6b. It is no longer installing those exact files but now it seems to install these, which are inappropriate for the same reason:

/usr/lib/python2.7/site-packages/easy-install.pth
/usr/lib/python2.7/site-packages/site.py
/usr/lib/python2.7/site-packages/site.pyc
/usr/lib/python2.7/site-packages/site.pyo

Should I open a new bug? I think this pretty much falls within the same scope.

I'm not sure -- it sounds like Setuptools installing itself to me (at least easy-install.pth is from Setuptools, and I think the site.py makes sure .egg's work.

Are you building on a system that has a recent-enough (2.0+) version of Setuptools installed? That might cause this, I think. It's not (or should not be) a runtime dependency, though.

Also, maybe you should use

python setup.py build

instead of

python setup.py install

as the latter is supposed to install dependencies, while the former just builds the set of files from to install.

setup.py install places all files in the following directory on my workstation.

/usr/lib/python2.7/site-packages/pywikibot-2.0b1-py2.7.egg

If you are still seeing files places in site-packages, please re-open and indicate which version of python and setuptools you are using.

Xqt changed the task status from Declined to Resolved.May 26 2020, 7:10 AM