Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
8cbce917bb
!17 [sync] PR-16: Update package to version 1.8.0
From: @openeuler-sync-bot 
Reviewed-by: @wangchong1995924 
Signed-off-by: @wangchong1995924
2023-08-23 09:19:19 +00:00
jxy_git
deeba72f32 Update package to version 1.8.0
(cherry picked from commit 4f8bd5d50fa8c9eadc561db49d582f6ad2708e9e)
2023-08-23 15:00:44 +08:00
openeuler-ci-bot
b63d76e2ab
!15 Remove buildrequires python-nose
From: @wk333 
Reviewed-by: @wangchong1995924 
Signed-off-by: @wangchong1995924
2022-06-28 08:42:01 +00:00
wk333
1491eb2632 Remove buildrequires python-nose 2022-06-28 16:29:04 +08:00
openeuler-ci-bot
b95fb6ce10 !7 修复python-jenkins软件包功能缺失
From: @jiangpengjuj
Reviewed-by: @tushenmei,@georgecao
Signed-off-by: @georgecao
2021-08-20 08:18:38 +00:00
e
9581a0d354 bugfix_function_loss.patch 2021-08-20 14:17:47 +08:00
openeuler-ci-bot
d586b43093 !6 Revert 'Pull Request !4 : 修复python-jenkins软件包功能'
From: @georgecao
Reviewed-by: @wangchong1995924
Signed-off-by: @wangchong1995924
2021-08-20 03:43:49 +00:00
George.Cao
53f2940399 Revert 'Pull Request !4 : 修复python-jenkins软件包功能' 2021-08-20 03:38:34 +00:00
openeuler-ci-bot
fbccbfb7f6 !4 修复python-jenkins软件包功能
From: @jiangpengjuj
Reviewed-by: @georgecao
Signed-off-by: @georgecao
2021-08-20 03:13:58 +00:00
e
cef79b78b3 python-Jenkins 2021-08-20 10:44:15 +08:00
4 changed files with 237 additions and 52 deletions

View File

