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

Python modules not installed correctly with pycentral



Howdy all,

In the thread Message-ID: <87d4vmbgps.fsf@benfinney.id.au>, I
attempted to learn more about packaging software such that it conforms
both to Python conventions and Debian Python policy. I got some
helpful responses, but there seem to be fundamental problems that
weren't addressed. I'm asking again now, to try to fix them.

The package I'm creating is Gracie:

    <URL:http://cheeseshop.python.org/pypi/gracie/>
    <URL:http://pypi.python.org/packages/source/g/gracie/gracie-0.2.6.tar.gz>

When I create the Python package independently, with './setup.py
bdist_egg', the resulting egg file contains all the modules and
programs for the package. The program '/usr/bin/gracied' is able to
import the 'gracie' package modules, and it runs successfully. So far
so good.


I'm packaging it for Debian, and am trying to learn how this is best
done. My Bazaar branch for the Debian package can be obtained, and a
Debian binary package built:

    $ bzr branch http://vcs.whitetree.org/bzr/public/gracie/gracie.debian/
    $ cd gracie.debian/
    $ fakeroot ./debian/rules binary

The resulting package contains the program and modules; the modules
are in '/usr/share/pycentral/gracie/site-packages/gracie/'.

    $ cd ../
    $ dpkg-deb --contents gracie_0.2.6-1_all.deb
    [...]
    drwxr-xr-x root/root         0 2008-01-07 10:59 ./usr/share/pycentral/
    drwxr-xr-x root/root         0 2008-01-07 10:59 ./usr/share/pycentral/gracie/
    drwxr-xr-x root/root         0 2008-01-07 10:59 ./usr/share/pycentral/gracie/site-packages/
    drwxr-xr-x root/root         0 2008-01-07 10:59 ./usr/share/pycentral/gracie/site-packages/gracie/
    -rw-r--r-- root/root      1020 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/__init__.py
    -rw-r--r-- root/root      1290 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/authorisation.py
    -rw-r--r-- root/root      4814 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/authservice.py
    -rw-r--r-- root/root     19956 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/httprequest.py
    -rw-r--r-- root/root      1610 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/httpresponse.py
    -rw-r--r-- root/root      2871 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/httpserver.py
    -rw-r--r-- root/root      9740 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/pagetemplate.py
    -rw-r--r-- root/root      3235 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/server.py
    -rw-r--r-- root/root      1793 2008-01-07 10:58 ./usr/share/pycentral/gracie/site-packages/gracie/session.py
    drwxr-xr-x root/root         0 2008-01-07 10:59 ./usr/share/pycentral/gracie/site-packages/gracie.egg-info/
    [...]

The problem apparent when installing that .deb is that after
installation the modules *only* exist in that pycentral path; they are
never installed to the Python site-packages directory, and so the
Python package can't be found by programs that try to import it.

    $ dpkg --install gracie_0.2.6-1_all.deb
    Selecting previously deselected package gracie.
    (Reading database ... 31561 files and directories currently installed.)
    Unpacking gracie (from .../gracie_0.2.6-1_all.deb) ...
    Setting up gracie (0.2.6-1) ...
    Starting Gracie OpenID provider:Traceback (most recent call last):
      File "/usr/bin/gracied", line 18, in ?
        from gracie.server import become_daemon
    ImportError: No module named gracie.server
    invoke-rc.d: initscript gracie, action "start" failed.
    dpkg: error processing gracie (--install):
     subprocess post-installation script returned error exit status 1
    Errors were encountered while processing:
     gracie

    $ find /usr -name 'server.py' | grep gracie
    /usr/share/pycentral/gracie/site-packages/gracie/server.py


What am I missing? I was under the impression that it was pycentral's
task, at install time, to install the modules from
'/usr/share/pycentral/gracie/' to the appropriate place for Python to
import them. That's not happening though.

-- 
 \        "For fast acting relief, try slowing down."  -- Jane Wagner, |
  `\                                                   via Lily Tomlin |
_o__)                                                                  |
Ben Finney


Reply to: