57 Main function to execute the script.
60 for __package
in list(filter(
None, __pyx_dependency)):
63 if __package.lower() ==
"perl":
65 elif __package.lower() ==
"latex":
66 package_name =
"MikTeX"
67 elif __package.lower() ==
"pandoc":
68 package_name =
"Pandoc"
69 elif __package.lower() ==
"chocolatey":
71 if not Utility.GetExecutable(
"choco")
and not os.path.exists(os.path.join(Build.__path__[0],
"bin",__package)):
74 print(
'==================================')
75 print(
'%s is required for the current process, but is' % __package.upper())
76 print(
'not found on your machine.')
77 print(
'Installing dependency. This might take a while.. ')
78 print(
'==================================')
81 __pyx_ps_delimn =
" "; __pyx_package = os.path.join(Build.__path__[0],
"bin",__package.lower());
82 Utility.Popen([
"powershell.exe", __pyx_ps_delimn.join([os.path.join(Build.__path__[0],
"config",
"stm_choco.ps1"),__pyx_package])], verbosity=2, shell=
False);
85 raise NotImplementedError
88 __pyx_url_delimn =
"/"; __pyx_point =
"."; __pyx_space =
" ";
89 __pyx_package_url = __pyx_url_delimn.join([
"https:",
"",
"jenkins.fa-services.intra.dlr.de",
"job",
"STM_Archive",
"lastSuccessfulBuild",
"artifact",
"Archive", __pyx_point.join([package_name,
"zip"])])
92 __pyx_zip_file = __pyx_package_url.rsplit(__pyx_url_delimn, 1)[-1].lower()
93 __pyx_package = os.path.join(Build.__path__[0],
"bin",__pyx_zip_file.split(
".")[0])
94 __pyx_source = __pyx_zip_file.split(
".")[0]
97 devnull = open(os.devnull,
'w')
98 atexit.register(devnull.close)
102 subprocess.check_call([__package.lower(),
"--help"], stdout=devnull, stderr=subprocess.STDOUT)
105 if __debug__
and not os.path.exists(__pyx_package):
108 print(
'==================================')
109 print(
'%s is required for the current process, but is' % __package.upper())
110 print(
'not found on your machine.')
111 print(
'Fetching portable installation from STM archive. ')
112 print(
'==================================')
115 download_path = os.path.join(os.path.expanduser(
'~/Downloads'), __pyx_zip_file)
116 urllib.request.urlretrieve(__pyx_package_url, download_path)
119 with zipfile.ZipFile(download_path,
'r')
as zip_folder:
120 zip_folder.extractall(__pyx_package)
123 if __package.lower() ==
"latex":
125 __url_delimn =
"/"; __git_server_access =
"gitlab.dlr.de"
128 __templates_package = os.path.join(__pyx_package,
"user",
"RM_LaTeX")
129 __templates_repo = __url_delimn.join([
"https:",
"",__git_server_access,
"innersource",
"latex-templates.git"])
132 if not os.path.exists(__templates_package):
133 print(
"==================================")
134 print(
"Installing %s from GIT repository" %
"DLR LaTeX")
135 print(
"==================================")
138 if not os.path.exists(os.path.dirname(__templates_package)):
139 os.mkdir(os.path.dirname(__templates_package))
141 g = git.Repo.clone_from(__templates_repo, __templates_package)
146 print(
'==================================')
147 print(
'Successfully installed %s' % __package.upper())
148 print(
'==================================')
151 os.remove(download_path)
155 if os.path.exists(__pyx_package):
158 if os.path.exists(os.path.join(__pyx_package,__pyx_source,
"site",
"bin")):
159 pathlist.extend([os.path.join(__pyx_package,__pyx_source,
"site",
"bin"),os.path.join(__pyx_package,__pyx_source,
"bin"),os.path.join(__pyx_package,
"c",
"bin")])
161 elif os.path.exists(os.path.join(__pyx_package,
"texmfs",
"install",__pyx_source,
"bin",
"x64")):
162 pathlist.append(os.path.join(__pyx_package,
"texmfs",
"install",__pyx_source,
"bin",
"x64"))
165 pathlist.append(__pyx_package)
167 os.environ[
"PATH"] += os.pathsep + os.pathsep.join(pathlist)
170 assert Utility.Popen(__pyx_space.join([__package,
"--help"]),0).returncode == 0