Fixed importing of variables modules. Now relative imports is available.

fixed #52
master
Иванов Денис 3 years ago
parent dbf841c689
commit 9e885e3045

@ -517,7 +517,9 @@ class VariableLoader:
self.ini_filler = NamespaceIniFiller()
self.variables_path = variables_path
self.variables_package = '.'.join(variables_path.split('/'))
self.variables_package = '.'.join(
variables_path[len(__file__) -
len('calculate/variables/loader.py'):].split('/'))
self.repository_map = repository_map
def load_variables_package(self, package_name: str) -> None:

@ -1,9 +1,14 @@
from calculate.variables.datavars import Variable, Namespace, Dependence, \
StringType, BooleanType, HashType, Calculate
from calculate.vars.main.os.func import *
from calculate.variables.datavars import (
Variable,
Namespace,
StringType,
Calculate
)
from .func import get_arch_machine, get_arch_gentoo
with Namespace("arch"):
Variable("machine", type=StringType,
source=Calculate(get_arch_machine))
source=Calculate(get_arch_machine))
Variable("gentoo", type=StringType,
source=Calculate(get_arch_gentoo, ".machine"))
source=Calculate(get_arch_gentoo, ".machine"))

Loading…
Cancel
Save