From 07432d3e68ae5f10f2469f47b86abc19841e41e7 Mon Sep 17 00:00:00 2001 From: Carl George Date: Jan 22 2018 20:02:27 +0000 Subject: Initial import (#1531151) --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3755ecc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/docker-2.6.1.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 55aad81..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# python3-docker - -A Python library for the Docker Engine API \ No newline at end of file diff --git a/python3-docker.spec b/python3-docker.spec new file mode 100644 index 0000000..197cc66 --- /dev/null +++ b/python3-docker.spec @@ -0,0 +1,93 @@ +%bcond_without tests + +%global srcname docker + +Name: python3-%{srcname} +Version: 2.6.1 +Release: 1%{?dist} +Summary: A Python library for the Docker Engine API +License: ASL 2.0 +URL: https://pypi.python.org/pypi/%{srcname} +Source0: https://files.pythonhosted.org/packages/source/d/%{srcname}/%{srcname}-%{version}.tar.gz + +# Upstream uses environment markers to conditionally apply some dependencies. +# Environment markers were first added in setuptools 20.6.8, so that doesn't +# work in RHEL. This patch converts those environment markers into simple if +# statements. +Patch2: remove-environment-markers.patch + +# Upstream uses pip to check if the older docker-py module is installed. We +# handle that with an obsolete. +Patch3: remove-pip-dependency.patch + +# Some of the test use pytest.deprecated_call as a context manager. That +# capability was added in pytest 2.9.0+, but currently RHEL only ships 2.7.0. +# This patch reverts the context manager usage to the traditional function +# call. +Patch4: remove-pytest-deprecated_call-context-manager.patch + +BuildArch: noarch + + +%description +It lets you do anything the docker command does, but from within Python apps – +run containers, manage containers, manage Swarms, etc. + + +%package -n python%{python3_pkgversion}-%{srcname} +Summary: A Python library for the Docker Engine API +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-requests >= 2.5.2 +BuildRequires: python%{python3_pkgversion}-six >= 1.4.0 +BuildRequires: python%{python3_pkgversion}-websocket-client >= 0.32.0 +BuildRequires: python%{python3_pkgversion}-docker-pycreds >= 0.2.1 +%if 0%{?python3_version_nodots} < 35 +BuildRequires: python%{python3_pkgversion}-backports-ssl_match_hostname >= 3.5 +%endif +%endif # tests +Requires: python%{python3_pkgversion}-requests >= 2.5.2 +Requires: python%{python3_pkgversion}-six >= 1.4.0 +Requires: python%{python3_pkgversion}-websocket-client >= 0.32.0 +Requires: python%{python3_pkgversion}-docker-pycreds >= 0.2.1 +%if 0%{?python3_version_nodots} < 35 +Requires: python%{python3_pkgversion}-backports-ssl_match_hostname >= 3.5 +%endif + + +%description -n python%{python3_pkgversion}-%{srcname} +It lets you do anything the docker command does, but from within Python apps – +run containers, manage containers, manage Swarms, etc. + + +%prep +%autosetup -n %{srcname}-%{version} -p 1 +rm -r docker.egg-info + + +%build +%py3_build + + +%install +%py3_install + + +%if %{with tests} +%check +py.test-%{python3_version} --verbose tests/unit +%endif + + +%files -n python%{python3_pkgversion}-%{srcname} +%license LICENSE +%doc README.md +%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info + + +%changelog +* Mon Jan 22 2018 Carl George - 2.6.1-1 +- Initial EPEL7 package diff --git a/remove-environment-markers.patch b/remove-environment-markers.patch new file mode 100644 index 0000000..90db013 --- /dev/null +++ b/remove-environment-markers.patch @@ -0,0 +1,46 @@ +Generate requirements list dynamically instead of using environment markers. +This allows using versions of setuptools older than 20.6.8. + +diff -Nurp docker-2.5.1.orig/setup.py docker-2.5.1/setup.py +--- docker-2.5.1.orig/setup.py 2017-08-22 18:44:35.000000000 -0500 ++++ docker-2.5.1/setup.py 2017-09-05 12:06:03.280017598 -0500 +@@ -29,23 +29,14 @@ requirements = [ + if sys.platform == 'win32': + requirements.append('pypiwin32 >= 219') + +-extras_require = { +- ':python_version < "3.5"': 'backports.ssl_match_hostname >= 3.5', +- # While not imported explicitly, the ipaddress module is required for +- # ssl_match_hostname to verify hosts match with certificates via +- # ServerAltname: https://pypi.python.org/pypi/backports.ssl_match_hostname +- ':python_version < "3.3"': 'ipaddress >= 1.0.16', +- +- # If using docker-py over TLS, highly recommend this option is +- # pip-installed or pinned. +- +- # TODO: if pip installing both "requests" and "requests[security]", the +- # extra package from the "security" option are not installed (see +- # https://github.com/pypa/pip/issues/4391). Once that's fixed, instead of +- # installing the extra dependencies, install the following instead: +- # 'requests[security] >= 2.5.2, != 2.11.0, != 2.12.2' +- 'tls': ['pyOpenSSL>=0.14', 'cryptography>=1.3.4', 'idna>=2.0.0'], +-} ++if sys.version_info[:2] < (3, 5): ++ requirements.append('backports.ssl_match_hostname >= 3.5') ++ ++# While not imported explicitly, the ipaddress module is required for ++# ssl_match_hostname to verify hosts match with certificates via ++# ServerAltname: https://pypi.python.org/pypi/backports.ssl_match_hostname ++if sys.version_info[:2] < (3, 3): ++ requirements.append('ipaddress >= 1.0.16') + + version = None + exec(open('docker/version.py').read()) +@@ -72,7 +63,6 @@ setup( + packages=find_packages(exclude=["tests.*", "tests"]), + install_requires=requirements, + tests_require=test_requirements, +- extras_require=extras_require, + zip_safe=False, + test_suite='tests', + classifiers=[ diff --git a/remove-pip-dependency.patch b/remove-pip-dependency.patch new file mode 100644 index 0000000..5137f8f --- /dev/null +++ b/remove-pip-dependency.patch @@ -0,0 +1,21 @@ +diff -Nurp docker-2.5.1.orig/setup.py docker-2.5.1/setup.py +--- docker-2.5.1.orig/setup.py 2017-08-22 18:44:35.000000000 -0500 ++++ docker-2.5.1/setup.py 2017-09-05 11:56:27.542146668 -0500 +@@ -5,17 +5,8 @@ import codecs + import os + import sys + +-import pip +- + from setuptools import setup, find_packages + +-if 'docker-py' in [x.project_name for x in pip.get_installed_distributions()]: +- print( +- 'ERROR: "docker-py" needs to be uninstalled before installing this' +- ' package:\npip uninstall docker-py', file=sys.stderr +- ) +- sys.exit(1) +- + ROOT_DIR = os.path.dirname(__file__) + SOURCE_DIR = os.path.join(ROOT_DIR) + diff --git a/remove-pytest-deprecated_call-context-manager.patch b/remove-pytest-deprecated_call-context-manager.patch new file mode 100644 index 0000000..17ef7ca --- /dev/null +++ b/remove-pytest-deprecated_call-context-manager.patch @@ -0,0 +1,23 @@ +diff -Nurp docker-2.6.1.orig/tests/unit/api_container_test.py docker-2.6.1/tests/unit/api_container_test.py +--- docker-2.6.1.orig/tests/unit/api_container_test.py 2017-10-24 17:14:49.000000000 -0500 ++++ docker-2.6.1/tests/unit/api_container_test.py 2018-01-22 10:11:47.198033614 -0600 +@@ -246,8 +246,7 @@ class CreateContainerTest(BaseAPIClientT + {'Content-Type': 'application/json'}) + + def test_create_container_with_cpu_shares(self): +- with pytest.deprecated_call(): +- self.client.create_container('busybox', 'ls', cpu_shares=5) ++ pytest.deprecated_call(self.client.create_container, 'busybox', 'ls', cpu_shares=5) + + args = fake_request.call_args + self.assertEqual(args[0][1], +@@ -292,8 +291,7 @@ class CreateContainerTest(BaseAPIClientT + {'Content-Type': 'application/json'}) + + def test_create_container_with_cpuset(self): +- with pytest.deprecated_call(): +- self.client.create_container('busybox', 'ls', cpuset='0,1') ++ pytest.deprecated_call(self.client.create_container, 'busybox', 'ls', cpuset='0,1') + + args = fake_request.call_args + self.assertEqual(args[0][1], diff --git a/sources b/sources new file mode 100644 index 0000000..5b16d58 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (docker-2.6.1.tar.gz) = 17a66a0133ca1c13789a9816063570ec77901d6c7a41d819147a4a427fa806f6af6737e506ba3f5b108b7ee2eb150b26fafbbc4e500b097a940ece654d50f29a