mirror of
https://github.com/samba-team/samba.git
synced 2025-08-05 12:22:11 +03:00
subunitrun: Use unittest.TestProgram if subunit.TestProgram is not
available. Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Fri Dec 10 03:49:03 CET 2010 on sn-devel-104
This commit is contained in:
@ -318,27 +318,12 @@ def import_bundled_package(modulename, location):
|
||||
sys.path.insert(0,
|
||||
os.path.join(os.path.dirname(__file__),
|
||||
"../../../../lib", location))
|
||||
__import__(modulename)
|
||||
sys.modules[modulename] = __import__(modulename)
|
||||
else:
|
||||
sys.modules[modulename] = __import__(
|
||||
"samba.external.%s" % modulename, fromlist=["samba.external"])
|
||||
|
||||
|
||||
def force_bundled_package(packagename, location):
|
||||
"""Forcibly use the bundled package.
|
||||
|
||||
This will first unload the system module and then load the bundled one.
|
||||
|
||||
:param packagename: The package name
|
||||
:param location: Location to add to sys.path (can be relative to
|
||||
${srcdir}/lib)
|
||||
"""
|
||||
for m in sys.modules.keys():
|
||||
if m.startswith("%s." % packagename):
|
||||
del sys.modules[m]
|
||||
import_bundled_package(packagename, location)
|
||||
|
||||
|
||||
def ensure_external_module(modulename, location):
|
||||
"""Add a location to sys.path if an external dependency can't be found.
|
||||
|
||||
|
Reference in New Issue
Block a user