[Python-modules-commits] r17292 - in packages/python-docutils/trunk/debian (5 files)

jwilk at users.alioth.debian.org jwilk at users.alioth.debian.org
Sun Jun 5 21:18:20 UTC 2011


    Date: Sunday, June 5, 2011 @ 21:18:19
  Author: jwilk
Revision: 17292

Move all data files to /usr/share/docutils/.

Added:
  packages/python-docutils/trunk/debian/patches/move-data-to-usr-share.diff
Modified:
  packages/python-docutils/trunk/debian/changelog
  packages/python-docutils/trunk/debian/patches/series
  packages/python-docutils/trunk/debian/python-docutils.install
  packages/python-docutils/trunk/debian/rules

Modified: packages/python-docutils/trunk/debian/changelog
===================================================================
--- packages/python-docutils/trunk/debian/changelog	2011-06-05 21:05:17 UTC (rev 17291)
+++ packages/python-docutils/trunk/debian/changelog	2011-06-05 21:18:19 UTC (rev 17292)
@@ -8,8 +8,9 @@
     anymore.
   * Fix patch headers to be in line with DEP-3.
   * Remove files created by the test suite in the clean target.
+  * Move all data files to /usr/share/docutils/.
 
- -- Jakub Wilk <jwilk at debian.org>  Sun, 05 Jun 2011 23:03:40 +0200
+ -- Jakub Wilk <jwilk at debian.org>  Sun, 05 Jun 2011 23:17:51 +0200
 
 python-docutils (0.7-2) unstable; urgency=low
 

