|
@@ -1,7 +1,6 @@
|
|
import shutil
|
|
import shutil
|
|
import sys
|
|
import sys
|
|
from importlib import _bootstrap_external
|
|
from importlib import _bootstrap_external
|
|
-from contextlib import chdir
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
from pathlib import Path
|
|
|
|
|
|
@@ -12,56 +11,6 @@ from metadocker.register import load_env
|
|
import sys
|
|
import sys
|
|
import importlib.util
|
|
import importlib.util
|
|
|
|
|
|
-# def spec_from_file_location(name, location, *, loader=None,
|
|
|
|
-# submodule_search_locations=_POPULATE):
|
|
|
|
-# """Return a module spec based on a file location.
|
|
|
|
-#
|
|
|
|
-# To indicate that the module is a package, set
|
|
|
|
-# submodule_search_locations to a list of directory paths. An
|
|
|
|
-# empty list is sufficient, though its not otherwise useful to the
|
|
|
|
-# import system.
|
|
|
|
-#
|
|
|
|
-# The loader must take a spec as its only __init__() arg.
|
|
|
|
-#
|
|
|
|
-# """
|
|
|
|
-# location = str(Path(location).resolve())
|
|
|
|
-#
|
|
|
|
-#
|
|
|
|
-# _bootstrap
|
|
|
|
-#
|
|
|
|
-# spec = _bootstrap.ModuleSpec(name, loader, origin=location)
|
|
|
|
-# spec._set_fileattr = True
|
|
|
|
-#
|
|
|
|
-# # Pick a loader if one wasn't provided.
|
|
|
|
-# if loader is None:
|
|
|
|
-# for loader_class, suffixes in _get_supported_file_loaders():
|
|
|
|
-# if location.endswith(tuple(suffixes)):
|
|
|
|
-# loader = loader_class(name, location)
|
|
|
|
-# spec.loader = loader
|
|
|
|
-# break
|
|
|
|
-# else:
|
|
|
|
-# return None
|
|
|
|
-#
|
|
|
|
-# # Set submodule_search_paths appropriately.
|
|
|
|
-# if submodule_search_locations is _POPULATE:
|
|
|
|
-# # Check the loader.
|
|
|
|
-# if hasattr(loader, 'is_package'):
|
|
|
|
-# try:
|
|
|
|
-# is_package = loader.is_package(name)
|
|
|
|
-# except ImportError:
|
|
|
|
-# pass
|
|
|
|
-# else:
|
|
|
|
-# if is_package:
|
|
|
|
-# spec.submodule_search_locations = []
|
|
|
|
-# else:
|
|
|
|
-# spec.submodule_search_locations = submodule_search_locations
|
|
|
|
-# if spec.submodule_search_locations == []:
|
|
|
|
-# if location:
|
|
|
|
-# dirname = _path_split(location)[0]
|
|
|
|
-# spec.submodule_search_locations.append(dirname)
|
|
|
|
-#
|
|
|
|
-# return spec
|
|
|
|
-
|
|
|
|
class LoaderContext:
|
|
class LoaderContext:
|
|
|
|
|
|
def __init__(self, suffix):
|
|
def __init__(self, suffix):
|