Hello!
When packaging Zope packages, I face to multiple namespaces, for
example, 'zope', 'zope.app', 'zc' and 'grokcore'.
When installing a package like 'zope.component' through 'python setup.py
install', the module it provides will go to
%{python_sitelib}/zope/component . If no other zope.* packages
installed, the %{python_sitelib}/zope/ directory will contain only the
'component/' directory. In this case, it will fail to import the
'zope.component' module trivially in Python, because the
%{python_sitelib}/zope/ directory doesn't contain a file named
'__init__.py'. So, we must provide %{python_sitelib}/zope/__init__.py
through some rpm. And the rpm which provides %{python_sitelib}/zope/ and
%{python_sitelib}/zope/__init__.py is called namespace holder rpm.
I propose three candidate solutions:
Candidate 1: per-project namespace holder rpm
This is what I did for Zope2 and Grok in the Zope SIG repo[1].
So I provide two namespace holder rpms: python-zope-filesystem[2] and
python-grok-filesystem[3]. python-zope-filesystem provides all the
namespaces needed by Zope packages and python-grok-filesystem by Grok
packages.
That is, a namespace holder rpm may provides multiple
namespaces needed by that project.
Results of this candidate: Less namespace holder rpms, no .pth
file needed, no mechanical method to decide a namespace contained by
which rpm (see Candidate 2).
Candidate 2(I really prefer): per-toplevel-namespace namespace
holder rpm
For each top-devel namespace, we provide a namespace holder
rpm. For example, the zope and zope.app namespaces will be provided by
an rpm(may named 'python-namespace-zope'), and zc and zc.recipe by
another rpm(may named 'python-namespace-zc').
So we have a mechanical method to decide a namespace contained
by which rpm. For example, given a new package named 'yes.ok.bye', when
packaging it as rpm, it must require 'python-namespace-yes'. And if the
yes.ok namespace is not provided by 'python-namespace-yes', we can just
make a new version of 'python-namespace-yes'. And if
'python-namespace-yes' rpm is not available in Fedora, we can just make
it, and it will definitely conflicts with no other rpms.
Results of this candidate: More namespace holder rpms, no .pth
file needed, can mechanically decide a namespace contained by which rpm.
Candidate 3: No namespace holder rpm, long-name packages are
installed as eggs.
Most long-name packages(like zope.componet, not like paste)
will be packaged as eggs, through
http://fedoraproject.org/wiki/Packaging:Python_Eggs#Multiple_Versions .
And for each of these packages, a .pth file is used to add new directory
to sys.path.
Results of this candidate: No namespace holder rpm needed,
many .pth files needed and sys.path will turn huge if you install
something like Grok.
Unfortunately, I have to go to field work tomorrow and have no access to
Internet for about a month.
[1]
http://fedorapeople.org/gitweb?p=cheeselee/public_git/zope-rpm.git;a=tree...
[2]$ rpm -ql python-zope-filesystem
/usr/lib/python2.6/site-packages/five
/usr/lib/python2.6/site-packages/five/__init__.py
/usr/lib/python2.6/site-packages/five/__init__.pyc
/usr/lib/python2.6/site-packages/five/__init__.pyo
/usr/lib/python2.6/site-packages/z3c
/usr/lib/python2.6/site-packages/z3c/__init__.py
/usr/lib/python2.6/site-packages/z3c/__init__.pyc
/usr/lib/python2.6/site-packages/z3c/__init__.pyo
/usr/lib/python2.6/site-packages/z3c/recipe
/usr/lib/python2.6/site-packages/z3c/recipe/__init__.py
/usr/lib/python2.6/site-packages/z3c/recipe/__init__.pyc
/usr/lib/python2.6/site-packages/z3c/recipe/__init__.pyo
/usr/lib/python2.6/site-packages/zc
/usr/lib/python2.6/site-packages/zc/__init__.py
/usr/lib/python2.6/site-packages/zc/__init__.pyc
/usr/lib/python2.6/site-packages/zc/__init__.pyo
/usr/lib/python2.6/site-packages/zc/recipe
/usr/lib/python2.6/site-packages/zc/recipe/__init__.py
/usr/lib/python2.6/site-packages/zc/recipe/__init__.pyc
/usr/lib/python2.6/site-packages/zc/recipe/__init__.pyo
/usr/lib/python2.6/site-packages/zope
/usr/lib/python2.6/site-packages/zope/__init__.py
/usr/lib/python2.6/site-packages/zope/__init__.pyc
/usr/lib/python2.6/site-packages/zope/__init__.pyo
/usr/lib/python2.6/site-packages/zope/app
/usr/lib/python2.6/site-packages/zope/app/__init__.py
/usr/lib/python2.6/site-packages/zope/app/__init__.pyc
/usr/lib/python2.6/site-packages/zope/app/__init__.pyo
[3] $ rpm -ql python-grok-filesystem
/usr/lib/python2.6/site-packages/grokcore
/usr/lib/python2.6/site-packages/grokcore/__init__.py
/usr/lib/python2.6/site-packages/grokcore/__init__.pyc
/usr/lib/python2.6/site-packages/grokcore/__init__.pyo
/usr/lib/python2.6/site-packages/grokui
/usr/lib/python2.6/site-packages/grokui/__init__.py
/usr/lib/python2.6/site-packages/grokui/__init__.pyc
/usr/lib/python2.6/site-packages/grokui/__init__.pyo
/usr/lib/python2.6/site-packages/megrok
/usr/lib/python2.6/site-packages/megrok/__init__.py
/usr/lib/python2.6/site-packages/megrok/__init__.pyc
/usr/lib/python2.6/site-packages/megrok/__init__.pyo
Robin 'cheese' Lee