Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonsteiner committed Jan 7, 2025
1 parent d2886da commit 44cefb9
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions jenkinsapi/utils/jenkins_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import requests
import queue
import threading
import tarfile
import subprocess
from urllib3 import Retry
from urllib.parse import urlparse
from tarfile import TarFile

from requests.adapters import HTTPAdapter

Expand Down Expand Up @@ -135,22 +135,12 @@ def update_war(self):
)

def update_config(self):
try:
import importlib_resources # if python > 3.11

# see https://setuptools.pypa.io/en/latest/pkg_resources.html

fileobj = importlib_resources.files(
"jenkinsapi_tests.systests"
).joinpath("jenkins_home.tar.gz")
except ImportError:
from pkg_resources import resource_stream # below python 3.11

fileobj = resource_stream(
"jenkinsapi_tests.systests", "jenkins_home.tar.gz"
)
tarball = TarFile.open(fileobj=fileobj)
tarball.extractall(path=self.jenkins_home)
from jenkinsapi_tests import systests
file = os.path.join(os.path.dirname(systests.__file__), "jenkins_home.tar.gz")

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")
Expand Down

0 comments on commit 44cefb9

Please sign in to comment.