[Python-modules-commits] r10227 - in packages/pastescript/trunk/debian (3 files)

piotr at users.alioth.debian.org piotr at users.alioth.debian.org
Thu Oct 29 09:16:32 UTC 2009


    Date: Thursday, October 29, 2009 @ 09:16:22
  Author: piotr
Revision: 10227

Add 03_try_to_find_templates_in_system_dir patch so that paster will try
to find templates in /usr/local/share/paster_templates/ and
/usr/share/paster_templates/ first.

Added:
  packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch
Modified:
  packages/pastescript/trunk/debian/changelog
  packages/pastescript/trunk/debian/patches/00list

Modified: packages/pastescript/trunk/debian/changelog
===================================================================
--- packages/pastescript/trunk/debian/changelog	2009-10-29 08:48:19 UTC (rev 10226)
+++ packages/pastescript/trunk/debian/changelog	2009-10-29 09:16:22 UTC (rev 10227)
@@ -1,3 +1,11 @@
+pastescript (1.7.3-5) UNRELEASED; urgency=low
+
+  * Add 03_try_to_find_templates_in_system_dir patch so that paster will try
+    to find templates in /usr/local/share/paster_templates/ and
+    /usr/share/paster_templates/ first.
+
+ -- Piotr Ożarowski <piotr at debian.org>  Thu, 29 Oct 2009 10:05:56 +0100
+
 pastescript (1.7.3-4) unstable; urgency=low
 
   * python-setuptools replaced with python-pkg-resources dependency

Modified: packages/pastescript/trunk/debian/patches/00list
===================================================================
--- packages/pastescript/trunk/debian/patches/00list	2009-10-29 08:48:19 UTC (rev 10226)
+++ packages/pastescript/trunk/debian/patches/00list	2009-10-29 09:16:22 UTC (rev 10227)
@@ -1,2 +1,3 @@
 01_disable_ez_setup
 02_rename_templates_dir
+03_try_to_find_templates_in_system_dir.dpatch

Added: packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch
===================================================================
--- packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch	                        (rev 0)
+++ packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch	2009-10-29 09:16:22 UTC (rev 10227)
@@ -0,0 +1,40 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_try_to_find_templates_in_system_dir.dpatch by  <piotr at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad pastescript-1.7.3~/paste/script/templates.py pastescript-1.7.3/paste/script/templates.py
+--- pastescript-1.7.3~/paste/script/templates.py	2008-11-10 20:46:10.000000000 +0100
++++ pastescript-1.7.3/paste/script/templates.py	2009-10-29 10:04:23.938996504 +0100
+@@ -45,13 +45,27 @@
+         mod = sys.modules[self.__class__.__module__]
+         return os.path.dirname(mod.__file__)
+ 
++    def _distro_dir(self, args):
++        """Returns full path to template directory if it's found in
++        /usr/local/share/paster_templates/ or /usr/share/paster_templates/"""
++
++        for d in ('/usr/local/share/paster_templates/', '/usr/share/paster_templates/'):
++            directory = os.path.join(d, *args)
++            if os.path.isdir(directory):
++                return directory
++            # remove paster_templates if it's in the args and try again
++            args_joined = os.path.join(*args)
++            directory = os.path.join(d, args_joined.replace('paster_templates/', ''))
++            if os.path.isdir(directory):
++                return directory
++
+     def template_dir(self):
+         assert self._template_dir is not None, (
+             "Template %r didn't set _template_dir" % self)
+         if isinstance( self._template_dir, tuple):
+-            return self._template_dir
++            return self._distro_dir(self._template_dir) or self._template_dir
+         else:
+-            return os.path.join(self.module_dir(), self._template_dir)
++            return self._distro_dir((self._template_dir,)) or os.path.join(self.module_dir(), self._template_dir)
+ 
+     def run(self, command, output_dir, vars):
+         self.pre(command, output_dir, vars)


Property changes on: packages/pastescript/trunk/debian/patches/03_try_to_find_templates_in_system_dir.dpatch
___________________________________________________________________
Added: svn:executable
   + *




More information about the Python-modules-commits mailing list