Added: packages/python-docutils/trunk/debian/patches/move-data-to-usr-share.diff
===================================================================
--- packages/python-docutils/trunk/debian/patches/move-data-to-usr-share.diff	                        (rev 0)
+++ packages/python-docutils/trunk/debian/patches/move-data-to-usr-share.diff	2011-06-05 21:18:19 UTC (rev 17292)
@@ -0,0 +1,149 @@
+Description: Allow all data files to be moved to /usr/share/docutils/.
+Author: Jakub Wilk <jwilk at debian.org>
+Forwarded: not-needed
+Last-Update 2011-06-05
+
+--- a/docutils/parsers/rst/directives/misc.py
++++ b/docutils/parsers/rst/directives/misc.py
+@@ -10,6 +10,7 @@
+ import os.path
+ import re
+ import time
++import docutils
+ from docutils import io, nodes, statemachine, utils
+ from docutils.parsers.rst import Directive, convert_directive_function
+ from docutils.parsers.rst import directives, roles, states
+@@ -38,7 +39,7 @@
+                    'start-after': directives.unchanged_required,
+                    'end-before': directives.unchanged_required}
+ 
+-    standard_include_path = os.path.join(os.path.dirname(states.__file__),
++    standard_include_path = os.path.join(docutils._datadir(states.__file__),
+                                          'include')
+ 
+     def run(self):
+--- a/docutils/writers/html4css1/__init__.py
++++ b/docutils/writers/html4css1/__init__.py
+@@ -37,13 +37,13 @@
+ 
+     default_stylesheet_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_stylesheet))
++        os.path.join(docutils._datadir(__file__), default_stylesheet))
+ 
+     default_template = 'template.txt'
+ 
+     default_template_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_template))
++        os.path.join(docutils._datadir(__file__), default_template))
+ 
+     settings_spec = (
+         'HTML-Specific Options',
+--- a/docutils/writers/latex2e/__init__.py
++++ b/docutils/writers/latex2e/__init__.py
+@@ -17,6 +17,7 @@
+ import time
+ import re
+ import string
++import docutils
+ from docutils import frontend, nodes, languages, writers, utils, io
+ from docutils.transforms import writer_aux
+ 
+@@ -31,7 +32,7 @@
+     """Formats this writer supports."""
+ 
+     default_template = 'default.tex'
+-    default_template_path = os.path.dirname(__file__)
++    default_template_path = docutils._datadir(__file__)
+ 
+     default_preamble = '\n'.join([r'% PDF Standard Fonts',
+                                   r'\usepackage{mathptmx} % Times',
+@@ -239,7 +240,7 @@
+         try:
+             file = open(self.document.settings.template, 'rb')
+         except IOError:
+-            file = open(os.path.join(os.path.dirname(__file__),
++            file = open(os.path.join(docutils._datadir(__file__),
+                                      self.document.settings.template), 'rb')
+         template = string.Template(unicode(file.read(), 'utf-8'))
+         file.close()
+--- a/docutils/writers/newlatex2e/__init__.py
++++ b/docutils/writers/newlatex2e/__init__.py
+@@ -31,7 +31,7 @@
+ 
+     default_stylesheet_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_stylesheet))
++        os.path.join(docutils._datadir(__file__), default_stylesheet))
+ 
+     settings_spec = (
+         'LaTeX-Specific Options',
+--- a/docutils/writers/odf_odt/__init__.py
++++ b/docutils/writers/odf_odt/__init__.py
+@@ -369,13 +369,13 @@
+ 
+     default_stylesheet_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_stylesheet))
++        os.path.join(docutils._datadir(__file__), default_stylesheet))
+ 
+     default_template = 'template.txt'
+ 
+     default_template_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_template))
++        os.path.join(docutils._datadir(__file__), default_template))
+ 
+     settings_spec = (
+         'ODF-Specific Options',
+--- a/docutils/writers/pep_html/__init__.py
++++ b/docutils/writers/pep_html/__init__.py
+@@ -24,13 +24,13 @@
+ 
+     default_stylesheet_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_stylesheet))
++        os.path.join(docutils._datadir(__file__), default_stylesheet))
+ 
+     default_template = 'template.txt'
+ 
+     default_template_path = utils.relative_path(
+         os.path.join(os.getcwd(), 'dummy'),
+-        os.path.join(os.path.dirname(__file__), default_template))
++        os.path.join(docutils._datadir(__file__), default_template))
+ 
+     settings_spec = html4css1.Writer.settings_spec + (
+         'PEP/HTML-Specific Options',
+--- a/docutils/writers/s5_html/__init__.py
++++ b/docutils/writers/s5_html/__init__.py
+@@ -21,7 +21,7 @@
+ 
+ themes_dir_path = utils.relative_path(
+     os.path.join(os.getcwd(), 'dummy'),
+-    os.path.join(os.path.dirname(__file__), 'themes'))
++    os.path.join(docutils._datadir(__file__), 'themes'))
+ 
+ def find_theme(name):
+     # Where else to look for a theme?
+--- a/docutils/__init__.py
++++ b/docutils/__init__.py
+@@ -202,3 +202,18 @@
+         a certain input context or output format.
+         """
+         return format in self.supported
++
++import os
++
++_debian_package = 0
++
++if _debian_package:
++    def _datadir(path):
++        dirname = os.path.dirname(path)
++        prefix = os.path.join(os.path.dirname(__file__), '')
++        assert path.startswith(prefix), "%r doesn't start with %r" % (path, prefix)
++        suffix = dirname[len(prefix):]
++        return os.path.join('/usr/share/docutils/', suffix)
++else:
++    def _datadir(path):
++        return os.path.dirname(path)

Modified: packages/python-docutils/trunk/debian/patches/series
===================================================================
--- packages/python-docutils/trunk/debian/patches/series	2011-06-05 21:05:17 UTC (rev 17291)
+++ packages/python-docutils/trunk/debian/patches/series	2011-06-05 21:18:19 UTC (rev 17292)
@@ -7,3 +7,4 @@
 15_emacs_debian_paths.diff
 16_disable_picins.diff
 buildhtml-local.diff
+move-data-to-usr-share.diff

Modified: packages/python-docutils/trunk/debian/python-docutils.install
===================================================================
--- packages/python-docutils/trunk/debian/python-docutils.install	2011-06-05 21:05:17 UTC (rev 17291)
+++ packages/python-docutils/trunk/debian/python-docutils.install	2011-06-05 21:18:19 UTC (rev 17292)
@@ -1,5 +1,6 @@
 /usr/bin/*
 /usr/lib/python*.*/*-packages/docutils*.egg-info
 /usr/lib/python*.*/*-packages/docutils
+/usr/share/docutils/
 tools/editors/emacs/rst.el usr/share/emacs/site-lisp
 debian/50python-docutils.el etc/emacs/site-start.d

Modified: packages/python-docutils/trunk/debian/rules
===================================================================
--- packages/python-docutils/trunk/debian/rules	2011-06-05 21:05:17 UTC (rev 17291)
+++ packages/python-docutils/trunk/debian/rules	2011-06-05 21:18:19 UTC (rev 17292)
@@ -55,6 +55,13 @@
 	mkdir -p debian/tmp
 	$(PYTHON) setup.py install \
 	    --root debian/tmp --no-compile $(py_setup_install_args)
+	# Move data files outside dist-packages:
+	mkdir -p debian/tmp/usr/share/
+	cp -rl debian/tmp/usr/lib/python2.*/*-packages/docutils debian/tmp/usr/share/
+	find debian/tmp/usr/lib/python2.*/*-packages/docutils/ -type f '!' -name '*.py' -delete
+	find debian/tmp/usr/share/docutils/ -type f -name '*.py' -delete
+	find debian/tmp/ -type d -empty -delete
+	sed -i -e 's/^\(_debian_package\) = /\1 = 1/' debian/tmp/usr/lib/python2.*/*-packages/docutils/__init__.py
 	: # give scripts canonical names in /usr/bin
 	cd debian/tmp/usr/bin && \
 	mv rst2newlatex.py rst2newlatex && \




More information about the Python-modules-commits mailing list