Package: disk-manager
Version: 1.0.1-4.2
Severity: important
Tags: patch
User: debian-pyt...@lists.debian.org
Usertag: python2.6

Hi, disk-manager provides python scripts have python2.5 shebangs,
causing a dependency on it.

Here is a minimal patch to addresses the issue.

While I was here, I couldn't help noticing that it install modules in
the public python namespace, but no other package needs them.
They can be installed in /usr/share/disk-manager instead.
The second patch addresses that too, if you are interested.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  H: +27 21 465 6908 C: +27 72 419 8559  UCT: x3127
diff -u disk-manager-1.0.1/debian/rules disk-manager-1.0.1/debian/rules
--- disk-manager-1.0.1/debian/rules
+++ disk-manager-1.0.1/debian/rules
@@ -8,7 +8,9 @@
 
 build: build-stamp
 build-stamp: $(QUILT_STAMPFN)
-	dh build
+	dh build --before dh_auto_configure
+	PYTHON=/usr/bin/python dh_auto_configure
+	dh build --after dh_auto_configure
 	touch $@
 
 clean: unpatch
diff -u disk-manager-1.0.1/debian/control disk-manager-1.0.1/debian/control
--- disk-manager-1.0.1/debian/control
+++ disk-manager-1.0.1/debian/control
@@ -2,7 +2,7 @@
 Section: admin
 Priority: optional
 Maintainer: David Paleino <d.pale...@gmail.com>
-Build-Depends: debhelper (>= 7), quilt
+Build-Depends: debhelper (>= 7.0.50~), quilt (>= 0.46-7~)
 Build-Depends-Indep: autotools-dev, python-support (>= 0.5.3),
  libxml-parser-perl, python-gtk2
 Standards-Version: 3.8.1
diff -u disk-manager-1.0.1/debian/rules disk-manager-1.0.1/debian/rules
--- disk-manager-1.0.1/debian/rules
+++ disk-manager-1.0.1/debian/rules
@@ -3,28 +3,17 @@
-
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-include /usr/share/quilt/quilt.make
+PYDIR=/usr/share/disk-manager
 
-build: build-stamp
-build-stamp: $(QUILT_STAMPFN)
-	dh build
-	touch $@
+%:
+	dh $@ --with quilt
 
-clean: unpatch
-	dh $@
+override_dh_auto_configure:
+	PYTHON=/usr/bin/python dh_auto_configure
 
-install: install-stamp
-install-stamp: build
-	dh install --until dh_auto_install
+override_dh_auto_install:
+	dh_auto_install -- pyexecdir=$(PYDIR)
 	find $(CURDIR)/debian/disk-manager -name "*.pyc" -or -name "*.pyo" | xargs rm
-	dh install --after dh_auto_install
-	touch $@
-
-binary-arch:
-
-binary-indep: build install
-	dh $@
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+override_dh_pysupport:
+	dh_pysupport $(PYDIR)
diff -u disk-manager-1.0.1/debian/patches/series disk-manager-1.0.1/debian/patches/series
--- disk-manager-1.0.1/debian/patches/series
+++ disk-manager-1.0.1/debian/patches/series
@@ -5,0 +6 @@
+06-private-pythonlib.patch
only in patch2:
unchanged:
--- disk-manager-1.0.1.orig/debian/patches/06-private-pythonlib.patch
+++ disk-manager-1.0.1/debian/patches/06-private-pythonlib.patch
@@ -0,0 +1,40 @@
+Description: We use a private Python module directory, patch it into sys.path
+ at the start of the binaries.
+Author: Stefano Rivera <stef...@rivera.za.net>
+Last-Update: 2010-06-27
+--- a/disk-manager-root.in
++++ b/disk-manager-root.in
+@@ -26,15 +26,7 @@
+ import gettext
+ from subprocess import *
+ 
+-# Hack to make sure that path is set correctly when installation is in /usr/local
+-if "/usr/local" in sys.argv[0] :
+-    for path in sys.path :
+-        if "/usr/lib/python" in path :
+-            local_path = path.replace("/usr", "/usr/local")
+-            if not local_path in sys.path :
+-                sys.path.append(path.replace("/usr", "/usr/local"))
+-    if not "/usr/local/bin" in os.environ["PATH"] :
+-        os.environ["PATH"] += ":/usr/local/bin"
++sys.path.insert(0, '/usr/share/disk-manager')
+ 
+ from DiskManager.Fstab.FstabDialogs import dialog
+ from DiskManager.config import *
+--- a/disk-manager.in
++++ b/disk-manager.in
+@@ -29,13 +29,7 @@
+ 
+ import gtk
+ 
+-# Hack to make sure that path is set correctly when installation is in /usr/local
+-if "/usr/local" in sys.argv[0] :
+-    for path in sys.path :
+-        if "/usr/lib/python" in path :
+-            local_path = path.replace("/usr", "/usr/local")
+-            if not local_path in sys.path :
+-                sys.path.append(path.replace("/usr", "/usr/local"))
++sys.path.insert(0, '/usr/share/disk-manager')
+ 
+ from DiskManager.DiskManager import *
+ from DiskManager.Config import Config

Attachment: signature.asc
Description: Digital signature

Reply via email to