pythonPackages.k5test: init at 0.9.2

This was split out gssapi a while ago.
Needs an extensive fix-paths.patch since
it's reliant upon many shell tools.
This commit is contained in:
worldofpeace 2019-08-05 11:27:31 -04:00
parent 49f6c9bbb0
commit 9d973b3dc1
3 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,43 @@
{ lib
, buildPythonPackage
, fetchPypi
, substituteAll
, six
, krb5Full
, findutils
, which
}:
buildPythonPackage rec {
pname = "k5test";
version = "0.9.2";
src = fetchPypi {
inherit pname version;
sha256 = "1lqp3jgfngyhaxjgj3n230hn90wsylwilh120yjf62h7b1s02mh8";
};
patches = [
(substituteAll {
src = ./fix-paths.patch;
inherit findutils krb5Full;
# krb5-config is in dev output
krb5FullDev = krb5Full.dev;
which = "${which}/bin/which";
})
];
propagatedBuildInputs = [
six
];
# No tests
doCheck = false;
meta = with lib; {
description = "Library for setting up self-contained Kerberos 5 environment";
homepage = https://github.com/pythongssapi/k5test;
license = licenses.mit;
maintainers = [ ];
};
}

View File

@ -0,0 +1,90 @@
diff --git a/k5test/_utils.py b/k5test/_utils.py
index e289fac..e2f486a 100644
--- a/k5test/_utils.py
+++ b/k5test/_utils.py
@@ -65,12 +65,12 @@ def find_plugin_dir():
# if there was no LD_LIBRARY_PATH, or the above failed
if _PLUGIN_DIR is None:
- lib_dir = os.path.join(get_output('krb5-config --prefix'), 'lib64')
+ lib_dir = os.path.join(get_output('@krb5FullDev@/bin/krb5-config --prefix'), 'lib64')
_PLUGIN_DIR = _decide_plugin_dir(_find_plugin_dirs_installed(lib_dir))
# /usr/lib64 seems only to be distinct on Fedora/RHEL/Centos family
if _PLUGIN_DIR is None:
- lib_dir = os.path.join(get_output('krb5-config --prefix'), 'lib')
+ lib_dir = os.path.join(get_output('@krb5FullDev@/bin/krb5-config --prefix'), 'lib')
_PLUGIN_DIR = _decide_plugin_dir(_find_plugin_dirs_installed(lib_dir))
if _PLUGIN_DIR is not None:
@@ -89,7 +89,7 @@ def _decide_plugin_dir(dirs):
for path in shortest_first:
# check to see if it actually contains .so files
- if get_output('find %s -name "*.so"' % path):
+ if get_output('@findutils@/bin/find %s -name "*.so"' % path):
return path
return None
@@ -97,7 +97,7 @@ def _decide_plugin_dir(dirs):
def _find_plugin_dirs_installed(search_path):
try:
- options_raw = get_output('find %s/ -type d \( ! -executable -o ! -readable \) '
+ options_raw = get_output('@findutils@/bin/find %s/ -type d \( ! -executable -o ! -readable \) '
'-prune -o '
'-type d -path "*/krb5/plugins" -print' % search_path,
stderr=subprocess.STDOUT)
@@ -111,7 +111,7 @@ def _find_plugin_dirs_installed(search_path):
def _find_plugin_dirs_src(search_path):
- options_raw = get_output('find %s/../ -type d -name plugins' % search_path)
+ options_raw = get_output('@findutils@/bin/find %s/../ -type d -name plugins' % search_path)
if options_raw:
return options_raw.split('\n')
diff --git a/k5test/realm.py b/k5test/realm.py
index f57946b..ad78579 100644
--- a/k5test/realm.py
+++ b/k5test/realm.py
@@ -181,19 +181,13 @@ class K5Realm(object):
return path
def _init_paths(self, **paths):
- self.kdb5_util = self._discover_path('kdb5_util',
- '/usr/sbin/kdb5_util', paths)
- self.krb5kdc = self._discover_path('krb5kdc',
- '/usr/sbin/krb5kdc', paths)
- self.kadmin_local = self._discover_path('kadmin_local',
- '/usr/sbin/kadmin.local',
- paths)
- self.kprop = self._discover_path('kprop', '/usr/sbin/kprop', paths)
- self.kadmind = self._discover_path('kadmind',
- '/usr/sbin/kadmind', paths)
-
- self._kinit = self._discover_path('kinit', '/usr/bin/kinit', paths)
- self._klist = self._discover_path('klist', '/usr/bin/klist', paths)
+ self.kdb5_util = '@krb5Full@/bin/kdb5_util'
+ self.krb5kdc = '@krb5Full@/bin/krb5kdc'
+ self.kadmin_local = '@krb5Full@/bin/kadmin.local'
+ self.kprop = '@krb5Full@/bin/kprop'
+ self.kadmind = '@krb5Full@/bin/kadmind'
+ self._kinit = '@krb5Full@/bin/kinit'
+ self._klist = '@krb5Full@/bin/klist'
def _create_conf(self, profile, filename):
with open(filename, 'w') as conf_file:
diff --git a/k5test/unit.py b/k5test/unit.py
index 4ee7f98..543d662 100644
--- a/k5test/unit.py
+++ b/k5test/unit.py
@@ -38,7 +38,7 @@ _KRB_VERSION = None
def krb_minversion_test(target_version, problem):
global _KRB_VERSION
if _KRB_VERSION is None:
- _KRB_VERSION = _utils.get_output("krb5-config --version")
+ _KRB_VERSION = _utils.get_output("@krb5FullDev@/bin/krb5-config --version")
_KRB_VERSION = _KRB_VERSION.split(' ')[-1].split('.')
def make_ext_test(func):

View File

@ -3434,6 +3434,10 @@ in {
kubernetes = callPackage ../development/python-modules/kubernetes { };
k5test = callPackage ../development/python-modules/k5test {
inherit (pkgs) krb5Full findutils which;
};
pylast = callPackage ../development/python-modules/pylast { };
pylru = callPackage ../development/python-modules/pylru { };