Chih-Hsuan Yen pushed to branch main at Arch Linux / Packaging / Packages / 
python-hvac


Commits:
7706d23c by loqs at 2024-03-17T17:13:17+00:00
Fix tests with python 3.12

Fixes 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-hvac/-/issues/1.

- - - - -


2 changed files:

- PKGBUILD
- + hvac-2.1.0-distutils-replacement.patch


Changes:

=====================================
PKGBUILD
=====================================
@@ -21,8 +21,10 @@ checkdepends=(python-pytest python-authlib python-flask 
python-flask-sqlalchemy
 optdepends=(
   'python-pyhcl: for HCL parser'
 )
-source=("https://github.com/$_pkgname/$_pkgname/archive/v$pkgver/$_pkgname-$pkgver.tar.gz";)
-sha512sums=('793200196867432f1c277ec499348e87c7afb91e1e204733fc8f79d93f4d13c4ab0f4f5618c5efb93c5771c3a68de103cb0beb4075c4d5c19afcea385940948b')
+source=("https://github.com/$_pkgname/$_pkgname/archive/v$pkgver/$_pkgname-$pkgver.tar.gz";
+        "$_pkgname-2.1.0-distutils-replacement.patch")
+sha512sums=('793200196867432f1c277ec499348e87c7afb91e1e204733fc8f79d93f4d13c4ab0f4f5618c5efb93c5771c3a68de103cb0beb4075c4d5c19afcea385940948b'
+            
'5673e020d6303199d6088912acfc73b7da20aed35f89cd3da80eb38788e14b64d4190a40ff72c9bce7bd83e418fbdf9d5e465e67beeeb8910c5041c9745eb880')
 
 prepare() {
   # /usr/bin/vault not working in clean chroots as it requires CAP_IPC_LOCK
@@ -31,6 +33,9 @@ prepare() {
   cp -v /usr/bin/vault vault-unprivileged/
 
   cd $_pkgname-$pkgver
+
+  patch -Np1 -i ../$_pkgname-2.1.0-distutils-replacement.patch
+
   # Disabling parallel tests. Somehow a test in test_identity.py fails
   sed -i '/addopts/d' pyproject.toml
 }


=====================================
hvac-2.1.0-distutils-replacement.patch
=====================================
@@ -0,0 +1,72 @@
+diff --git a/tests/integration_tests/api/auth_methods/test_ldap.py 
b/tests/integration_tests/api/auth_methods/test_ldap.py
+index 9b89aa7..784bbad 100644
+--- a/tests/integration_tests/api/auth_methods/test_ldap.py
++++ b/tests/integration_tests/api/auth_methods/test_ldap.py
+@@ -1,4 +1,4 @@
+-import distutils.spawn
++import shutil
+ import logging
+ from unittest import TestCase, SkipTest
+ 
+@@ -17,7 +17,7 @@ class TestLdap(HvacIntegrationTestCase, TestCase):
+     @classmethod
+     def setUpClass(cls):
+         # The mock LDAP server requires Java runtime
+-        if not distutils.spawn.find_executable("java"):
++        if not shutil.which("java"):
+             raise SkipTest("The mock LDAP server requires Java runtime")
+ 
+         try:
+diff --git a/tests/utils/hvac_integration_test_case.py 
b/tests/utils/hvac_integration_test_case.py
+index 0052497..76a5643 100644
+--- a/tests/utils/hvac_integration_test_case.py
++++ b/tests/utils/hvac_integration_test_case.py
+@@ -5,7 +5,7 @@ import time
+ 
+ from tests.utils import get_config_file_path, create_client, is_enterprise
+ from tests.utils.server_manager import ServerManager
+-import distutils.spawn
++import shutil
+ from hvac import Client
+ 
+ 
+@@ -23,7 +23,7 @@ class HvacIntegrationTestCase:
+     def setUpClass(cls):
+         """Use the ServerManager class to launch a vault server process."""
+         config_paths = [get_config_file_path("vault-tls.hcl")]
+-        if distutils.spawn.find_executable("consul") is None and 
cls.enable_vault_ha:
++        if shutil.which("consul") is None and cls.enable_vault_ha:
+             logging.warning(
+                 "Unable to run Vault in HA mode, consul binary not found in 
path."
+             )
+diff --git a/tests/utils/server_manager.py b/tests/utils/server_manager.py
+index d402174..dfc625c 100644
+--- a/tests/utils/server_manager.py
++++ b/tests/utils/server_manager.py
+@@ -7,7 +7,7 @@ import requests
+ import hcl
+ import typing as t
+ 
+-import distutils.spawn
++import shutil
+ from unittest import SkipTest
+ from tests.utils import (
+     get_config_file_path,
+@@ -137,7 +137,7 @@ class ServerManager:
+         self, *, consul_config: dict = None, attempt=1, max_attempts=3, 
delay_s=1
+     ):
+         """Launch the vault server process and wait until its online and 
ready."""
+-        if distutils.spawn.find_executable("vault") is None:
++        if shutil.which("vault") is None:
+             raise SkipTest("Vault executable not found")
+ 
+         with PortGetter() as g:
+@@ -225,7 +225,7 @@ class ServerManager:
+     def start_consul(
+         self,
+     ) -> str:
+-        if distutils.spawn.find_executable("consul") is None:
++        if shutil.which("consul") is None:
+             raise SkipTest("Consul executable not found")
+ 
+         with PortGetter() as g:



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-hvac/-/commit/7706d23c42e32a2b33402a701d279e265c24f827

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/python-hvac/-/commit/7706d23c42e32a2b33402a701d279e265c24f827
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to