@ -0,0 +1,163 @@
From 93acddd5f9c40a707cf5eb1b86d8dd6a3f69c695 Mon Sep 17 00:00:00 2001
Message-Id: <93acddd5f9c40a707cf5eb1b86d8dd6a3f69c695.1686949946.git.ce+ubuntuone@sicherha.de>
From: Christoph Erhardt <ce+ubuntuone@sicherha.de>
Date: Sun, 30 Apr 2023 11:18:15 +0200
Subject: [PATCH] Fix compatibility with setuptools >= 66
The Python world, including the `setuptools` package, has migrated to
the versioning scheme defined in PEP 440. Unfortunately, the versioning
of Jenkins plugins is less strict than that. As a consequence,
`pkg_resources.parse_version()` now rejects versions as invalid.
Fix `PluginVersion` by salvaging the implementation of the old
`LegacyVersion` class, which used to be part of the `packaging` library
prior to version 22.0. The code is licensed under a 2-clause BSD
licence.
For compatibility with older Python versions, remove type annotations
from the copied code.
Change-Id: Iaa057dcd81620fed861cb11bed534ff7f9ab3f32
Signed-off-by: Christoph Erhardt <ce+ubuntuone@sicherha.de>
---
jenkins/plugins.py | 97 +++++++++++++++++++++++++++++++++++++++++++---
requirements.txt | 2 -
2 files changed, 91 insertions(+), 8 deletions(-)
diff --git a/jenkins/plugins.py b/jenkins/plugins.py
index 9709d5d..cdaada9 100644
--- a/jenkins/plugins.py
+++ b/jenkins/plugins.py
@@ -42,8 +42,6 @@
import operator
import re
-import pkg_resources
-
class Plugin(dict):
'''Dictionary object containing plugin metadata.'''
@@ -76,15 +74,13 @@ class PluginVersion(str):
'''Parse plugin version and store it for comparison.'''
self._version = version
- self.parsed_version = pkg_resources.parse_version(
- self.__convert_version(version))
+ self._key = _legacy_cmpkey(self.__convert_version(version))
def __convert_version(self, version):
return self._VERSION_RE.sub(r'\g<1>.preview', str(version))
def __compare(self, op, version):
- return op(self.parsed_version, pkg_resources.parse_version(
- self.__convert_version(version)))
+ return op(self._key, PluginVersion(version)._key)
def __le__(self, version):
return self.__compare(operator.le, version)
@@ -109,3 +105,92 @@ class PluginVersion(str):
def __repr__(self):
return str(self._version)
+
+
+###############################################################################
+"""
+The Python world has migrated to the versioning scheme defined in PEP 440, but
+the versioning of Jenkins plugins is less strict than that. The code below was
+salvaged from the implementation of the `LegacyVersion` class, which used to be
+part of the `packaging` library prior to version 22.0.
+
+It is licensed as follows.
+
+Copyright (c) Donald Stufft and individual contributors.
+All rights reserved.
+
+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.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""
+
+_legacy_version_component_re = re.compile(r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE)
+
+_legacy_version_replacement_map = {
+ "pre": "c",
+ "preview": "c",
+ "-": "final-",
+ "rc": "c",
+ "dev": "@",
+}
+
+
+def _parse_version_parts(s):
+ for part in _legacy_version_component_re.split(s):
+ part = _legacy_version_replacement_map.get(part, part)
+
+ if not part or part == ".":
+ continue
+
+ if part[:1] in "0123456789":
+ # pad for numeric comparison
+ yield part.zfill(8)
+ else:
+ yield "*" + part
+
+ # ensure that alpha/beta/candidate are before final
+ yield "*final"
+
+
+def _legacy_cmpkey(version):
+
+ # We hardcode an epoch of -1 here. A PEP 440 version can only have a epoch
+ # greater than or equal to 0. This will effectively put the LegacyVersion,
+ # which uses the defacto standard originally implemented by setuptools,
+ # as before all PEP 440 versions.
+ epoch = -1
+
+ # This scheme is taken from pkg_resources.parse_version setuptools prior to
+ # it's adoption of the packaging library.
+ parts = []
+ for part in _parse_version_parts(version.lower()):
+ if part.startswith("*"):
+ # remove "-" before a prerelease tag
+ if part < "*final":
+ while parts and parts[-1] == "*final-":
+ parts.pop()
+
+ # remove trailing zeros from each series of numeric parts
+ while parts and parts[-1] == "00000000":
+ parts.pop()
+
+ parts.append(part)
+
+ return epoch, tuple(parts)
diff --git a/requirements.txt b/requirements.txt
index da41145..5c014cc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,3 @@
-# Setuptools removed support for PEP 440 non-conforming versions
-setuptools<66
six>=1.3.0
pbr>=0.8.2
multi_key_dict
--
2.40.1

Binary file not shown.

BIN
python-jenkins-1.8.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,78 +1,100 @@
%global _empty_manifest_terminate_build 0
Name: python-jenkins
Version: 1.7.0
Version: 1.8.0
Release: 1
Summary: Python bindings for the remote Jenkins API
License: BSD
License: BSD-3-Clause
URL: http://git.openstack.org/cgit/openstack/python-jenkins
Source0: https://files.pythonhosted.org/packages/85/8e/52223d8eebe35a3d86579df49405f096105328a9d80443eaed809f6c374f/python-jenkins-1.7.0.tar.gz
BuildArch: noarch
Source0: https://files.pythonhosted.org/packages/93/2e/8120831ac693483e3ac878c2f1c6bb3535dabb247b4a93117bb2da3b09f8/python-jenkins-1.8.0.tar.gz
# Contributed at https://review.opendev.org/c/jjb/python-jenkins/+/881904
Patch0: 0001-Fix-compatibility-with-setuptools-66.patch
Requires: python3-six
Requires: python3-pbr
Requires: python3-multi-key-dict
Requires: python3-requests
BuildRequires: python3-sphinx
BuildRequires: make
BuildArch: noarch
%description
Python Jenkins is a python wrapper for the REST API which aims to provide a more
conventionally pythonic way of controlling a Jenkins server.
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.
%package -n python3-jenkins
Summary: Python bindings for the remote Jenkins API
Provides: python-jenkins
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-kerberos
BuildRequires: python3-mock
BuildRequires: python3-multi_key_dict
BuildRequires: python3-pbr >= 0.8.2
BuildRequires: python3-requests
BuildRequires: python3-requests-mock
BuildRequires: python3-setuptools
BuildRequires: python3-six >= 1.3.0
BuildRequires: python3-testscenarios
BuildRequires: python3-testtools
%{?python_provide:%python_provide python3-jenkins}
%if %{undefined __pythondist_requires}
Requires: python3-multi_key_dict
Requires: python3-pbr >= 0.8.2
Requires: python3-requests
Requires: python3-six >= 1.3.0
%endif
Recommends: python3-kerberos
%description -n python3-jenkins
Python Jenkins provides a higher-level API containing a number of convenience functions.
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.
%package help
Summary: Development documents and examples for python-jenkins
Provides: python3-jenkins-doc
%description help
Python Jenkins provide a more conventionally pythonic way of controlling
a Jenkins server.
%prep
%autosetup -n python-jenkins-1.7.0
%autosetup -p1 -n %{name}-%{version}
# Remove env from __init__.py
sed -i '1{s|^#!/usr/bin/env python||}' jenkins/__init__.py
%build
export PBR_VERSION=%{version}
%py3_build
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=$PWD \
%make_build -C doc html man
rm doc/build/html/.buildinfo
%install
export PBR_VERSION=%{version}
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-jenkins -f filelist.lst
%dir %{python3_sitelib}/*
install -D -m0644 -p doc/build/man/pythonjenkins.1 %{buildroot}%{_mandir}/man1/pythonjenkins.1
%check
%{__python3} -m testtools.run discover tests
%files -n python3-jenkins
%doc README.rst doc/build/html
%license COPYING
%{python3_sitelib}/jenkins/
%{python3_sitelib}/python_jenkins-%{version}-py%{python3_version}.egg-info/
%{_mandir}/man1/pythonjenkins.1.*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Aug 23 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 1.8.0-1
- Update package to version 1.8.0
* Tue Jun 28 2022 wangkai <wangkai385@h-partners.com> -1.7.0-3
- Remove buildrequires python-nose
* Fri Aug 20 2021 Pengju Jiang <jiangpengju2@huawei.com> - 1.7.0-2
- bugfix_function_loss.patch
* Tue Jul 27 2021 Python_Bot <Python_Bot@openeuler.org> - 1.7.0-1
- Package Spec generated