[Pkg-samba-maint] [samba] 01/01: Port debian/autodeps.py to python3 and build-depend on python3 so we can invoke it correctly from debian/rules.

Steve Langasek vorlon at alioth.debian.org
Wed Aug 21 18:36:25 UTC 2013


This is an automated email from the git hooks/post-receive script.

vorlon pushed a commit to branch samba_4.0
in repository samba.

commit 48317d0595fec7db6a75a4745f8db653f0bf23ec
Author: Steve Langasek <vorlon at debian.org>
Date:   Wed Aug 21 11:35:32 2013 -0700

    Port debian/autodeps.py to python3 and build-depend on python3 so we can invoke it correctly from debian/rules.
---
 debian/autodeps.py |   30 +++++++++++++++++-------------
 debian/changelog   |    2 ++
 debian/control     |    1 +
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/debian/autodeps.py b/debian/autodeps.py
index 56f83d7..ed20a23 100755
--- a/debian/autodeps.py
+++ b/debian/autodeps.py
@@ -1,9 +1,9 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # Update dependencies based on info.py
 # Copyright (C) 2010 Jelmer Vernooij <jelmer at debian.org>
 # Licensed under the GNU GPL, version 2 or later.
 
-import ConfigParser
+import configparser
 import optparse
 import os
 import sys
@@ -46,7 +46,7 @@ class LibraryEquivalents(object):
     """Lookup table for equivalent library versions."""
 
     def __init__(self, path):
-        self.config = ConfigParser.ConfigParser()
+        self.config = configparser.ConfigParser()
         self.config.readfp(open(path))
 
     def find_equivalent(self, package, version):
@@ -60,7 +60,7 @@ class LibraryEquivalents(object):
         try:
             version = self.config.get(package, ".".join(str(x) for x in version))
             return tuple([int(x) for x in version.split(".")])
-        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
+        except (configparser.NoSectionError, configparser.NoOptionError):
             raise KeyError
 
     def find_oldest_compatible(self, package, version):
@@ -90,9 +90,11 @@ def update_control():
     """Update the debian control file.
     """
     from debian.deb822 import Deb822, PkgRelation
-    f = open('debian/control', 'r')
+    f = open('debian/control', 'rb')
     iter = Deb822.iter_paragraphs(f.readlines())
-    source = iter.next()
+    for i in iter:
+        source = i
+        break
 
     def update_deps(control, field, package, min_version, epoch=None):
         bdi = PkgRelation.parse_relations(control[field])
@@ -123,15 +125,17 @@ def update_control():
     update_deps(source, "Build-Depends", "python-ldb", min_ldb_version, 1)
     update_deps(source, "Build-Depends", "libtevent-dev", min_tevent_version)
 
-    o = open("debian/control", "w+")
-    try:
-        source.dump(o)
+    with open("debian/control", "wb+") as o:
+        for i in source.keys():
+            if i == "Build-Depends":
+                value=",\n               ".join(source[i].split(', '))
+            else:
+                value=source[i]
+            o.write(("%s: %s\n" % (i, value)).encode('UTF-8'))
 
         for binary in iter:
-            o.write("\n")
+            o.write(b"\n")
             binary.dump(o)
-    finally:
-        o.close()
 
 
 def forced_minimum_library_versions():
@@ -151,7 +155,7 @@ def forced_minimum_library_versions():
 
 
 if opts.minimum_library_version:
-    print ",".join(forced_minimum_library_versions())
+    print (",".join(forced_minimum_library_versions()))
 elif opts.update_control:
     update_control()
 else:
diff --git a/debian/changelog b/debian/changelog
index eb583d8..829fa65 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ samba (2:4.0.9+dfsg-1) UNRELEASED; urgency=low
   * The samba-ad-dc upstart job should be installed unconditionally, not just
     in Ubuntu.
   * Don't exclude our private libraries from the shlibs generation.
+  * Port debian/autodeps.py to python3 and build-depend on python3 so we can
+    invoke it correctly from debian/rules.
 
   [ Jelmer Vernooij ]
   * Bump standards version to 3.9.4 (no changes).
diff --git a/debian/control b/debian/control
index 9b4bff7..76e495c 100644
--- a/debian/control
+++ b/debian/control
@@ -44,6 +44,7 @@ Build-Depends: bison,
                python-talloc-dev (>= 2.0.7~),
                python-tdb (>= 1.2.11~),
                python-testtools,
+               python3,
                subunit (>= 0.0.6),
                xsltproc,
                zlib1g-dev (>= 1:1.2.3)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-samba/samba.git




More information about the Pkg-samba-maint mailing list