home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / doc / python2.4 / README.maintainers < prev    next >
Encoding:
Text File  |  2007-04-12  |  3.3 KB  |  89 lines

  1.  
  2. Hints for maintainers of Debian packages of Python extensions
  3. -------------------------------------------------------------
  4.  
  5. Most of the content of this README can be found in the Debian Python policy.
  6. See /usr/share/doc/python/python-policy.txt.gz.
  7.  
  8. Documentation Tools
  9. -------------------
  10.  
  11. If your package ships documentation produced in the Python
  12. documentation format, you can generate it at build-time by
  13. build-depending on python2.4-dev, and you will find the
  14. templates, tools and scripts in /usr/lib/python2.4/doc/tools --
  15. adjust your build scripts accordingly.
  16.  
  17.  
  18. Makefile.pre.in issues
  19. ----------------------
  20.  
  21. Python comes with a `universal Unix Makefile for Python extensions' in
  22. /usr/lib/python2.4/config/Makefile.pre.in (with Debian, this is included
  23. in the python-dev package), which is used by most Python extensions.
  24.  
  25. In general, packages using the Makefile.pre.in approach can be packaged
  26. simply by running dh_make or by using one of debhelper's rules' templates
  27. (see /usr/doc/debhelper/examples/). Makefile.pre.in works fine with e.g.
  28. "make prefix=debian/tmp/usr install".
  29.  
  30. One glitch: You may be running into the problem that Makefile.pre.in
  31. doesn't try to create all the directories when they don't exist. Therefore,
  32. you may have to create them manually before "make install". In most cases,
  33. the following should work:
  34.  
  35.     ...
  36.     dh_installdirs /usr/lib/python2.4
  37.     $(MAKE) prefix=debian/tmp/usr install
  38.     ...
  39.  
  40.  
  41. Byte-compilation
  42. ----------------
  43.  
  44. For speed reasons, Python internally compiles source files into a byte-code.
  45. To speed up subsequent imports, it tries to save the byte-code along with
  46. the source with an extension .pyc (resp. pyo). This will fail if the
  47. libraries are installed in a non-writable directory, which may be the
  48. case for /usr/lib/python2.4/.
  49.  
  50. Not that .pyc and .pyo files should not be relocated, since for debugging
  51. purposes the path of the source for is hard-coded into them.
  52.  
  53. To precompile files in batches after installation, Python has a script
  54. compileall.py, which compiles all files in a given directory tree. The
  55. Debian version of compileall has been enhanced to support incremental
  56. compilation and to feature a ddir (destination dir) option. ddir is
  57. used to compile files in debian/usr/lib/python/ when they will be
  58. installed into /usr/lib/python/.
  59.  
  60.  
  61. Currently, there are two ways to use compileall for Debian packages. The
  62. first has a speed penalty, the second has a space penalty in the package.
  63.  
  64. 1.) Compiling and removing .pyc files in postinst/prerm:
  65.  
  66.   Use dh_python(1) from the debhelper packages to add commands to byte-
  67.   compile on installation and to remove the byte-compiled files on removal.
  68.   Your package has to build-depend on: debhelper (>= 4.1.67), python.
  69.  
  70.   In /usr/share/doc/python2.4, you'll find sample.postinst and sample.prerm.
  71.   If you set the directory where the .py files are installed, these
  72.   scripts will install and remove the .pyc and .pyo files for your
  73.   package after unpacking resp. before removing the package.
  74.  
  75. 2.) Compiling the .pyc files `out of place' during installation:
  76.  
  77.   As of 1.5.1, compileall.py allows you to specify a faked installation
  78.   directory using the "-d destdir" option, so that you can precompile
  79.   the files in their temporary directory
  80.   (e.g. debian/tmp/usr/lib/python2.1/site-packages/PACKAGE).
  81.  
  82.  
  83.  
  84.     11/02/98                             
  85.     Gregor Hoffleit <flight@debian.org>
  86.  
  87.  
  88. Last modified: 2001-12-14
  89.