Suggestion of dh_purepython

2002-01-10 Thread Bastian Kleineidam
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=detailaid=501713group_id=5470atid=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


pgpgvCv3Htjjl.pgp
Description: PGP signature


Re: Suggestion of dh_purepython

2002-01-10 Thread Sean 'Shaleh' Perry

On 10-Jan-2002 Bastian Kleineidam wrote:
 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.


read all python* binaries from /usr/bin, loop through every one that has a
version on the end, strip the version out and use it.

for i in /usr/bin/python*
do
# if $i ends in a number
# pyver = $i's version number
# call /usr/lib/python$pyver/compileall.py
done