diff options
author | Chuck Short <chuck.short@canonical.com> | 2013-05-27 14:10:59 -0500 |
---|---|---|
committer | Chuck Short <chuck.short@canonical.com> | 2013-06-02 12:18:45 -0500 |
commit | e7b90361b9dcf14a702fe8c3527406135abde624 (patch) | |
tree | fb3c0a8292305b9a87d017c1d361696c28858648 | |
parent | 15c09876901fbcd9c8d2819f7ef6d3d6a7447ec2 (diff) | |
download | pbr-e7b90361b9dcf14a702fe8c3527406135abde624.tar.gz |
python3: Use six everywhere
Use six to improve compatibility between python2 and python3.
Change-Id: Idc0b251d05f418a28a914d910dabd4a2d9ebdf2a
Signed-off-by: Chuck Short <chuck.short@canonical.com>
-rw-r--r-- | doc/source/conf.py | 8 | ||||
-rw-r--r-- | pbr/packaging.py | 6 | ||||
-rw-r--r-- | pbr/tests/test_setup.py | 8 | ||||
-rw-r--r-- | pbr/tests/test_version.py | 6 |
4 files changed, 14 insertions, 14 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py index 49837ec..101ef13 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -24,8 +24,8 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'pbr' -copyright = u'2013, OpenStack Foundation' +project = 'pbr' +copyright = '2013, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True @@ -54,8 +54,8 @@ htmlhelp_basename = '%sdoc' % project latex_documents = [ ('index', '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), + '%s Documentation' % project, + 'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. diff --git a/pbr/packaging.py b/pbr/packaging.py index 6b32db2..0baff2c 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -23,10 +23,10 @@ Utilities with minimum-depends for use in setup.py import email import os import re -import StringIO import subprocess import sys +from d2to1.extern import six from distutils.command import install as du_install from distutils import log from setuptools.command import install @@ -59,7 +59,7 @@ def canonicalize_emails(changelog, mapping): """Takes in a string and an email alias mapping and replaces all instances of the aliases in the string with their real email. """ - for alias, email_address in mapping.iteritems(): + for alias, email_address in six.iteritems(mapping): changelog = changelog.replace(alias, email_address) return changelog @@ -287,7 +287,7 @@ try: def _sphinx_run(self): if not self.verbose: - status_stream = StringIO.StringIO() + status_stream = six.StringIO() else: status_stream = sys.stdout confoverrides = {} diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py index 914cc96..0cd45c3 100644 --- a/pbr/tests/test_setup.py +++ b/pbr/tests/test_setup.py @@ -19,10 +19,10 @@ from __future__ import print_function import os -import StringIO import sys import tempfile +from d2to1.extern import six import fixtures import testscenarios @@ -155,12 +155,12 @@ class GitLogsTest(tests.BaseTestCase): def test_write_git_changelog(self): exist_files = [os.path.join(self.root_dir, f) - for f in ".git", ".mailmap"] + for f in (".git", ".mailmap")] self.useFixture(fixtures.MonkeyPatch( "os.path.exists", lambda path: os.path.abspath(path) in exist_files)) self.useFixture(fixtures.FakePopen(lambda _: { - "stdout": StringIO.StringIO("Author: Foo Bar <email@bar.com>\n") + "stdout": six.StringIO("Author: Foo Bar <email@bar.com>\n") })) def _fake_read_git_mailmap(*args): @@ -201,7 +201,7 @@ class GitLogsTest(tests.BaseTestCase): lambda path: os.path.abspath(path) in exist_files)) self.useFixture(fixtures.FakePopen(lambda proc_args: { - "stdout": StringIO.StringIO( + "stdout": six.StringIO( self._fake_log_output(proc_args["args"][2], cmd_map)) })) diff --git a/pbr/tests/test_version.py b/pbr/tests/test_version.py index 38dd396..2fae9a5 100644 --- a/pbr/tests/test_version.py +++ b/pbr/tests/test_version.py @@ -15,9 +15,9 @@ # License for the specific language governing permissions and limitations # under the License. -import StringIO import sys +from d2to1.extern import six from oslo.config import cfg from pbr import tests @@ -47,7 +47,7 @@ class DeferredVersionTestCase(tests.BaseTestCase): deferred_string = MyVersionInfo("openstack")\ .cached_version_string() - self.stubs.Set(sys, 'stderr', StringIO.StringIO()) + self.stubs.Set(sys, 'stderr', six.StringIO()) self.assertRaises(SystemExit, self.conf, ['--version'], project="project", @@ -66,7 +66,7 @@ class DeferredVersionTestCase(tests.BaseTestCase): .cached_version_string() for i in range(50): - self.stubs.Set(sys, 'stderr', StringIO.StringIO()) + self.stubs.Set(sys, 'stderr', six.StringIO()) self.assertRaises(SystemExit, self.conf, ['--version'], project="project", |