summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlifeless <robertc@robertcollins.net>2015-04-16 23:35:15 +0000
committerRobert Collins <rbtcollins@hp.com>2015-04-17 11:38:55 +1200
commit5ad364f2511d5f31bc076b7ca1089b1248708866 (patch)
tree425d81f026cd3f69e96f3ff088e69dccac27ecb3
parentda0f226cc461bb6555f459e3fd7b4af51ca7a63a (diff)
downloadpbr-5ad364f2511d5f31bc076b7ca1089b1248708866.tar.gz
Revert "Support platform-specific requirements files"
This reverts commit 8cdb41cf1264e71fd2f479efa7decd38c1f91cfa. https://www.python.org/dev/peps/pep-0426/#environment-markers is the right approach for this, and as we haven't released master its safe to back this out. Change-Id: Ic7298fcbde54c6beda67c3c897efa75f1b60b78f
-rw-r--r--doc/source/index.rst14
-rw-r--r--pbr/packaging.py25
-rw-r--r--pbr/tests/test_packaging.py27
3 files changed, 5 insertions, 61 deletions
diff --git a/doc/source/index.rst b/doc/source/index.rst
index f36fc6f..918be40 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -107,21 +107,11 @@ You can also have a requirement file for each specific major version of
Python. If you want to have a different package list for Python 3, just drop
a requirements-py3.txt, and it will be used instead.
-It's also possible to select a requirement file specific for an OS. The format
-is requirements-{osname}.txt, where ``{osname}`` is the equivalent of
-``platform.system()``. The two approaches, Python version and OS version, can
-be combined.
-
The requirement files are tried in that order (N being the Python major
-version number used to install the package and OS being the current
-platform's name in lowercase, retrieved with ``platform.system()``):
+version number used to install the package):
-* requirements-OS-pyN.txt
-* tools/pip-requires-OS-pyN
-* requirements-OS.txt
-* tools/pip-requires-OS
* requirements-pyN.txt
-* tools/pip-requires-pyN
+* tools/pip-requires-py3
* requirements.txt
* tools/pip-requires
diff --git a/pbr/packaging.py b/pbr/packaging.py
index 8863651..e266d4f 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -23,10 +23,7 @@ from __future__ import unicode_literals
from distutils.command import install as du_install
from distutils import log
import email
-import functools
-import itertools
import os
-import platform
import re
import sys
@@ -55,26 +52,10 @@ def get_requirements_files():
# Returns a list composed of:
# - REQUIREMENTS_FILES with -py2 or -py3 in the name
# (e.g. requirements-py3.txt)
- # - REQUIREMENTS_FILES with -{platform.system} in the name
- # (e.g. requirements-windows.txt)
- # - REQUIREMENTS_FILES with both Python version and platform's
- # system in the name
- # (e.g. requirements-freebsd-py2.txt)
# - REQUIREMENTS_FILES
- pyversion = sys.version_info[0]
- system = platform.system().lower()
- parts = list(map(os.path.splitext, REQUIREMENTS_FILES))
-
- version_cb = functools.partial("{1}-py{0}{2}".format, pyversion)
- platform_cb = functools.partial("{1}-{0}{2}".format, system)
- both_cb = functools.partial("{2}-{0}-py{1}{3}".format, system, pyversion)
-
- return list(itertools.chain(
- itertools.starmap(both_cb, parts),
- itertools.starmap(platform_cb, parts),
- itertools.starmap(version_cb, parts),
- REQUIREMENTS_FILES,
- ))
+ return (list(map(('-py' + str(sys.version_info[0])).join,
+ map(os.path.splitext, REQUIREMENTS_FILES)))
+ + list(REQUIREMENTS_FILES))
def append_text_list(config, key, text_list):
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py
index eac76b2..fccad45 100644
--- a/pbr/tests/test_packaging.py
+++ b/pbr/tests/test_packaging.py
@@ -40,7 +40,6 @@
import os
import re
-import sys
import tempfile
import fixtures
@@ -243,32 +242,6 @@ class TestNestedRequirements(base.BaseTestCase):
self.assertEqual(result, ['pbr'])
-class TestGetRequirements(base.BaseTestCase):
-
- def test_get_requirements_file(self):
- platforms = ['Windows', 'Freebsd', 'Darwin', 'Linux']
- version = sys.version_info[0]
-
- with mock.patch('platform.system') as platform_system:
- platform_system.side_effect = platforms
-
- for platform in map(str.lower, platforms):
- expected = [
- 'requirements-{plat}-py{ver}.txt'.format(
- plat=platform, ver=version),
- 'tools/pip-requires-{plat}-py{ver}'.format(
- plat=platform, ver=version),
- 'requirements-{0}.txt'.format(platform),
- 'tools/pip-requires-{0}'.format(platform),
- 'requirements-py{0}.txt'.format(version),
- 'tools/pip-requires-py{0}'.format(version),
- 'requirements.txt',
- 'tools/pip-requires',
- ]
- files = packaging.get_requirements_files()
- self.assertEqual(expected, files)
-
-
class TestVersions(base.BaseTestCase):
scenarios = [