[openstack-dev] [oslo][db] oslo.db repository review request

Victor Stinner victor.stinner at enovance.com
Wed May 14 14:38:04 UTC 2014


Le mardi 13 mai 2014, 07:31:34 Doug Hellmann a écrit :
> Since we think we have been able to solve all of the issues we were
> having with namespace packages before, ...

I just tried to start my DevStack and again, I had issues with a "builtin" 
olso module: "import oslo.config" doesn't work, whereas olso.config was 
installed (system wide) by pip.

"pip list|grep olso" told me that oslo.config, oslo.messaging, oslo.rootwrap 
and oslo.vmware are installed.

My workaround is to uninstall all olso modules:
sudo pip uninstall oslo.config oslo.messaging oslo.rootwrap oslo.vmware

./stack.sh reinstalls them and now it works.

--

Current state:

haypo at devstackdev$ pip list|grep oslo
oslo.config (1.3.0a0.40.gb347519)
oslo.messaging (1.3.0.8.gc0c8557)
oslo.rootwrap (1.2.0)
oslo.vmware (0.3.1.g49097c0)

haypo at devstackdev$ python
Python 2.7.5 (default, Feb 19 2014, 13:47:28) 
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import oslo
>>> oslo
<module 'oslo' (built-in)>
>>> import oslo.config
>>> import oslo.messaging
>>> import oslo.rootwrap
>>> import oslo.vmware


I never understood how these .pth files work.

haypo at devstackdev$ cd /usr/lib/python2.7/site-packages

haypo at devstackdev$ ls oslo*.pth -1
oslo.config-1.3.0a0.40.gb347519-py2.7-nspkg.pth
oslo.messaging-1.3.0.8.gc0c8557-py2.7-nspkg.pth
oslo.rootwrap-1.2.0-py2.7-nspkg.pth
oslo.vmware-0.3.1.g49097c0-py2.7-nspkg.pth

haypo at devstackdev$ md5sum oslo*.pth 
002fd4bf040a30d396d4df8e1ed378a8  oslo.config-1.3.0a0.40.gb347519-py2.7-
nspkg.pth
002fd4bf040a30d396d4df8e1ed378a8  oslo.messaging-1.3.0.8.gc0c8557-py2.7-
nspkg.pth
002fd4bf040a30d396d4df8e1ed378a8  oslo.rootwrap-1.2.0-py2.7-nspkg.pth
002fd4bf040a30d396d4df8e1ed378a8  oslo.vmware-0.3.1.g49097c0-py2.7-nspkg.pth

haypo at devstackdev$ cat oslo.config-1.3.0a0.40.gb347519-py2.7-nspkg.pth
import sys,types,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], 
*('oslo',)); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie 
and sys.modules.setdefault('oslo',types.ModuleType('oslo')); mp = (m or []) 
and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)

Victor



More information about the OpenStack-dev mailing list