[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 06:54:04 UTC 2014


On 30 September 2014 14:05, Robert Collins <robertc at robertcollins.net> wrote:

> 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 :)

So, I've pushed up an updated oslo.db patch that works in the wider
set of situations we've identified. I've attached my test script
(adjust as needed - be sure to use the updated pbr and the oslo tree
from github and adjust paths as needed :)).

The basic theory in this particular implementation boils down to this:
 - within distro packages, things are installed as normal, its a no-brainer.
 - within a venv, pip can happily ignore any dependent namespace
packages it cannot import and just install them
   so the failure mode on things we can't import is that we install
them in the venv as well
 - but we add the namespace site packages when working from the
working directory, so that we can pick those things up [but we could
just ignore them and pip install them]

I think there is one remaining flaw, which is that I haven't written
the code to *not* add system site (turns out python doesn't really
expose that in a standard fashion) - but I think that can wait for
some folk to beat on this and report whether it works for them too.

-Rob


-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-oslo
Type: application/octet-stream
Size: 2407 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140930/f585696c/attachment-0001.obj>


More information about the OpenStack-dev mailing list