main.os.arch.machine текущая архитектуа (i686, i386, x86_64) main.os.arch.gentoo (x86, amd64) install.os.arch.machine install.os.arch.gentoomaster
parent
133ebdce00
commit
9842b85723
@ -0,0 +1,10 @@
|
|||||||
|
import os
|
||||||
|
from calculate.variables.datavars import Variable, Namespace, Dependence, \
|
||||||
|
StringType, BooleanType, HashType, Calculate, Copy
|
||||||
|
from calculate.vars.main.os.func import get_arch_gentoo
|
||||||
|
|
||||||
|
with Namespace("arch"):
|
||||||
|
Variable("machine", type=StringType,
|
||||||
|
source=Copy("main.os.arch.machine"))
|
||||||
|
Variable("gentoo", type=StringType,
|
||||||
|
source=Calculate(get_arch_gentoo, ".machine"))
|
@ -0,0 +1,9 @@
|
|||||||
|
from calculate.variables.datavars import Variable, Namespace, Dependence, \
|
||||||
|
StringType, BooleanType, HashType, Calculate
|
||||||
|
from .func import *
|
||||||
|
|
||||||
|
with Namespace("arch"):
|
||||||
|
Variable("machine", type=StringType,
|
||||||
|
source=Calculate(get_arch_machine))
|
||||||
|
Variable("gentoo", type=StringType,
|
||||||
|
source=Calculate(get_arch_gentoo, ".machine"))
|
@ -0,0 +1,14 @@
|
|||||||
|
import re
|
||||||
|
import platform
|
||||||
|
|
||||||
|
def get_arch_machine():
|
||||||
|
return platform.machine()
|
||||||
|
|
||||||
|
def get_arch_gentoo(arch_machine):
|
||||||
|
arch = arch_machine.value
|
||||||
|
if re.search("i.86", arch):
|
||||||
|
return "x86"
|
||||||
|
else:
|
||||||
|
return {
|
||||||
|
"x86_64": "amd64"
|
||||||
|
}.get(arch,arch)
|
Loading…
Reference in new issue