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

Suggestion of dh_purepython



Hi Python folks,

I have put together a dh_purepython debhelper script to help
the installation of pure Python packages.

Still missing:

1) All Python X.Y versions need to be preinstalled. What happens
   when you install an new Python version? Hmm, we have to 
   register those pure python packages somehow and byte-compile
   them if we install a new pythonX.Y package.
   
2) in prerm, cope with empty directories being left in
   /usr/lib/pythonX.Y/site-packages

3) sanity check for rm -rf in prerm

4) fix permissions of generated .py[co] files and directories, do not 
   rely on umask

5) see BUGS of dh_purepython, for the compileall.py patch see
http://sourceforge.net/tracker/index.php?func=detail&aid=501713&group_id=5470&atid=305470 


All needed scripts as well as an example debian package can be
found at http://www.debian.org/~calvin/purepython/.

To install, copy dh_purepython into /usr/bin/ and copy
{postinst,prerm}-purepython to /usr/share/debhelper/autoscripts/.

ATTENTION: to install the example, you need to patch all your 
/usr/lib/pythonX.Y/compileall.py files:
(patch is for 1.5.2, but easy adoptable)

--- compileall.py.orig  Thu Jan 10 10:59:35 2002
+++ compileall.py       Thu Jan 10 11:53:15 2002
@@ -49,14 +49,14 @@
         if os.path.isfile(fullname):
             head, tail = name[:-3], name[-3:]
             if tail == '.py':
-                cfile = fullname + (__debug__ and 'c' or 'o')
+                cfile = dfile + (__debug__ and 'c' or 'o')
                 ftime = os.stat(fullname)[stat.ST_MTIME]
                 try: ctime = os.stat(cfile)[stat.ST_MTIME]
                 except os.error: ctime = 0
                 if (ctime > ftime) and not force: continue
                 if not quiet: print 'Compiling', fullname, '...'
                 try:
-                    py_compile.compile(fullname, None, dfile)
+                    py_compile.compile(fullname, cfile, dfile)
                 except KeyboardInterrupt:
                     raise KeyboardInterrupt
                 except:



Greetings, Bastian

Attachment: pgpSVfnxAOrXa.pgp
Description: PGP signature


Reply to: