[openstack-dev] [all] [glance] python namespaces considered harmful to development, lets not introduce more of them
Robert Collins
robertc at robertcollins.net
Tue Sep 30 01:05:40 UTC 2014
>> Now, as I say, I can fix this quite easily with a virtualenv aware pth
>> file, but since its broken today and AFAIK there isn't a bug open
>> about this, I think it will be fine.
>
> The breaking case was having a package installed editable in the global site-packages and then installing another sub-package non-editable in the virtualenv. We stopped doing that by making devstack install oslo libraries non-editable, but I think, based on what you’re saying, if the test environment has access to the global site-packages and only some of the oslo libs are installed then building the test environment will fail if it needs another lib because it won’t install the packages it can see globally. Is that right? Has anyone encountered that situation?
I needed to make a couple of tweaks, and I got confused, so I've
written a test script.
Anyhow:
Editable in global, ok, lets see..
sudo apt-get remove python-oslo.config
sudo pip install -e ./openstack/oslo.config
...
Found existing installation: six 1.5.2
Uninstalling six:
Successfully uninstalled six
Successfully installed oslo.config six netaddr
(Thats going to confuse dpkg, which thinks it installed six, but
nevermind, moving on :)
mkvirtualenv --system-site-packages test-system-site
pip install ./pbr
cd oslo
pip install .
python -c 'import oslo.config'
# is ok
cd ../openstack/oslo.db
pip install .
..
Found existing installation: oslo.config 1.2.1.2.g1ca69b8
Not uninstalling oslo.config at
/home/robertc/work/openstack/oslo.config, outside environment
/home/robertc/.virtualenvs/test-system-site
.. [note that that means it still installed a local oslo.config in the venv]
python -c 'import oslo.config'
# is ok
python -c 'import oslo.db'
# is ok
cd ..
python -c 'import oslo.config'
# is ok
python -c 'import oslo.db'
# is ok
pip uninstall oslo.db
cd openstack/oslo.db
python -c 'import oslo.config'
# ok
python -c 'import oslo.db'
# ok
And your second test, with oslo installed -e.
works fine with oslo.db installed non-dash-e
fails with oslo.db installed -e
fails with olso.db uninstalled
I'm poking around now. It looks like pip install -e outside a venv
writes to /usr/local/lib/python2.7/dist-packages, which is pure crack
- dist-packages is for the distro, site-packages for pip. Sigh. Also
writing to /usr/local/lib when the python prefix is /usr. More
weirdness.
Will be back with more soon :)
--
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud
More information about the OpenStack-dev
mailing list