svn rev #23933: trunk/src/ config/ util/
ghudson@MIT.EDU
ghudson at MIT.EDU
Sat Apr 24 14:53:25 EDT 2010
http://src.mit.edu/fisheye/changelog/krb5/?cs=23933
Commit By: ghudson
Log Message:
Simplify how k5test scripts get run by importing runenv by pathname
(using the imp module) instead of by module name.
Changed Files:
U trunk/src/config/pre.in
U trunk/src/util/k5test.py
Modified: trunk/src/config/pre.in
===================================================================
--- trunk/src/config/pre.in 2010-04-24 17:33:04 UTC (rev 23932)
+++ trunk/src/config/pre.in 2010-04-24 18:53:25 UTC (rev 23933)
@@ -244,8 +244,8 @@
DEJAFLAGS = --debug --srcdir $(srcdir) --host $(host)
RUNTEST = runtest $(DEJAFLAGS)
-RUNPYTEST = PYTHONPATH=$(BUILDTOP):$(top_srcdir)/util \
- VALGRIND="$(VALGRIND)" $(PYTHON)
+RUNPYTEST = PYTHONPATH=$(top_srcdir)/util VALGRIND="$(VALGRIND)" \
+ $(PYTHON)
START_SERVERS = $(STESTDIR)/scripts/start_servers $(TEST_SERVER) $(TEST_PATH)
START_SERVERS_LOCAL = $(STESTDIR)/scripts/start_servers_local
Modified: trunk/src/util/k5test.py
===================================================================
--- trunk/src/util/k5test.py 2010-04-24 17:33:04 UTC (rev 23932)
+++ trunk/src/util/k5test.py 2010-04-24 18:53:25 UTC (rev 23933)
@@ -307,6 +307,7 @@
import string
import subprocess
import sys
+import imp
# Used when most things go wrong (other than programming errors) so
# that the user sees an error message rather than a Python traceback,
@@ -466,15 +467,25 @@
# Return an environment suitable for running programs in the build
# tree. It is safe to modify the result.
def _build_env():
- global buildtop
+ global buildtop, _runenv
env = os.environ.copy()
- for (k, v) in runenv.env.iteritems():
+ for (k, v) in _runenv.iteritems():
if v.find('./') == 0:
env[k] = os.path.join(buildtop, v)
else:
env[k] = v
return env
+
+def _import_runenv():
+ global buildtop
+ runenv_py = os.path.join(buildtop, 'runenv.py')
+ if not os.path.exists(runenv_py):
+ fail('You must run "make fake-install" in %s first.' % buildtop)
+ module = imp.load_source('runenv', runenv_py)
+ return module.env
+
+
# Merge the nested dictionaries cfg1 and cfg2 into a new dictionary.
# cfg1 or cfg2 may be None, in which case the other is returned. If
# cfg2 contains keys mapped to None, the corresponding keys will be
@@ -1018,15 +1029,10 @@
buildtop = _find_buildtop()
srctop = _find_srctop()
plugins = _find_plugins()
+_runenv = _import_runenv()
hostname = socket.getfqdn()
null_input = open(os.devnull, 'r')
-# runenv.py is built in the top level by "make fake-install". Import
-# it now (rather than at the beginning of the file) so that we get a
-# friendly error message from _find_plugins() if "make fake-install"
-# has not been run.
-import runenv
-
krb5kdc = os.path.join(buildtop, 'kdc', 'krb5kdc')
kadmind = os.path.join(buildtop, 'kadmin', 'server', 'kadmind')
kadmin = os.path.join(buildtop, 'kadmin', 'cli', 'kadmin')
More information about the cvs-krb5
mailing list