Package: python-central
Version: 0.6.14+nmu2
Severity: minor
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch lucid

        Hi

 The attached two patches chane dh_pycentral's parsing of XS-PV to only
 look it up in the first paragraph (see Debian #567941) and of
 debian/pyversions to skip newlines.  This makes dh_pycentral more
 robust and more strict.

   Thanks,
-- 
Loïc Minier
=== modified file 'debian/changelog'
--- debian/changelog	2010-01-15 11:03:11 +0000
+++ debian/changelog	2010-02-07 15:43:54 +0000
@@ -1,3 +1,12 @@
+python-central (0.6.11ubuntu12) UNRELEASED; urgency=low
+
+  * dh_pycentral: when parsing debian/control, strip trailing spaces, skip
+    empty lines before the first paragraphs, and only search for
+    XS-Python-Version in the general paragraph (the first one, for the source
+    package); see Debian #567941.
+
+ -- Loïc Minier <[email protected]>  Sun, 07 Feb 2010 16:41:12 +0100
+
 python-central (0.6.11ubuntu11) lucid; urgency=low
 
   * dh_pycentral:

=== modified file 'dh_pycentral'
--- dh_pycentral	2010-01-15 11:03:11 +0000
+++ dh_pycentral	2010-02-07 15:43:54 +0000
@@ -178,8 +178,15 @@
 my $pyversions_field = "";
 my $python_header = "";
 {
+	my $paraborder = 1;
 	open(CONTROL, "debian/control"); # Can't fail, dh_testdir has already been called
 	while (my $source = <CONTROL>) {
+	    $source =~ s/\s*\n$//;
+	    if ($source =~ m/^$/) {
+		next if $paraborder;
+		last;
+	    }
+	    $paraborder = 0;
 	    if ($source =~ m/^XS-Python-Version: \s*(.*)$/m) {
 		$python_header = $1;
 		chomp($python_header);

=== modified file 'debian/changelog'
--- debian/changelog	2010-02-07 15:43:54 +0000
+++ debian/changelog	2010-02-07 15:56:27 +0000
@@ -4,6 +4,7 @@
     empty lines before the first paragraphs, and only search for
     XS-Python-Version in the general paragraph (the first one, for the source
     package); see Debian #567941.
+  * dh_pycentral: when parsing debian/pyversions, skip and strip newlines.
 
  -- Loïc Minier <[email protected]>  Sun, 07 Feb 2010 16:41:12 +0100
 

=== modified file 'dh_pycentral'
--- dh_pycentral	2010-02-07 15:43:54 +0000
+++ dh_pycentral	2010-02-07 15:56:27 +0000
@@ -199,11 +199,16 @@
 # pyversions describes the list of python versions that this package can
 # work with
 if (-e "debian/pyversions") {
+	# read first non-empty line
+	local $/ = "";
 	open(PYVERS, "debian/pyversions") || error("Can't open debian/pyversions: $!");
 	$pyversions_field = <PYVERS>;
+	# strip newlines
 	chomp($pyversions_field);
 	close(PYVERS);
 }
+# strip spaces
+$pyversions_field =~ s/^\s*(.*?)\s*$/\1/;
 verbose_print("Pyversions field: $pyversions_field");
 
 # Extract a list of officially supported Python versions

Reply via email to