From 22614ce3a1f315f927ece3159c4d3f6638f6e4d9 Mon Sep 17 00:00:00 2001 From: csteiner <47841949+clintonsteiner@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:00:03 -0600 Subject: [PATCH] add support for 3.12 and 3.13 (#877) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/python-package.yml | 4 ++-- README.rst | 7 ++----- doc/source/conf.py | 4 +--- doc/source/index.rst | 5 ++--- jenkinsapi/__init__.py | 6 ------ jenkinsapi/build.py | 3 +-- jenkinsapi/utils/jenkins_launcher.py | 16 +++++++++------- pyproject.toml | 12 +++++------- setup.cfg | 10 ++++------ 9 files changed, 26 insertions(+), 41 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 18d66fd1..46370c89 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,8 +20,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - token: ["stable", "latest"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + token: ["stable"] steps: - name: Harden Runner diff --git a/README.rst b/README.rst index 7fc11722..4380485c 100644 --- a/README.rst +++ b/README.rst @@ -4,9 +4,6 @@ jenkinsapi .. image:: https://badge.fury.io/py/jenkinsapi.png :target: http://badge.fury.io/py/jenkinsapi -.. image:: https://travis-ci.com/pycontribs/jenkinsapi.png?branch=master - :target: https://travis-ci.com/pycontribs/jenkinsapi - .. image:: https://codecov.io/gh/pycontribs/jenkinsapi/branch/master/graph/badge.svg :target: https://codecov.io/gh/pycontribs/jenkinsapi @@ -142,7 +139,7 @@ Python versions The project has been tested against Python versions: -* 3.8 - 3.11 +* 3.8 - 3.13 * 2.7 - last version compatible with Python 2.7 is tagged Py2 in repository and available on PyPi as version 0.3.13 Jenkins versions @@ -177,4 +174,4 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -.. _Java: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html +.. _Java: https://www.oracle.com/java/technologies/downloads/#java17 diff --git a/doc/source/conf.py b/doc/source/conf.py index 0384b71b..ce71535e 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,10 +13,8 @@ # serve to show the default. import logging import jenkinsapi -import pkg_resources -dist = pkg_resources.working_set.by_key[jenkinsapi.__name__] -VERSION = RELEASE = dist.version +VERSION = RELEASE = jenkinsapi.__version__ if __name__ == "__main__": logging.basicConfig() diff --git a/doc/source/index.rst b/doc/source/index.rst index 6389db22..bd79d0b1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -25,7 +25,6 @@ Sections artifact build using_jenkinsapi - rules_for_contributors Important Links --------------- @@ -53,14 +52,14 @@ Most users can do the following: pip install jenkinsapi -Or.. +Or .. code-block:: bash easy_install jenkinsapi * In Jenkins > 1.518 you will need to disable "Prevent Cross Site Request Forgery exploits". - * Remember to set the Jenkins Location in general settings - Jenkins' REST web-interface will not work if this is set incorrectly. + * Remember to set the Jenkins Location in general settings - Jenkins REST web-interface will not work if this is set incorrectly. Examples -------- diff --git a/jenkinsapi/__init__.py b/jenkinsapi/__init__.py index b4aedb0e..97957b18 100644 --- a/jenkinsapi/__init__.py +++ b/jenkinsapi/__init__.py @@ -93,9 +93,3 @@ __docformat__ = "epytext" # In case of jenkinsapi is not installed in 'develop' mode __version__ = "0.3.13" -try: - import pkg_resources - - __version__ = pkg_resources.working_set.by_key["jenkinsapi"].version -except (ImportError, KeyError): - pass diff --git a/jenkinsapi/build.py b/jenkinsapi/build.py index 3134d521..5e8d97e0 100644 --- a/jenkinsapi/build.py +++ b/jenkinsapi/build.py @@ -527,8 +527,7 @@ def get_estimated_duration(self) -> int | None: def stop(self) -> bool: """ Stops the build execution if it's running - :return boolean True if succeded False otherwise or the build - is not running + :return: boolean True if succeeded False otherwis """ if self.is_running(): url: str = "%s/stop" % self.baseurl diff --git a/jenkinsapi/utils/jenkins_launcher.py b/jenkinsapi/utils/jenkins_launcher.py index 3769194f..9a612ecd 100644 --- a/jenkinsapi/utils/jenkins_launcher.py +++ b/jenkinsapi/utils/jenkins_launcher.py @@ -8,11 +8,10 @@ import requests import queue import threading +import tarfile import subprocess -from pkg_resources import resource_stream from urllib3 import Retry from urllib.parse import urlparse -from tarfile import TarFile from requests.adapters import HTTPAdapter @@ -136,12 +135,15 @@ def update_war(self): ) def update_config(self): - tarball = TarFile.open( - fileobj=resource_stream( - "jenkinsapi_tests.systests", "jenkins_home.tar.gz" - ) + from jenkinsapi_tests import systests + + file = os.path.join( + os.path.dirname(systests.__file__), "jenkins_home.tar.gz" ) - tarball.extractall(path=self.jenkins_home) + + with open(file, "rb") as f: + with tarfile.open(fileobj=f, mode="r:gz") as tarball: + tarball.extractall(path=self.jenkins_home) def install_plugins(self): plugin_dest_dir = os.path.join(self.jenkins_home, "plugins") diff --git a/pyproject.toml b/pyproject.toml index 78b64424..513a55f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ description = "A Python API for accessing resources on a Jenkins continuous-inte readme = "README.rst" license = {text = "MIT license"} classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", @@ -24,19 +24,17 @@ classifiers = [ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Testing", "Topic :: Utilities", ] -requires-python = ">=2.7" +requires_python = ">=3.8" dynamic = ["version"] dependencies = [ "pytz>=2014.4", diff --git a/setup.cfg b/setup.cfg index f3746251..bebd744c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,7 +6,7 @@ summary = A Python API for accessing resources on a Jenkins continuous-integrati description-file = README.rst license = MIT classifier = - Development Status :: 4 - Beta + Development Status :: 5 - Production/Stable Environment :: Console Intended Audience :: Developers Intended Audience :: Information Technology @@ -16,15 +16,13 @@ classifier = Operating System :: OS Independent Operating System :: OS Independent Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Topic :: Software Development :: Testing Topic :: Utilities