mirror of
https://github.com/samba-team/samba.git
synced 2025-07-23 20:59:10 +03:00
python: Remove remaining references to third_party python libs
For now at least we do not have any in third_party. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Aug 21 00:12:52 UTC 2020 on sn-devel-184
This commit is contained in:
@ -322,46 +322,6 @@ def valid_netbios_name(name):
|
||||
return True
|
||||
|
||||
|
||||
def import_bundled_package(modulename, location, source_tree_container,
|
||||
namespace):
|
||||
"""Import the bundled version of a package.
|
||||
|
||||
:note: This should only be called if the system version of the package
|
||||
is not adequate.
|
||||
|
||||
:param modulename: Module name to import
|
||||
:param location: Location to add to sys.path (can be relative to
|
||||
${srcdir}/${source_tree_container})
|
||||
:param source_tree_container: Directory under source root that
|
||||
contains the bundled third party modules.
|
||||
:param namespace: Namespace to import module from, when not in source tree
|
||||
"""
|
||||
if in_source_tree():
|
||||
extra_path = os.path.join(source_tree_topdir(), source_tree_container,
|
||||
location)
|
||||
if extra_path not in sys.path:
|
||||
sys.path.insert(0, extra_path)
|
||||
sys.modules[modulename] = __import__(modulename)
|
||||
else:
|
||||
sys.modules[modulename] = __import__(
|
||||
"%s.%s" % (namespace, modulename), fromlist=[namespace])
|
||||
|
||||
|
||||
def ensure_third_party_module(modulename, location):
|
||||
"""Add a location to sys.path if a third party dependency can't be found.
|
||||
|
||||
:param modulename: Module name to import
|
||||
:param location: Location to add to sys.path (can be relative to
|
||||
${srcdir}/third_party)
|
||||
"""
|
||||
try:
|
||||
__import__(modulename)
|
||||
except ImportError:
|
||||
import_bundled_package(modulename, location,
|
||||
source_tree_container="third_party",
|
||||
namespace="samba.third_party")
|
||||
|
||||
|
||||
def dn_from_dns_name(dnsdomain):
|
||||
"""return a DN from a DNS name domain/forest root"""
|
||||
return "DC=" + ",DC=".join(dnsdomain.split("."))
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
import samba
|
||||
|
||||
samba.ensure_third_party_module("iso8601", "pyiso8601")
|
||||
import iso8601
|
||||
|
||||
import unittest
|
||||
|
Reference in New Issue
Block a user