[Python-modules-team] fix to pp into wheezy?

Yaroslav Halchenko debian at onerussian.com
Wed Jan 23 18:38:36 UTC 2013


Hi RT,

We came up with a resolution for
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620551
the gist of the patch for which is replacing invocation of the shipped
script to use "python -m" mechanism.  That prevents Python inserting the
original directory (after following symlinks) into sys.path causing  pp
to work if e.g. numpy is imported in the "payload" script.

The patch is:

@@ -127,9 +127,7 @@ class _Task(object):
 class _Worker(object):
     """Local worker class
     """
-    command = [sys.executable, "-u",
-            os.path.dirname(os.path.abspath(__file__))
-            + os.sep + "ppworker.py"]
+    command = [sys.executable, "-u", "-m" , "ppworker"]
 
     command.append("2>/dev/null")


I have tested the patch on my laptop (shipped pp examples), also with MDP which
uses python-pp.  AFAIK there should be no side-effects from this change, and it
does address the problem.

I am attaching a complete tentative debdiff for you consideration -- would such
upload be allowed to get into wheezy from unstable?

-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        
-------------- next part --------------
diff -Nru parallelpython-1.6.2/debian/changelog parallelpython-1.6.2/debian/changelog
--- parallelpython-1.6.2/debian/changelog	2012-06-07 16:49:53.000000000 -0400
+++ parallelpython-1.6.2/debian/changelog	2013-01-22 13:30:25.000000000 -0500
@@ -1,3 +1,11 @@
+parallelpython (1.6.2-2) unstable; urgency=low
+
+  * Team upload
+  * Invoke ppworker via "python -m" avoiding addition of /usr/share/pyshared
+    to sys.path (Closes: #620551)
+
+ -- Yaroslav Halchenko <debian at onerussian.com>  Tue, 22 Jan 2013 13:29:34 -0500
+
 parallelpython (1.6.2-1) unstable; urgency=low
 
   * New upstream release
diff -Nru parallelpython-1.6.2/debian/patches/30_ppworker_invoke_via-m.patch parallelpython-1.6.2/debian/patches/30_ppworker_invoke_via-m.patch
--- parallelpython-1.6.2/debian/patches/30_ppworker_invoke_via-m.patch	1969-12-31 19:00:00.000000000 -0500
+++ parallelpython-1.6.2/debian/patches/30_ppworker_invoke_via-m.patch	2013-01-22 13:29:31.000000000 -0500
@@ -0,0 +1,26 @@
+From: Yaroslav Halchenko <debian at onerussian.com>
+Author: Jakub Wilk <jwilk at debian.org>
+Subject: Do not invoke ppworker script directory -- run it via -m option of python
+
+ Invocation of script directly results in Python adding a directory containing
+ the symlink-dereferenced path to the script into the path.  On Debian systems
+ it would result in adding /usr/share/pyshared path to the sys.path breaking
+ import of many modules.
+
+Origin: Debian
+Bug-Debian: http://bugs.debian.org/620551
+Last-Update: 2013-01-22
+
+--- a/pp.py
++++ b/pp.py
+@@ -127,9 +127,7 @@ class _Task(object):
+ class _Worker(object):
+     """Local worker class
+     """
+-    command = [sys.executable, "-u",
+-            os.path.dirname(os.path.abspath(__file__))
+-            + os.sep + "ppworker.py"]
++    command = [sys.executable, "-u", "-m" , "ppworker"]
+ 
+     command.append("2>/dev/null")
+ 
diff -Nru parallelpython-1.6.2/debian/patches/series parallelpython-1.6.2/debian/patches/series
--- parallelpython-1.6.2/debian/patches/series	2011-09-15 17:35:22.000000000 -0400
+++ parallelpython-1.6.2/debian/patches/series	2013-01-22 13:25:41.000000000 -0500
@@ -1,2 +1,3 @@
 10_remove_default_password.patch
 20_hyphen-used-as-minus-sign.patch
+30_ppworker_invoke_via-m.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20130123/2afc114a/attachment.pgp>


More information about the Python-modules-team mailing list