Package: python-plastex
Version: 0.9.1-1
Severity: normal
Tags: patch

Hi!

When using plastex to compile documentation, for example:

  TEXINPUTS= plastex -d html pyxplot.tex

the html/icons directory is full of links to the actual icons:

  blank.gif -> 
/usr/share/python-support/python-plastex/plasTeX/Renderers/XHTML/Themes/default/icons/blank.gif

which only makes sense if the package depends on plastex as well as using it
to build the documentation. Since plastex uses python-support to build, any 
change in python-support such as changing the location of shared files to
/usr/share/pyshared/ (which has already recently happened) will also break all
these links. In a plastex-rendered document, these probably should be the real
files not symlinks, and I'm pretty sure this is what is intended by the upstream
authors for plastex and we are getting symlinks in Debian only because Debian
supports multiple python versions using symlink farms.

In a makefile using plastex, these symlinks can be reverted to real files
using a snippet like:

      find doc/html -type l \
          -exec sh -c 'cp --remove-destination "$$(readlink {})" "{}"' \;

but that's pretty ugly to have to do.

The problem seems to come from around line 322 in 
Renderers/PageTemplate/__init__.py
where the theme files are just blindly copied across rather than the symlinks
being dereferenced. Changing the copytree call to not make symlinks and the
copy call to a copyfile call as per the attached patch solves this problem.

Since upstream have explicitly used copytree in a way that it should copy over
symlinks, it might be worthwhile dicussing this change with them prior to 
patching the Debian package, although I don't believe that it was upstream's
intention to end up with broken symlinks like this.

cheers
Stuart
--- Renderers/PageTemplate/__init__.py-orig     2009-11-08 15:15:03.000000000 
+0000
+++ Renderers/PageTemplate/__init__.py  2009-11-08 15:31:51.000000000 +0000
@@ -328,7 +328,7 @@
                             if not os.path.isdir(os.path.join(cwd,item)):
                                 os.makedirs(os.path.join(cwd,item))
-                            copytree(item, cwd, True)
+                            copytree(item, cwd, False)
                         elif os.path.splitext(item)[-1].lower() not in 
extensions:
-                            shutil.copy(item, os.path.join(cwd,item))
+                            shutil.copyfile(item, os.path.join(cwd,item))
                     os.chdir(cwd)
 

Reply via email to