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

Re: Packaging software for Cheeseshop and Debian



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 24 Oct 2007 at 10:03:09 +0200, Bernd Zeimetz wrote:
> > I develop and package webcheck [0] (a python application with private
> > modules). I put all stuff in /usr/share/webcheck and use python-support
> > for compiling the stuff there. I ship an /usr/bin/webcheck symlink
> > to /usr/share/webcheck/webcheck.py. This seems to work fine.
> 
> You can also drop a python script to /usr/bin directly - python doesn;t
> try to create .pyc files there, even when runnign as root.

This isn't because it's /usr/bin, it's because the file is the main
executable. Python only auto-compiles imported modules, not the
executable itself (i.e. the script on the python command line):

smcv@carbon% cat > foo.py
import bar
print "foo loaded"
smcv@carbon% cat > bar.py
print "bar loaded"
smcv@carbon% python foo.py
bar loaded
foo loaded
smcv@carbon% ls
bar.py  bar.pyc  foo.py

Also, Python treats symlinks just like real files:

smcv@carbon% ln -s bar.py symlink.py
smcv@carbon% cat > symlink-loader.py
import symlink
print "symlink-loader loaded"
smcv@carbon% python symlink-loader.py
bar loaded
symlink-loader loaded
smcv@carbon% ls --classify
bar.py  bar.pyc  foo.py  symlink-loader.py  symlink.py@  symlink.pyc

(Note the existence of symlink.pyc - Python doesn't dereference the
symlink when deciding where to write the pyc file.)

Regards,
    Simon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFHHwsVWSc8zVUw7HYRAquhAJwLDwYoGTMNCKmze6cyIC5NyYo6fgCdF/fY
WPde99fRIqWDOgH14yMwqvs=
=Hm79
-----END PGP SIGNATURE-----



Reply to: