diff options
-rw-r--r-- | python-jenkins-0.4.5-six-1.3.patch | 61 | ||||
-rw-r--r-- | python-jenkins.spec | 24 |
2 files changed, 85 insertions, 0 deletions
diff --git a/python-jenkins-0.4.5-six-1.3.patch b/python-jenkins-0.4.5-six-1.3.patch new file mode 100644 index 0000000..e9ff064 --- /dev/null +++ b/python-jenkins-0.4.5-six-1.3.patch @@ -0,0 +1,61 @@ +From 41f25818fd7bb8703f465ef60128ab7fab864903 Mon Sep 17 00:00:00 2001 +From: Ken Dreyer <ktdreyer@ktdreyer.com> +Date: Mon, 4 May 2015 10:02:24 -0600 +Subject: [PATCH] support six 1.3 + +RHEL 7.1 ships python-six-1.3. This old version does not support +directly importing the various modules we need from six.moves. + +Change-Id: I60a5f4be7e17b60f58927b162236d89d4a504135 +--- + jenkins/__init__.py | 16 +++++++++++----- + tests/test_jenkins.py | 6 +++++- + 2 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/jenkins/__init__.py b/jenkins/__init__.py +index 829f726..aa56b62 100644 +--- a/jenkins/__init__.py ++++ b/jenkins/__init__.py +@@ -51,11 +51,17 @@ import re + import socket + + import six +-from six.moves.http_client import BadStatusLine +-from six.moves.urllib.error import HTTPError +-from six.moves.urllib.error import URLError +-from six.moves.urllib.parse import quote, urlencode +-from six.moves.urllib.request import Request, urlopen ++try: ++ from six.moves.http_client import BadStatusLine ++ from six.moves.urllib.error import HTTPError ++ from six.moves.urllib.error import URLError ++ from six.moves.urllib.parse import quote, urlencode ++ from six.moves.urllib.request import Request, urlopen ++except ImportError: ++ # six 1.3 ++ from httplib import BadStatusLine ++ from urllib import quote, urlencode ++ from urllib2 import HTTPError, URLError, Request, urlopen + + LAUNCHER_SSH = 'hudson.plugins.sshslaves.SSHLauncher' + LAUNCHER_COMMAND = 'hudson.slaves.CommandLauncher' +diff --git a/tests/test_jenkins.py b/tests/test_jenkins.py +index b59f798..ecb00cf 100644 +--- a/tests/test_jenkins.py ++++ b/tests/test_jenkins.py +@@ -8,7 +8,11 @@ else: + + from mock import patch, Mock + import six +-from six.moves.urllib.error import HTTPError ++try: ++ from six.moves.urllib.error import HTTPError ++except ImportError: ++ # six 1.3 ++ from urllib2 import HTTPError + + from tests.helper import jenkins + +-- +2.3.6 + diff --git a/python-jenkins.spec b/python-jenkins.spec index 9e0a3d9..0e860ba 100644 --- a/python-jenkins.spec +++ b/python-jenkins.spec @@ -1,3 +1,7 @@ +%if 0%{?fedora} > 12 +%global with_python3 1 +%endif + Name: python-jenkins Version: 0.4.5 Release: 1%{?dist} @@ -7,6 +11,7 @@ Group: Development/Libraries License: BSD URL: http://python-jenkins.readthedocs.org/en/latest Source0: https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz +Patch0: %{name}-0.4.5-six-1.3.patch BuildArch: noarch @@ -19,6 +24,7 @@ BuildRequires: python-sphinx Requires: python-pbr Requires: python-six +%if 0%{?with_python3} %package -n python3-jenkins Summary: Python bindings for the remote Jenkins API @@ -30,22 +36,29 @@ BuildRequires: python3-six BuildRequires: python3-sphinx Requires: python3-pbr Requires: python3-six +%endif %description Python Jenkins is a library for the remote API of the Jenkins continuous integration server. It is useful for creating and managing jobs as well as build nodes. +%if 0%{?with_python3} %description -n python3-jenkins Python Jenkins is a library for the remote API of the Jenkins continuous integration server. It is useful for creating and managing jobs as well as build nodes. +%endif %prep %setup -qc mv %{name}-%{version} python2 pushd python2 +%if 0%{?epel} +%patch0 -p1 +%endif + # Remove env from __init__.py sed -i '/^#!\/usr\/bin\/env python$/d' jenkins/__init__.py @@ -56,8 +69,11 @@ sed -i 's/pbr>=0.8.2/pbr>=0.8.0/' requirements.txt cp -pr AUTHORS ChangeLog COPYING README.rst ../ popd +%if 0%{?with_python3} cp -a python2 python3 find python3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif + find python2 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %build @@ -69,11 +85,13 @@ make -C doc html man rm -f doc/build/html/.buildinfo popd +%if 0%{?with_python3} pushd python3 %{__python3} setup.py build SPHINXBUILD=sphinx-build-%{python3_version} make -C doc html man rm -f doc/build/html/.buildinfo popd +%endif %install pushd python2 @@ -81,19 +99,23 @@ pushd python2 install -p -D -m0644 doc/build/man/pythonjenkins.1 %{buildroot}%{_mandir}/man1/pythonjenkins.1 popd +%if 0%{?with_python3} pushd python3 %{__python3} setup.py install --skip-build --root %{buildroot} install -p -D -m0644 doc/build/man/pythonjenkins.1 %{buildroot}%{_mandir}/man1/python3jenkins.1 popd +%endif %check pushd python2 PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests -w tests popd +%if 0%{?with_python3} pushd python3 PYTHONPATH=%{buildroot}%{python3_sitelib} nosetests-%{python3_version} -w tests popd +%endif %files %doc AUTHORS ChangeLog README.rst python2/doc/build/html @@ -102,12 +124,14 @@ popd %{python2_sitelib}/python_jenkins-%{version}-py?.?.egg-info %{_mandir}/man1/pythonjenkins.1.gz +%if 0%{?with_python3} %files -n python3-jenkins %doc AUTHORS ChangeLog README.rst python3/doc/build/html %license COPYING %{python3_sitelib}/jenkins %{python3_sitelib}/python_jenkins-%{version}-py?.?.egg-info %{_mandir}/man1/python3jenkins.1.gz +%endif %changelog * Sun Apr 12 2015 Scott K Logan <logans@cottsay.net> - 0.4.5-1 |