[Debian-med-packaging] Bug#516037: gnumed-client: hard-codes the location to python modules

Josselin Mouette joss at debian.org
Thu Feb 19 08:34:15 UTC 2009


Hi,

Le jeudi 19 février 2009 à 08:19 +0100, Andreas Tille a écrit :

> >      * Detect the modules location dynamically from the script. You can
> >        see an example in the pychecker package.

Looking more closely, there is an even simpler way than that of
pychecker. Something like this should directly work:
        python -m Gnumed.wxpython.gnumed

> >      * Make /usr/bin/gnumed a python script, rewriting the environment
> >        manipulations in python; this makes the import trivial.
> 
> What means "trivial".  Is there an alternative example like pychecker
> for the first option?

I don’t have one handy, but the idea is to consider it a regular script.

Looking more closely at gnumed.py, it occurs to me that it is not even
meant to be in a modules directory:
        if __name__ != "__main__":
                print "GNUmed startup: This is not intended to be imported as a module 
        
This way, instead of a wrapper script, you could directly put this
script in /usr/bin, adding to it the necessary logic to read the
configuration.

> >      * Move part or all of the files to a private modules directory.
> 
> If you ask me this sounds like the most reasonable suggestion.  But
> how does it work together with python-support?  Any docs how the behaviour
> of python-support will change?  (I haven't followed the debian-python
> discussion very closely.)

This is very simple, just ship the modules to /usr/share/gnumed-client,
and modify your script to do something like:
        import sys
        sys.path.append("/usr/share/gnumed-client")
        import Gnumed.whatyouwant
        …

Python-support will handle this automatically; you just have to pass the
installation directory to the dh_pysupport call if it is non-standard.

Thanks for your quick answer,
-- 
 .''`.      Debian 5.0 "Lenny" has been released!
: :' :
`. `'   Last night, Darth Vader came down from planet Vulcan and told
  `-    me that if you don't install Lenny, he'd melt your brain.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.alioth.debian.org/pipermail/debian-med-packaging/attachments/20090219/fbd139c1/attachment-0002.pgp 


More information about the Debian-med-packaging mailing list