[Python-modules-commits] r30324 - in packages/python-gflags/trunk/debian (16 files)

zigo at users.alioth.debian.org zigo at users.alioth.debian.org
Thu Aug 28 22:28:17 UTC 2014


    Date: Thursday, August 28, 2014 @ 22:28:16
  Author: zigo
Revision: 30324

  * Added Python 3 support.
  * Added myself as uploader.
  * Standards-Version is no 3.9.5.

Added:
  packages/python-gflags/trunk/debian/patches/python3-fixes.patch
  packages/python-gflags/trunk/debian/python-gflags.manpages
  packages/python-gflags/trunk/debian/python-gflags.postinst
  packages/python-gflags/trunk/debian/python-gflags.postrm
  packages/python-gflags/trunk/debian/python-gflags.prerm
  packages/python-gflags/trunk/debian/python3-gflags.manpages
  packages/python-gflags/trunk/debian/python3-gflags.postinst
  packages/python-gflags/trunk/debian/python3-gflags.postrm
  packages/python-gflags/trunk/debian/python3-gflags.prerm
  packages/python-gflags/trunk/debian/source/options
Modified:
  packages/python-gflags/trunk/debian/changelog
  packages/python-gflags/trunk/debian/control
  packages/python-gflags/trunk/debian/patches/python2.7-testsuite.patch
  packages/python-gflags/trunk/debian/patches/series
  packages/python-gflags/trunk/debian/rules
Deleted:
  packages/python-gflags/trunk/debian/manpages

Modified: packages/python-gflags/trunk/debian/changelog
===================================================================
--- packages/python-gflags/trunk/debian/changelog	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/changelog	2014-08-28 22:28:16 UTC (rev 30324)
@@ -1,21 +1,11 @@
-python-gflags (2.0-1) UNRELEASED; urgency=low
+python-gflags (1.5.1-2) unstable; urgency=medium
 
-  * Team upload.
+  * Added Python 3 support.
+  * Added myself as uploader.
+  * Standards-Version is no 3.9.5.
 
-  [ Jakub Wilk ]
-  * Use canonical URIs for Vcs-* fields.
+ -- Thomas Goirand <zigo at debian.org>  Thu, 28 Aug 2014 18:40:13 +0000
 
-  [ Piotr Ożarowski ]
-  * New upstream release
-    - python2.7-testsuite.patch updated to latest upstream revision
-  * Update debian/rules to use files from new tests directory
-  * Hardcode python_distutils buildsystem as upstream added Makefile
-    (which doesn't have anything useful for us) and dh uses that instead of
-    setup.py
-  * Remove egg-info and build directories and pyc files in clean target
-
- -- Piotr Ożarowski <piotr at debian.org>  Tue, 26 Aug 2014 14:33:46 -0700
-
 python-gflags (1.5.1-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/python-gflags/trunk/debian/control
===================================================================
--- packages/python-gflags/trunk/debian/control	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/control	2014-08-28 22:28:16 UTC (rev 30324)
@@ -2,16 +2,20 @@
 Section: python
 Priority: optional
 Maintainer: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org>
-Uploaders: Soren Hansen <soren at ubuntu.com>
-Build-Depends: debhelper (>= 7.0.50~), python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3~)
-Standards-Version: 3.9.2
-Vcs-Svn: svn://anonscm.debian.org/python-modules/packages/python-gflags/trunk/
+Uploaders: Soren Hansen <soren at ubuntu.com>, Thomas Goirand <zigo at debian.org>
+Build-Depends: debhelper (>= 7.0.50~),
+               python-all (>= 2.6.6-3~),
+               python-setuptools (>= 0.6b3),
+               python3-all,
+               python3-setuptools
+Standards-Version: 3.9.5
+Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-gflags/trunk/
 Vcs-Browser: http://anonscm.debian.org/viewvc/python-modules/packages/python-gflags/trunk/
 
 Package: python-gflags
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}
-Description: Python implementation of the Google command line flags module
+Depends: ${misc:Depends}, ${python:Depends}
+Description: implementation of the Google command line flags module - Python 2.x
  GFlags defines a distributed command line system, replacing systems like
  getopt(), optparse and manual argument processing. Rather than an application
  having to define all flags in or near main(), each Python module defines flags
@@ -22,4 +26,22 @@
  autogeneration of help (in both human and machine readable format) and reading
  arguments from a file. It also includes the ability to automatically generate
  man pages from the help flags.
+ .
+ This package provides the Python 2.x module.
 
+Package: python3-gflags
+Architecture: all
+Depends: ${misc:Depends}, ${python3:Depends}
+Description: implementation of the Google command line flags module - Python 3.x
+ GFlags defines a distributed command line system, replacing systems like
+ getopt(), optparse and manual argument processing. Rather than an application
+ having to define all flags in or near main(), each Python module defines flags
+ that are useful to it.  When one Python module imports another, it gains
+ access to the other's flags.
+ .
+ It includes the ability to define flag types (boolean, float, integer, list),
+ autogeneration of help (in both human and machine readable format) and reading
+ arguments from a file. It also includes the ability to automatically generate
+ man pages from the help flags.
+ .
+ This package provides the Python 3.x module.

Deleted: packages/python-gflags/trunk/debian/manpages
===================================================================
--- packages/python-gflags/trunk/debian/manpages	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/manpages	2014-08-28 22:28:16 UTC (rev 30324)
@@ -1 +0,0 @@
-gflags2man.1

Modified: packages/python-gflags/trunk/debian/patches/python2.7-testsuite.patch
===================================================================
--- packages/python-gflags/trunk/debian/patches/python2.7-testsuite.patch	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/patches/python2.7-testsuite.patch	2014-08-28 22:28:16 UTC (rev 30324)
@@ -1,55 +1,100 @@
-Index: python-gflags-2.0/tests/gflags_googletest.py
+Description: Make test suite pass with Python2.7
+ Python 2.7's unittest module introduced some new methods
+ that gflags_unittest already had defined. This calls for
+ some special handling to avoid having them step on each
+ other's toes.
+Forwarded: http://code.google.com/p/python-gflags/issues/detail?id=7
+Author: Soren Hansen <soren at ubuntu.com>
+Last-Update: 2011-06-14
+Index: python-gflags-1.5.1/gflags_unittest.py
 ===================================================================
---- python-gflags-2.0.orig/tests/gflags_googletest.py
-+++ python-gflags-2.0/tests/gflags_googletest.py
-@@ -88,22 +88,22 @@ def MultiLineEqual(expected, actual):
+--- python-gflags-1.5.1.orig/gflags_unittest.py
++++ python-gflags-1.5.1/gflags_unittest.py
+@@ -102,22 +102,34 @@
  
+   return False
  
- class TestCase(unittest.TestCase):
--  def assertListEqual(self, list1, list2):
++class _UnitTestClass(unittest.TestCase):
 +  def assertListEqual(self, list1, list2, msg=None):
-     """Asserts that, when sorted, list1 and list2 are identical."""
-     # This exists in python 2.7, but not previous versions.  Use the
-     # built-in version if possible.
-     if hasattr(unittest.TestCase, "assertListEqual"):
--      unittest.TestCase.assertListEqual(self, Sorted(list1), Sorted(list2))
-+      unittest.TestCase.assertListEqual(self, Sorted(list1), Sorted(list2), msg)
-     else:
--      self.assertEqual(Sorted(list1), Sorted(list2))
-+      self.assertEqual(Sorted(list1), Sorted(list2), msg)
++    """Asserts that, when sorted, list1 and list2 are identical."""
++    if hasattr(super(_UnitTestClass, self), 'assertListEqual'):
++      super(_UnitTestClass, self).assertListEqual(Sorted(list1), Sorted(list2))
++    else:
++      self.assertEqual(Sorted(list1), Sorted(list2))
++
++  def assertMultiLineEqual(self, expected, actual):
++    """Could do fancy diffing, but for now, just do a normal compare."""
++    self.assert_(MultiLineEqual(expected, actual))
  
+-class FlagsUnitTest(unittest.TestCase):
++  def assertRaisesWithRegexpMatch(self, exception, regexp, fn, *args, **kwargs):
++    try:
++      fn(*args, **kwargs)
++    except exception, why:
++      self.assert_(re.search(regexp, str(why)),
++                   '"%s" does not match "%s"' % (regexp, why))
++      return
++    self.fail(exception.__name__ + ' not raised')
++
++class FlagsUnitTest(_UnitTestClass):
+   "Flags Unit Test"
+ 
+   def setUp(self):
+     # make sure we are using the old, stupid way of parsing flags.
+     FLAGS.UseGnuGetOpt(False)
+ 
+-  def assertListEqual(self, list1, list2):
+-    """Asserts that, when sorted, list1 and list2 are identical."""
+-    self.assertEqual(Sorted(list1), Sorted(list2))
+-
 -  def assertMultiLineEqual(self, expected, actual):
-+  def assertMultiLineEqual(self, expected, actual, msg=None):
-     # This exists in python 2.7, but not previous versions.  Use the
-     # built-in version if possible.
-     if hasattr(unittest.TestCase, "assertMultiLineEqual"):
--      unittest.TestCase.assertMultiLineEqual(self, expected, actual)
-+      unittest.TestCase.assertMultiLineEqual(self, expected, actual, msg)
-     else:
--      self.assertTrue(MultiLineEqual(expected, actual))
-+      self.assertTrue(MultiLineEqual(expected, actual), msg)
+-    self.assert_(MultiLineEqual(expected, actual))
+-
+-
+   def test_flags(self):
  
-   def assertRaisesWithRegexpMatch(self, exception, regexp, fn, *args, **kwargs):
-     try:
-Index: python-gflags-2.0/tests/gflags_unittest.py
-===================================================================
---- python-gflags-2.0.orig/tests/gflags_unittest.py
-+++ python-gflags-2.0/tests/gflags_unittest.py
-@@ -814,7 +814,7 @@ class MultiNumericalFlagsTest(googletest
+     ##############################################
+@@ -1411,19 +1423,11 @@
+     self.assertFalse('x5' in flag_values.RegisteredFlags())
  
-     self.assertRaisesWithRegexpMatch(
-         gflags.IllegalFlagValue,
--        'flag --m_float2=abc: invalid literal for float\(\): abc',
-+        'flag --m_float2=abc: (invalid literal for float\(\)||could not convert string to float): abc',
-         gflags.DEFINE_multi_float, 'm_float2', ['abc'], 'desc')
  
-     # Test non-parseable command line values.
-@@ -831,7 +831,7 @@ class MultiNumericalFlagsTest(googletest
-     argv = ('./program', '--m_float2=def')
-     self.assertRaisesWithRegexpMatch(
-         gflags.IllegalFlagValue,
--        'flag --m_float2=def: invalid literal for float\(\): def',
-+        'flag --m_float2=def: (invalid literal for float\(\)||could not convert string to float): def',
-         FLAGS, argv)
+-class KeyFlagsTest(unittest.TestCase):
++class KeyFlagsTest(_UnitTestClass):
  
+   def setUp(self):
+     self.flag_values = flags.FlagValues()
  
+-  def assertListEqual(self, list1, list2):
+-    """Asserts that, when sorted, list1 and list2 are identical."""
+-    self.assertEqual(Sorted(list1), Sorted(list2))
+-
+-  def assertMultiLineEqual(self, s1, s2):
+-    """Could do fancy diffing, but for now, just do a normal compare."""
+-    self.assertEqual(s1, s2)
+-
+   def _GetNamesOfDefinedFlags(self, module, flag_values):
+     """Returns the list of names of flags defined by a module.
+ 
+Index: python-gflags-1.5.1/test_module_baz.py
+===================================================================
+--- /dev/null
++++ python-gflags-1.5.1/test_module_baz.py
+@@ -0,0 +1,18 @@
++#!/usr/bin/python2.4
++#
++# Copyright 2010 Google Inc. All Rights Reserved.
++
++"""Auxiliary module for testing flags.py.
++
++The purpose of this module is to test the behavior of flags that are defined
++before main() executes.
++"""
++
++
++__author__ = 'mikecurtis at google.com (Michael Bennett Curtis)'
++
++import gflags as flags
++
++FLAGS = flags.FLAGS
++
++flags.DEFINE_boolean('tmod_baz_x', True, 'Boolean flag.')

Added: packages/python-gflags/trunk/debian/patches/python3-fixes.patch
===================================================================
--- packages/python-gflags/trunk/debian/patches/python3-fixes.patch	                        (rev 0)
+++ packages/python-gflags/trunk/debian/patches/python3-fixes.patch	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,385 @@
+Description: Lots of Python3 fixes.
+Author: Thomas Goirand <zigo at debian.org>
+Forwarded: no
+Last-Update: 2014-08-29
+
+--- python-gflags-1.5.1.orig/gflags.py
++++ python-gflags-1.5.1/gflags.py
+@@ -217,12 +217,12 @@ EXAMPLE USAGE:
+     try:
+       argv = FLAGS(argv)  # parse flags
+     except gflags.FlagsError, e:
+-      print '%s\\nUsage: %s ARGS\\n%s' % (e, sys.argv[0], FLAGS)
++      print('%s\\nUsage: %s ARGS\\n%s' % (e, sys.argv[0], FLAGS))
+       sys.exit(1)
+-    if FLAGS.debug: print 'non-flag arguments:', argv
+-    print 'Happy Birthday', FLAGS.name
++    if FLAGS.debug: print('non-flag arguments:', argv)
++    print('Happy Birthday', FLAGS.name)
+     if FLAGS.age is not None:
+-      print 'You are a %s, who is %d years old' % (FLAGS.gender, FLAGS.age)
++      print('You are a %s, who is %d years old' % (FLAGS.gender, FLAGS.age))
+ 
+   if __name__ == '__main__':
+     main(sys.argv)
+@@ -386,6 +386,8 @@ a list of values, separated by a special
+ 6. We do not provide any example here: please use --helpxml instead.
+ """
+ 
++from __future__ import print_function
++
+ import cgi
+ import getopt
+ import os
+@@ -402,19 +404,6 @@ try:
+ except AttributeError:   # a very old python, that lacks sys.version_info
+   raise NotImplementedError("requires python 2.2.0 or later")
+ 
+-# If we're not running at least python 2.2.1, define True, False, and bool.
+-# Thanks, Guido, for the code.
+-try:
+-  True, False, bool
+-except NameError:
+-  False = 0
+-  True = 1
+-  def bool(x):
+-    if x:
+-      return True
+-    else:
+-      return False
+-
+ # Are we running under pychecker?
+ _RUNNING_PYCHECKER = 'pychecker.python' in sys.modules
+ 
+@@ -911,12 +900,12 @@ class FlagValues:
+       raise FlagsError("Flag name cannot be empty")
+     # If running under pychecker, duplicate keys are likely to be
+     # defined.  Disable check for duplicate keys when pycheck'ing.
+-    if (fl.has_key(name) and not flag.allow_override and
++    if ((name in fl) and not flag.allow_override and
+         not fl[name].allow_override and not _RUNNING_PYCHECKER):
+       raise DuplicateFlagError(name, self)
+     short_name = flag.short_name
+     if short_name is not None:
+-      if (fl.has_key(short_name) and not flag.allow_override and
++      if ((short_name in fl) and not flag.allow_override and
+           not fl[short_name].allow_override and not _RUNNING_PYCHECKER):
+         raise DuplicateFlagError(short_name, self)
+       fl[short_name] = flag
+@@ -931,7 +920,7 @@ class FlagValues:
+   def __getattr__(self, name):
+     """Retrieves the 'value' attribute of the flag --name."""
+     fl = self.FlagDict()
+-    if not fl.has_key(name):
++    if not (name in fl):
+       raise AttributeError(name)
+     return fl[name].value
+ 
+@@ -944,7 +933,7 @@ class FlagValues:
+ 
+   def _AssertAllValidators(self):
+     all_validators = set()
+-    for flag in self.FlagDict().itervalues():
++    for flag in self.FlagDict().values():
+       for validator in flag.validators:
+         all_validators.add(validator)
+     self._AssertValidators(all_validators)
+@@ -964,7 +953,7 @@ class FlagValues:
+         validators, key=lambda validator: validator.insertion_index):
+       try:
+         validator.Verify(self)
+-      except gflags_validators.Error, e:
++      except gflags_validators.Error as e:
+         message = validator.PrintFlagsWithValues(self)
+         raise IllegalFlagValue('%s: %s' % (message, str(e)))
+ 
+@@ -1142,7 +1131,7 @@ class FlagValues:
+         else:
+           optlist, unparsed_args = getopt.getopt(args, shortopts, longopts)
+         break
+-      except getopt.GetoptError, e:
++      except getopt.GetoptError as e:
+         if not e.opt or e.opt in fl:
+           # Not an unrecognized option, reraise the exception as a FlagsError
+           raise FlagsError(e)
+@@ -1182,7 +1171,7 @@ class FlagValues:
+         # short option
+         name = name[1:]
+         short_option = 1
+-      if fl.has_key(name):
++      if (name in fl):
+         flag = fl[name]
+         if flag.boolean and short_option: arg = 1
+         flag.Parse(arg)
+@@ -1446,9 +1435,9 @@ class FlagValues:
+     flag_line_list = []  # Subset of lines w/o comments, blanks, flagfile= tags.
+     try:
+       file_obj = open(filename, 'r')
+-    except IOError, e_msg:
+-      print e_msg
+-      print 'ERROR:: Unable to open flagfile: %s' % (filename)
++    except IOError as e_msg:
++      print(e_msg)
++      print('ERROR:: Unable to open flagfile: %s' % (filename))
+       return flag_line_list
+ 
+     line_list = file_obj.readlines()
+@@ -1472,8 +1461,8 @@ class FlagValues:
+                                                    parsed_file_list)
+           flag_line_list.extend(included_flags)
+         else:  # Case of hitting a circularly included file.
+-          print >>sys.stderr, ('Warning: Hit circular flagfile dependency: %s'
+-                               % sub_filename)
++          print(('Warning: Hit circular flagfile dependency: %s'
++                  % sub_filename), file=sys.stderr)
+       else:
+         # Any line that's not a comment or a nested flagfile should get
+         # copied into 2nd position.  This leaves earlier arguements
+@@ -1738,7 +1727,7 @@ class Flag:
+   def Parse(self, argument):
+     try:
+       self.value = self.parser.Parse(argument)
+-    except ValueError, e:  # recast ValueError as IllegalFlagValue
++    except ValueError as e:  # recast ValueError as IllegalFlagValue
+       raise IllegalFlagValue("flag --%s=%s: %s" % (self.name, argument, e))
+     self.present += 1
+ 
+@@ -2247,10 +2236,10 @@ class HelpFlag(BooleanFlag):
+     if arg:
+       doc = sys.modules["__main__"].__doc__
+       flags = str(FLAGS)
+-      print doc or ("\nUSAGE: %s [flags]\n" % sys.argv[0])
++      print(doc) or ("\nUSAGE: %s [flags]\n" % sys.argv[0])
+       if flags:
+-        print "flags:"
+-        print flags
++        print("flags:")
++        print(flags)
+       sys.exit(1)
+ 
+ 
+@@ -2283,10 +2272,10 @@ class HelpshortFlag(BooleanFlag):
+     if arg:
+       doc = sys.modules["__main__"].__doc__
+       flags = FLAGS.MainModuleHelp()
+-      print doc or ("\nUSAGE: %s [flags]\n" % sys.argv[0])
++      print(doc) or ("\nUSAGE: %s [flags]\n" % sys.argv[0])
+       if flags:
+-        print "flags:"
+-        print flags
++        print("flags:")
++        print(flags)
+       sys.exit(1)
+ 
+ #
+--- python-gflags-1.5.1.orig/gflags2man.py
++++ python-gflags-1.5.1/gflags2man.py
+@@ -45,6 +45,8 @@ Usage:
+ # extended to other document formats.
+ # Inspired by help2man.
+ 
++from __future__ import print_function
++
+ __author__ = 'Dan Christian'
+ 
+ import os
+@@ -52,6 +54,7 @@ import re
+ import sys
+ import stat
+ import time
++import subprocess
+ 
+ import gflags
+ 
+@@ -79,12 +82,12 @@ _MIN_VALID_USAGE_MSG = 9         # if fe
+ 
+ class Logging:
+   """A super-simple logging class"""
+-  def error(self, msg): print >>sys.stderr, "ERROR: ", msg
+-  def warn(self, msg): print >>sys.stderr, "WARNING: ", msg
+-  def info(self, msg): print msg
++  def error(self, msg): print("ERROR: ", msg, file=sys.stderr)
++  def warn(self, msg): print("WARNING: ", msg, file=sys.stderr)
++  def info(self, msg): print(msg)
+   def debug(self, msg): self.vlog(1, msg)
+   def vlog(self, level, msg):
+-    if FLAGS.v >= level: print msg
++    if FLAGS.v >= level: print(msg)
+ logging = Logging()
+ 
+ 
+@@ -191,8 +194,10 @@ class ProgramInfo(object):
+     # --help output is often routed to stderr, so we combine with stdout.
+     # Re-direct stdin to /dev/null to encourage programs that
+     # don't understand --help to exit.
+-    (child_stdin, child_stdout_and_stderr) = os.popen4(
+-      [self.executable, FLAGS.help_flag])
++
++    p = subprocess.Popen([self.executable, FLAGS.help_flag], stdin=subprocess.PIPE,
++                         stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
++    (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
+     child_stdin.close()       # '</dev/null'
+     self.output = child_stdout_and_stderr.readlines()
+     child_stdout_and_stderr.close()
+@@ -405,11 +410,11 @@ class ProgramInfo(object):
+       return
+ 
+     for i in range(len(self.desc)):   # replace full path with name
+-      if self.desc[i].find(self.executable) >= 0:
+-        self.desc[i] = self.desc[i].replace(self.executable, self.name)
++      if self.desc[i].decode('utf-8').find(self.executable) >= 0:
++        self.desc[i] = self.desc[i].decode('utf-8').replace(self.executable, self.name)
+ 
+     self.short_desc = self.desc[0]
+-    word_list = self.short_desc.split(' ')
++    word_list = self.short_desc.decode('utf-8').split(' ')
+     all_names = [ self.name, self.short_name, ]
+     # Since the short_desc is always listed right after the name,
+     #  trim it from the short_desc
+@@ -517,9 +522,9 @@ class GenerateMan(GenerateDoc):
+ def main(argv):
+   argv = FLAGS(argv)           # handles help as well
+   if len(argv) <= 1:
+-    print >>sys.stderr, __doc__
+-    print >>sys.stderr, "flags:"
+-    print >>sys.stderr, str(FLAGS)
++    print(__doc__,file=sys.stderr)
++    print("flags:",file=sys.stderr)
++    print(str(FLAGS),file=sys.stderr)
+     return 1
+ 
+   for arg in argv[1:]:
+--- python-gflags-1.5.1.orig/gflags_helpxml_test.py
++++ python-gflags-1.5.1/gflags_helpxml_test.py
+@@ -55,10 +55,10 @@ def MultiLineEqual(expected_help, help):
+   if help == expected_help:
+     return True
+ 
+-  print "Error: FLAGS.MainModuleHelp() didn't return the expected result."
+-  print "Got:"
+-  print help
+-  print "[End of got]"
++  print("Error: FLAGS.MainModuleHelp() didn't return the expected result.")
++  print("Got:")
++  print(help)
++  print("[End of got]")
+ 
+   help_lines = help.split('\n')
+   expected_help_lines = expected_help.split('\n')
+@@ -67,28 +67,28 @@ def MultiLineEqual(expected_help, help):
+   num_expected_help_lines = len(expected_help_lines)
+ 
+   if num_help_lines != num_expected_help_lines:
+-    print "Number of help lines = %d, expected %d" % (
+-        num_help_lines, num_expected_help_lines)
++    print("Number of help lines = %d, expected %d" % (
++        num_help_lines, num_expected_help_lines))
+ 
+   num_to_match = min(num_help_lines, num_expected_help_lines)
+ 
+   for i in range(num_to_match):
+     if help_lines[i] != expected_help_lines[i]:
+-      print "One discrepancy: Got:"
+-      print help_lines[i]
+-      print "Expected:"
+-      print expected_help_lines[i]
++      print("One discrepancy: Got:")
++      print(help_lines[i])
++      print("Expected:")
++      print(expected_help_lines[i])
+       break
+   else:
+     # If we got here, found no discrepancy, print first new line.
+     if num_help_lines > num_expected_help_lines:
+-      print "New help line:"
+-      print help_lines[num_expected_help_lines]
++      print("New help line:")
++      print(help_lines[num_expected_help_lines])
+     elif num_expected_help_lines > num_help_lines:
+-      print "Missing expected help line:"
+-      print expected_help_lines[num_help_lines]
++      print("Missing expected help line:")
++      print(expected_help_lines[num_help_lines])
+     else:
+-      print "Bug in this test -- discrepancy detected but not found."
++      print("Bug in this test -- discrepancy detected but not found.")
+ 
+   return False
+ 
+--- python-gflags-1.5.1.orig/gflags_unittest.py
++++ python-gflags-1.5.1/gflags_unittest.py
+@@ -65,10 +65,10 @@ def MultiLineEqual(expected_help, help):
+   if help == expected_help:
+     return True
+ 
+-  print "Error: FLAGS.MainModuleHelp() didn't return the expected result."
+-  print "Got:"
+-  print help
+-  print "[End of got]"
++  print("Error: FLAGS.MainModuleHelp() didn't return the expected result.")
++  print("Got:")
++  print(help)
++  print("[End of got]")
+ 
+   help_lines = help.split('\n')
+   expected_help_lines = expected_help.split('\n')
+@@ -77,28 +77,28 @@ def MultiLineEqual(expected_help, help):
+   num_expected_help_lines = len(expected_help_lines)
+ 
+   if num_help_lines != num_expected_help_lines:
+-    print "Number of help lines = %d, expected %d" % (
+-        num_help_lines, num_expected_help_lines)
++    print("Number of help lines = %d, expected %d" % (
++        num_help_lines, num_expected_help_lines))
+ 
+   num_to_match = min(num_help_lines, num_expected_help_lines)
+ 
+   for i in range(num_to_match):
+     if help_lines[i] != expected_help_lines[i]:
+-      print "One discrepancy: Got:"
+-      print help_lines[i]
+-      print "Expected:"
+-      print expected_help_lines[i]
++      print("One discrepancy: Got:")
++      print(help_lines[i])
++      print("Expected:")
++      print(expected_help_lines[i])
+       break
+   else:
+     # If we got here, found no discrepancy, print first new line.
+     if num_help_lines > num_expected_help_lines:
+-      print "New help line:"
+-      print help_lines[num_expected_help_lines]
++      print("New help line:")
++      print(help_lines[num_expected_help_lines])
+     elif num_expected_help_lines > num_help_lines:
+-      print "Missing expected help line:"
+-      print expected_help_lines[num_help_lines]
++      print("Missing expected help line:")
++      print(expected_help_lines[num_help_lines])
+     else:
+-      print "Bug in this test -- discrepancy detected but not found."
++      print("Bug in this test -- discrepancy detected but not found.")
+ 
+   return False
+ 
+@@ -845,8 +845,8 @@ class LoadFromFlagFileTest(unittest.Test
+       tmp_flag_file_2 = open((tmp_path + '/UnitTestFile2.tst'), 'w')
+       tmp_flag_file_3 = open((tmp_path + '/UnitTestFile3.tst'), 'w')
+     except IOError, e_msg:
+-      print e_msg
+-      print 'FAIL\n File Creation problem in Unit Test'
++      print(e_msg)
++      print('FAIL\n File Creation problem in Unit Test')
+       sys.exit(1)
+ 
+     # put some dummy flags in our test files
+@@ -885,7 +885,7 @@ class LoadFromFlagFileTest(unittest.Test
+       try:
+         os.remove(file_name)
+       except OSError, e_msg:
+-        print '%s\n, Problem deleting test file' % e_msg
++        print('%s\n, Problem deleting test file' % e_msg)
+   #end RemoveTestFiles def
+ 
+   def _ReadFlagsFromFiles(self, argv, force_gnu):

Modified: packages/python-gflags/trunk/debian/patches/series
===================================================================
--- packages/python-gflags/trunk/debian/patches/series	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/patches/series	2014-08-28 22:28:16 UTC (rev 30324)
@@ -1 +1,2 @@
 python2.7-testsuite.patch
+python3-fixes.patch

Added: packages/python-gflags/trunk/debian/python-gflags.manpages
===================================================================
--- packages/python-gflags/trunk/debian/python-gflags.manpages	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python-gflags.manpages	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1 @@
+python2-gflags2man.1

Added: packages/python-gflags/trunk/debian/python-gflags.postinst
===================================================================
--- packages/python-gflags/trunk/debian/python-gflags.postinst	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python-gflags.postinst	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+	update-alternatives --install /usr/bin/gflags2man gflags2man /usr/bin/python2-gflags2man 300
+fi
+
+#DEBHELPER#
+
+exit 0

Added: packages/python-gflags/trunk/debian/python-gflags.postrm
===================================================================
--- packages/python-gflags/trunk/debian/python-gflags.postrm	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python-gflags.postrm	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] || [ "$1" = "disappear" ]; then
+	update-alternatives --remove gflags2man /usr/bin/python2-gflags2man
+fi
+
+#DEBHELPER#
+
+exit 0

Added: packages/python-gflags/trunk/debian/python-gflags.prerm
===================================================================
--- packages/python-gflags/trunk/debian/python-gflags.prerm	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python-gflags.prerm	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] ; then
+	update-alternatives --remove gflags2man /usr/bin/python2-gflags2man
+fi
+
+#DEBHELPER#
+
+exit 0

Added: packages/python-gflags/trunk/debian/python3-gflags.manpages
===================================================================
--- packages/python-gflags/trunk/debian/python3-gflags.manpages	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python3-gflags.manpages	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1 @@
+python3-gflags2man.1

Added: packages/python-gflags/trunk/debian/python3-gflags.postinst
===================================================================
--- packages/python-gflags/trunk/debian/python3-gflags.postinst	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python3-gflags.postinst	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ] ; then
+	update-alternatives --install /usr/bin/gflags2man gflags2man /usr/bin/python3-gflags2man 200
+fi
+
+#DEBHELPER#
+
+exit 0

Added: packages/python-gflags/trunk/debian/python3-gflags.postrm
===================================================================
--- packages/python-gflags/trunk/debian/python3-gflags.postrm	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python3-gflags.postrm	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] || [ "$1" = "disappear" ]; then
+	update-alternatives --remove gflags2man /usr/bin/python3-gflags2man
+fi
+
+#DEBHELPER#
+
+exit 0

Added: packages/python-gflags/trunk/debian/python3-gflags.prerm
===================================================================
--- packages/python-gflags/trunk/debian/python3-gflags.prerm	                        (rev 0)
+++ packages/python-gflags/trunk/debian/python3-gflags.prerm	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ] ; then
+	update-alternatives --remove gflags2man /usr/bin/python3-gflags2man
+fi
+
+#DEBHELPER#
+
+exit 0

Modified: packages/python-gflags/trunk/debian/rules
===================================================================
--- packages/python-gflags/trunk/debian/rules	2014-08-28 20:17:05 UTC (rev 30323)
+++ packages/python-gflags/trunk/debian/rules	2014-08-28 22:28:16 UTC (rev 30324)
@@ -1,22 +1,31 @@
 #!/usr/bin/make -f
 
+PYTHONS:=$(shell pyversions -vr)
+PYTHON3S:=$(shell py3versions -vr)
+
 %:
-	dh $@ --with python2 --buildsystem=python_distutils
+	dh $@ --buildsystem=python_distutils --with python2,python3
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	set -e;\
-	  for pyversion in $(shell pyversions -r); do \
-	    for test in tests/*.py; do \
-	      env PYTHONPATH=$(CURDIR) \
-	      $$pyversion $$test; done; done
+	set -e ; for pyversion in $(shell pyversions -r); do $$pyversion gflags_unittest.py; done
 endif
 
+override_dh_clean:
+	dh_clean -O--buildsystem=python_distutils
+	rm -rf build python2-gflags2man.1 python3-gflags2man.1
+
 override_dh_auto_install:
 	dh_auto_install
-	mv $(CURDIR)/debian/python-gflags/usr/bin/gflags2man.py $(CURDIR)/debian/python-gflags/usr/bin/gflags2man
-	PYTHONPATH=$(CURDIR) python gflags2man.py --dest_dir $(CURDIR) $(CURDIR)/debian/python-gflags/usr/bin/gflags2man
-
-override_dh_auto_clean:
-	rm -rf $(CURDIR)/build $(CURDIR)/python_gflags.egg-info
-	find $(CURDIR) -name '*.pyc' -delete
+	set -e && for pyvers in $(PYTHONS); do \
+		python$$pyvers setup.py install --install-layout=deb \
+			--root $(CURDIR)/debian/python-gflags; \
+	done
+	set -e && for pyvers in $(PYTHON3S); do \
+		python$$pyvers setup.py install --install-layout=deb \
+			--root $(CURDIR)/debian/python3-gflags; \
+	done
+	mv $(CURDIR)/debian/python-gflags/usr/bin/gflags2man.py $(CURDIR)/debian/python-gflags/usr/bin/python2-gflags2man
+	mv $(CURDIR)/debian/python3-gflags/usr/bin/gflags2man.py $(CURDIR)/debian/python3-gflags/usr/bin/python3-gflags2man
+	PYTHONPATH=$(CURDIR) python gflags2man.py --dest_dir $(CURDIR) $(CURDIR)/debian/python-gflags/usr/bin/python2-gflags2man
+	PYTHONPATH=$(CURDIR) python3 gflags2man.py --dest_dir $(CURDIR) $(CURDIR)/debian/python3-gflags/usr/bin/python3-gflags2man

Added: packages/python-gflags/trunk/debian/source/options
===================================================================
--- packages/python-gflags/trunk/debian/source/options	                        (rev 0)
+++ packages/python-gflags/trunk/debian/source/options	2014-08-28 22:28:16 UTC (rev 30324)
@@ -0,0 +1 @@
+extend-diff-ignore = "^[^/]*[.]egg-info/"




More information about the Python-modules-commits mailing list