22840230 lots of python fails to build on userland 94
authorYiteng Zhang <yiteng.zhang@oracle.com>
Mon, 29 Feb 2016 17:08:45 -0800
changeset 5523 9aa7edf69bfd
parent 5522 182871e9f1d1
child 5524 7c50b6f98812
22840230 lots of python fails to build on userland 94
components/python/pbr/patches/testr.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/pbr/patches/testr.patch	Mon Feb 29 17:08:45 2016 -0800
@@ -0,0 +1,102 @@
+From 946cf80b750f3735a5d3b0c2173f4eaa7fad4a81 Mon Sep 17 00:00:00 2001
+From: Akihiro Motoki <[email protected]>
+Date: Mon, 29 Sep 2014 07:36:19 +0900
+Subject: [PATCH] Make setup.py --help-commands work without testrepository
+
+testr command is registered by pbr.hooks.commands if
+testrepository is installed, so there is no need to
+setup the entry point in setup.cfg.
+
+Change-Id: I95aae12d1ac810b6d1d09b71f2a0d87be5ccb6ab
+Closes-Bug: #1375048
+---
+ pbr/packaging.py     | 24 +++++++++---------------
+ pbr/testr_command.py | 27 ++++++++++++++++++++++++---
+ 2 files changed, 33 insertions(+), 18 deletions(-)
+
+--- a/pbr/packaging.py
++++ b/pbr/packaging.py
[email protected]@ -39,6 +39,7 @@
+ from pbr import git
+ from pbr import options
+ import pbr.pbr_json
++from pbr import testr_command
+ from pbr import version
+ 
+ REQUIREMENTS_FILES = ('requirements.txt', 'tools/pip-requires')
[email protected]@ -250,24 +250,16 @@
+-try:
+-    from pbr import testr_command
+-
+-    class TestrTest(testr_command.Testr, _PipInstallTestRequires):
+-        """Make setup.py test do the right thing."""
+-
+-        command_name = 'test'
+-
+-        def run(self):
+-            self.pre_run()
+-            # Can't use super - base class old-style class
+-            testr_command.Testr.run(self)
++class TestrTest(testr_command.Testr, _PipInstallTestRequires):
++    """Make setup.py test do the right thing."""
+ 
+-    _have_testr = True
++    command_name = 'test'
+ 
+-except ImportError:
+-    _have_testr = False
++    def run(self):
++        # Can't use super - base class old-style class
++        testr_command.Testr.run(self)
+ 
+ 
+ def have_testr():
+-    return _have_testr
++    return testr_command.have_testr
++
+ 
+ try:
+     from nose import commands
+--- a/pbr/testr_command.py
++++ b/pbr/testr_command.py
[email protected]@ -44,12 +44,10 @@
+ import os
+ import sys
+ 
+-from testrepository import commands
+-
+ logger = logging.getLogger(__name__)
+ 
+ 
+-class Testr(cmd.Command):
++class TestrReal(cmd.Command):
+ 
+     description = "Run unit tests using testr"
+ 
[email protected]@ -133,3 +131,26 @@ def _coverage_after(self):
+         logger.debug("_coverage_after called")
+         os.system("coverage combine")
+         os.system("coverage html -d ./cover %s" % self.omit)
++
++
++class TestrFake(cmd.Command):
++    description = "Run unit tests using testr"
++    user_options = []
++
++    def initialize_options(self):
++        pass
++
++    def finalize_options(self):
++        pass
++
++    def run(self):
++        print("Install testrepository to run 'testr' command properly.")
++
++
++try:
++    from testrepository import commands
++    have_testr = True
++    Testr = TestrReal
++except ImportError:
++    have_testr = False
++    Testr = TestrFake