-----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): [EMAIL PROTECTED] cat > foo.py import bar print "foo loaded" [EMAIL PROTECTED] cat > bar.py print "bar loaded" [EMAIL PROTECTED] python foo.py bar loaded foo loaded [EMAIL PROTECTED] ls bar.py bar.pyc foo.py Also, Python treats symlinks just like real files: [EMAIL PROTECTED] ln -s bar.py symlink.py [EMAIL PROTECTED] cat > symlink-loader.py import symlink print "symlink-loader loaded" [EMAIL PROTECTED] python symlink-loader.py bar loaded symlink-loader loaded [EMAIL PROTECTED] 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----- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]