[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

No __init__.py for namespaced module in Python 3.4



Hi,

It took me a long time to figure out what was going on, but now I think
I get it. Let me explain my issue.

In OpenStack, there's lots of modules sharing the same "oslo" namespace.
Here's the list of what's currently in Debian:

- python-oslo.config
- python-oslo.messaging
- python-oslo.rootwrap
- python-oslo.db
- python-oslo.i18n
- python-oslo.utils
- python-oslo.vmware

When in Python 2.7, everything works as expected. A convenient
/usr/lib/python2.7/dist-packages/oslo/__init__.py is there, shared among
the above packages.

But in Python 3.4, there's no such a file. While this doesn't seem to be
a problem with the packages once installed, it is breaking unit tests.
For example, building python-oslo.serialization and running the unit
tests, I get:

  File "<...>/tests/test_jsonutils.py", line 28, in <module>
    from oslo.serialization import jsonutils
ImportError: No module named 'oslo.serialization'

Surprisingly, when I just do (as root):

echo "" >/usr/lib/python3/dist-packages/oslo/__init__.py

then everything works again, and subunit under Python3.4 can find the
local version of oslo.serialization.

So I am wondering: is there something wrong with dh_python3? Or should I
manually maintain an empty __init__.py in the postinst of my Python3
oslo packages, just for the unit tests to pass? Both of these sentences
seems really wrong, so there may be something I'm missing.

Currently, I'm disabling the unit tests for Python 3.4 in
oslo.serialization, but this really doesn't seem to be the way to go,
and I would like to find a way to fix this.

Thoughts anyone?
Cheers,

Thomas Goirand (zigo)

P.S: It was really nice to see Piotr and Barry at Debconf14. Thanks for
coming, and I really hope to see you guys next year.


Reply to: