diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-07-22 03:46:19 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-07-22 03:46:19 +0000 |
commit | 21390906eac2ba67789c7950b5f770feb76a433e (patch) | |
tree | b2b45e2a74e757348f219e2f0bd85c286a3bb3ae | |
parent | 99dabdc4b1e25f825bd4ad43740b96790ca6dfc1 (diff) | |
parent | 71bea435b6f73644d5d7320001ac56d78bcc4687 (diff) | |
download | pbr-21390906eac2ba67789c7950b5f770feb76a433e.tar.gz |
Merge "Move d2to1 more into the source tree"
-rw-r--r-- | pbr/core.py | 2 | ||||
-rw-r--r-- | pbr/d2to1/tests/__init__.py | 86 | ||||
-rw-r--r-- | pbr/d2to1/tests/testpackage/d2to1_testpackage/__init__.py | 0 | ||||
-rw-r--r-- | pbr/tests/__init__.py | 63 | ||||
-rw-r--r-- | pbr/tests/test_commands.py (renamed from pbr/d2to1/tests/test_commands.py) | 4 | ||||
-rw-r--r-- | pbr/tests/test_core.py (renamed from pbr/d2to1/tests/test_core.py) | 4 | ||||
-rw-r--r-- | pbr/tests/test_hooks.py (renamed from pbr/d2to1/tests/test_hooks.py) | 18 | ||||
-rw-r--r-- | pbr/tests/testpackage/CHANGES.txt (renamed from pbr/d2to1/tests/testpackage/CHANGES.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/LICENSE.txt (renamed from pbr/d2to1/tests/testpackage/LICENSE.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/MANIFEST.in (renamed from pbr/d2to1/tests/testpackage/MANIFEST.in) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/README.txt (renamed from pbr/d2to1/tests/testpackage/README.txt) | 2 | ||||
-rw-r--r-- | pbr/tests/testpackage/data_files/a.txt (renamed from pbr/d2to1/tests/testpackage/data_files/a.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/data_files/b.txt (renamed from pbr/d2to1/tests/testpackage/data_files/b.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/data_files/c.rst (renamed from pbr/d2to1/tests/testpackage/data_files/c.rst) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/extra-file.txt (renamed from pbr/d2to1/tests/testpackage/extra-file.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/pbr_testpackage/__init__.py (renamed from pbr/d2to1/__init__.py) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/pbr_testpackage/_setup_hooks.py (renamed from pbr/d2to1/tests/testpackage/d2to1_testpackage/_setup_hooks.py) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/pbr_testpackage/package_data/1.txt (renamed from pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/1.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/pbr_testpackage/package_data/2.txt (renamed from pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/2.txt) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/setup.cfg (renamed from pbr/d2to1/tests/testpackage/setup.cfg) | 24 | ||||
-rwxr-xr-x | pbr/tests/testpackage/setup.py (renamed from pbr/d2to1/tests/testpackage/setup.py) | 0 | ||||
-rw-r--r-- | pbr/tests/testpackage/src/testext.c (renamed from pbr/d2to1/tests/testpackage/src/testext.c) | 0 | ||||
-rw-r--r-- | pbr/tests/util.py (renamed from pbr/d2to1/tests/util.py) | 0 | ||||
-rw-r--r-- | pbr/util.py (renamed from pbr/d2to1/util.py) | 2 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | tools/integration.sh | 2 |
26 files changed, 92 insertions, 117 deletions
diff --git a/pbr/core.py b/pbr/core.py index 1432b27..f622ad0 100644 --- a/pbr/core.py +++ b/pbr/core.py @@ -46,7 +46,7 @@ import warnings from setuptools import dist -from pbr.d2to1 import util +from pbr import util core.Distribution = dist._get_unpatched(core.Distribution) diff --git a/pbr/d2to1/tests/__init__.py b/pbr/d2to1/tests/__init__.py deleted file mode 100644 index c9144bb..0000000 --- a/pbr/d2to1/tests/__init__.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Copyright (C) 2013 Association of Universities for Research in Astronomy -# (AURA) -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# 3. The name of AURA and its representatives may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - -import os -import shutil -import subprocess -import sys - -import fixtures -import testtools - - -class D2to1TestCase(testtools.TestCase): - def setUp(self): - super(D2to1TestCase, self).setUp() - self.temp_dir = self.useFixture(fixtures.TempDir()).path - self.package_dir = os.path.join(self.temp_dir, 'testpackage') - shutil.copytree(os.path.join(os.path.dirname(__file__), 'testpackage'), - self.package_dir) - self.addCleanup(os.chdir, os.getcwd()) - os.chdir(self.package_dir) - - def tearDown(self): - # Remove d2to1.testpackage from sys.modules so that it can be freshly - # re-imported by the next test - for k in list(sys.modules): - if (k == 'd2to1_testpackage' or - k.startswith('d2to1_testpackage.')): - del sys.modules[k] - super(D2to1TestCase, self).tearDown() - - def run_setup(self, *args): - return self._run_cmd(sys.executable, ('setup.py',) + args) - - def _run_cmd(self, cmd, args): - """Run a command in the root of the test working copy. - - Runs a command, with the given argument list, in the root of the test - working copy--returns the stdout and stderr streams and the exit code - from the subprocess. - """ - - os.chdir(self.package_dir) - p = subprocess.Popen([cmd] + list(args), stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - - streams = tuple(s.decode('latin1').strip() for s in p.communicate()) - print(streams) - return (streams) + (p.returncode,) diff --git a/pbr/d2to1/tests/testpackage/d2to1_testpackage/__init__.py b/pbr/d2to1/tests/testpackage/d2to1_testpackage/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/pbr/d2to1/tests/testpackage/d2to1_testpackage/__init__.py +++ /dev/null diff --git a/pbr/tests/__init__.py b/pbr/tests/__init__.py index 4814cfa..5109b0f 100644 --- a/pbr/tests/__init__.py +++ b/pbr/tests/__init__.py @@ -1,6 +1,7 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010-2011 OpenStack Foundation +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -13,10 +14,37 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +# Copyright (C) 2013 Association of Universities for Research in Astronomy +# (AURA) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. The name of AURA and its representatives may not be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY AURA ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL AURA BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS """Common utilities used in testing""" import os +import shutil +import subprocess +import sys import fixtures import testresources @@ -51,3 +79,38 @@ class BaseTestCase(testtools.TestCase, testresources.ResourcedTestCase): self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.FakeLogger()) + + self.temp_dir = self.useFixture(fixtures.TempDir()).path + self.package_dir = os.path.join(self.temp_dir, 'testpackage') + shutil.copytree(os.path.join(os.path.dirname(__file__), 'testpackage'), + self.package_dir) + self.addCleanup(os.chdir, os.getcwd()) + os.chdir(self.package_dir) + + def tearDown(self): + # Remove pbr.testpackage from sys.modules so that it can be freshly + # re-imported by the next test + for k in list(sys.modules): + if (k == 'pbr_testpackage' or + k.startswith('pbr_testpackage.')): + del sys.modules[k] + super(BaseTestCase, self).tearDown() + + def run_setup(self, *args): + return self._run_cmd(sys.executable, ('setup.py',) + args) + + def _run_cmd(self, cmd, args): + """Run a command in the root of the test working copy. + + Runs a command, with the given argument list, in the root of the test + working copy--returns the stdout and stderr streams and the exit code + from the subprocess. + """ + + os.chdir(self.package_dir) + p = subprocess.Popen([cmd] + list(args), stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + streams = tuple(s.decode('latin1').strip() for s in p.communicate()) + print(streams) + return (streams) + (p.returncode,) diff --git a/pbr/d2to1/tests/test_commands.py b/pbr/tests/test_commands.py index 6dbbd3c..f5831fa 100644 --- a/pbr/d2to1/tests/test_commands.py +++ b/pbr/tests/test_commands.py @@ -40,10 +40,10 @@ from testtools import content -from pbr.d2to1 import tests +from pbr import tests -class TestCommands(tests.D2to1TestCase): +class TestCommands(tests.BaseTestCase): def test_custom_build_py_command(self): """Test custom build_py command. diff --git a/pbr/d2to1/tests/test_core.py b/pbr/tests/test_core.py index 092eca8..f24e5cb 100644 --- a/pbr/d2to1/tests/test_core.py +++ b/pbr/tests/test_core.py @@ -42,10 +42,10 @@ import glob import os import tarfile -from pbr.d2to1 import tests +from pbr import tests -class TestCore(tests.D2to1TestCase): +class TestCore(tests.BaseTestCase): def test_setup_py_keywords(self): """setup.py --keywords. diff --git a/pbr/d2to1/tests/test_hooks.py b/pbr/tests/test_hooks.py index a9e9864..88106a6 100644 --- a/pbr/d2to1/tests/test_hooks.py +++ b/pbr/tests/test_hooks.py @@ -41,22 +41,22 @@ import os import textwrap -from pbr.d2to1 import tests -from pbr.d2to1.tests import util +from pbr import tests +from pbr.tests import util -class TestHooks(tests.D2to1TestCase): +class TestHooks(tests.BaseTestCase): def setUp(self): super(TestHooks, self).setUp() with util.open_config( os.path.join(self.package_dir, 'setup.cfg')) as cfg: cfg.set('global', 'setup-hooks', - 'd2to1_testpackage._setup_hooks.test_hook_1\n' - 'd2to1_testpackage._setup_hooks.test_hook_2') + 'pbr_testpackage._setup_hooks.test_hook_1\n' + 'pbr_testpackage._setup_hooks.test_hook_2') cfg.set('build_ext', 'pre-hook.test_pre_hook', - 'd2to1_testpackage._setup_hooks.test_pre_hook') + 'pbr_testpackage._setup_hooks.test_pre_hook') cfg.set('build_ext', 'post-hook.test_post_hook', - 'd2to1_testpackage._setup_hooks.test_post_hook') + 'pbr_testpackage._setup_hooks.test_post_hook') def test_global_setup_hooks(self): """Test setup_hooks. @@ -84,10 +84,8 @@ class TestHooks(tests.D2to1TestCase): stdout, _, return_code = self.run_setup('build_ext') assert textwrap.dedent(""" running build_ext - running pre_hook d2to1_testpackage._setup_hooks.test_pre_hook for command build_ext + running pre_hook pbr_testpackage._setup_hooks.test_pre_hook for command build_ext build_ext pre-hook """) in stdout # flake8: noqa assert stdout.endswith('build_ext post-hook') assert return_code == 0 - - diff --git a/pbr/d2to1/tests/testpackage/CHANGES.txt b/pbr/tests/testpackage/CHANGES.txt index 709b9d4..709b9d4 100644 --- a/pbr/d2to1/tests/testpackage/CHANGES.txt +++ b/pbr/tests/testpackage/CHANGES.txt diff --git a/pbr/d2to1/tests/testpackage/LICENSE.txt b/pbr/tests/testpackage/LICENSE.txt index 7e8019a..7e8019a 100644 --- a/pbr/d2to1/tests/testpackage/LICENSE.txt +++ b/pbr/tests/testpackage/LICENSE.txt diff --git a/pbr/d2to1/tests/testpackage/MANIFEST.in b/pbr/tests/testpackage/MANIFEST.in index cdc95ea..cdc95ea 100644 --- a/pbr/d2to1/tests/testpackage/MANIFEST.in +++ b/pbr/tests/testpackage/MANIFEST.in diff --git a/pbr/d2to1/tests/testpackage/README.txt b/pbr/tests/testpackage/README.txt index 4f00d32..b6d84a7 100644 --- a/pbr/d2to1/tests/testpackage/README.txt +++ b/pbr/tests/testpackage/README.txt @@ -5,7 +5,7 @@ projects; specifically those projects that comprise stsci_python_ and Astrolib_. It currently consists mostly of some setup_hook scripts meant for use with -`distutils2/packaging`_ and/or d2to1_, and a customized easy_install command +`distutils2/packaging`_ and/or pbr_, and a customized easy_install command meant for use with distribute_. This package is not meant for general consumption, though it might be worth diff --git a/pbr/d2to1/tests/testpackage/data_files/a.txt b/pbr/tests/testpackage/data_files/a.txt index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/data_files/a.txt +++ b/pbr/tests/testpackage/data_files/a.txt diff --git a/pbr/d2to1/tests/testpackage/data_files/b.txt b/pbr/tests/testpackage/data_files/b.txt index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/data_files/b.txt +++ b/pbr/tests/testpackage/data_files/b.txt diff --git a/pbr/d2to1/tests/testpackage/data_files/c.rst b/pbr/tests/testpackage/data_files/c.rst index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/data_files/c.rst +++ b/pbr/tests/testpackage/data_files/c.rst diff --git a/pbr/d2to1/tests/testpackage/extra-file.txt b/pbr/tests/testpackage/extra-file.txt index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/extra-file.txt +++ b/pbr/tests/testpackage/extra-file.txt diff --git a/pbr/d2to1/__init__.py b/pbr/tests/testpackage/pbr_testpackage/__init__.py index e69de29..e69de29 100644 --- a/pbr/d2to1/__init__.py +++ b/pbr/tests/testpackage/pbr_testpackage/__init__.py diff --git a/pbr/d2to1/tests/testpackage/d2to1_testpackage/_setup_hooks.py b/pbr/tests/testpackage/pbr_testpackage/_setup_hooks.py index f8b3087..f8b3087 100644 --- a/pbr/d2to1/tests/testpackage/d2to1_testpackage/_setup_hooks.py +++ b/pbr/tests/testpackage/pbr_testpackage/_setup_hooks.py diff --git a/pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/1.txt b/pbr/tests/testpackage/pbr_testpackage/package_data/1.txt index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/1.txt +++ b/pbr/tests/testpackage/pbr_testpackage/package_data/1.txt diff --git a/pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/2.txt b/pbr/tests/testpackage/pbr_testpackage/package_data/2.txt index e69de29..e69de29 100644 --- a/pbr/d2to1/tests/testpackage/d2to1_testpackage/package_data/2.txt +++ b/pbr/tests/testpackage/pbr_testpackage/package_data/2.txt diff --git a/pbr/d2to1/tests/testpackage/setup.cfg b/pbr/tests/testpackage/setup.cfg index a200616..336668d 100644 --- a/pbr/d2to1/tests/testpackage/setup.cfg +++ b/pbr/tests/testpackage/setup.cfg @@ -1,10 +1,10 @@ [metadata] -name = d2to1_testpackage +name = pbr_testpackage version = 0.1.dev -author = Erik M. Bray -author-email = embray@stsci.edu -home-page = http://www.stsci.edu/resources/software_hardware/stsci_python -summary = Test package for testing d2to1 +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://pypi.python.org/pypi/pbr +summary = Test package for testing pbr description-file = README.txt CHANGES.txt @@ -26,21 +26,21 @@ classifier = keywords = packaging, distutils, setuptools [files] -packages = d2to1_testpackage +packages = pbr_testpackage package-data = testpackage = package_data/*.txt data-files = testpackage/data_files = data_files/*.txt extra-files = extra-file.txt -[extension=d2to1_testpackage.testext] +[extension=pbr_testpackage.testext] sources = src/testext.c optional = True [global] #setup-hooks = -# d2to1_testpackage._setup_hooks.test_hook_1 -# d2to1_testpackage._setup_hooks.test_hook_2 -commands = d2to1_testpackage._setup_hooks.test_command +# pbr_testpackage._setup_hooks.test_hook_1 +# pbr_testpackage._setup_hooks.test_hook_2 +commands = pbr_testpackage._setup_hooks.test_command [build_ext] -#pre-hook.test_pre_hook = d2to1_testpackage._setup_hooks.test_pre_hook -#post-hook.test_post_hook = d2to1_testpackage._setup_hooks.test_post_hook +#pre-hook.test_pre_hook = pbr_testpackage._setup_hooks.test_pre_hook +#post-hook.test_post_hook = pbr_testpackage._setup_hooks.test_post_hook diff --git a/pbr/d2to1/tests/testpackage/setup.py b/pbr/tests/testpackage/setup.py index 8866691..8866691 100755 --- a/pbr/d2to1/tests/testpackage/setup.py +++ b/pbr/tests/testpackage/setup.py diff --git a/pbr/d2to1/tests/testpackage/src/testext.c b/pbr/tests/testpackage/src/testext.c index 872d43c..872d43c 100644 --- a/pbr/d2to1/tests/testpackage/src/testext.c +++ b/pbr/tests/testpackage/src/testext.c diff --git a/pbr/d2to1/tests/util.py b/pbr/tests/util.py index e657508..e657508 100644 --- a/pbr/d2to1/tests/util.py +++ b/pbr/tests/util.py diff --git a/pbr/d2to1/util.py b/pbr/util.py index c421014..353635e 100644 --- a/pbr/d2to1/util.py +++ b/pbr/util.py @@ -265,7 +265,7 @@ def cfg_to_args(path='setup.cfg'): # monkey-patch the manifest_maker class @monkeypatch_method(manifest_maker) def add_defaults(self, extra_files=extra_files, log=log): - log.info('[d2to1] running patched manifest_maker command ' + log.info('[pbr] running patched manifest_maker command ' 'with extra_files support') add_defaults._orig(self) self.filelist.extend(extra_files) @@ -16,7 +16,7 @@ import setuptools -from pbr.d2to1 import util +from pbr import util setuptools.setup( **util.cfg_to_args()) diff --git a/tools/integration.sh b/tools/integration.sh index 38254a0..207e9e8 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -151,7 +151,7 @@ for PROJECT in $PROJECTS ; do # TODO(mordred): need to implement egg filtering # Because install will have caused eggs to be locally downloaded - # pbr and d2to1 can get excluded from being in the actual venv + # pbr can get excluded from being in the actual venv # test that this did not happen # $tempvenv/bin/python -c 'import pkg_resources as p; import sys; pbr=p.working_set.find(p.Requirement.parse("pbr")) is None; sys.exit(pbr or 0)' done |