Debian Codegraph @

conda/web-installer/build.py

raw symbols SCIP
1 import sysscip-python python python-stdlib 3.11 sys/__init__:
2 import osscip-python python python-stdlib 3.11 os/__init__:
3 import subprocessscip-python python python-stdlib 3.11 subprocess/__init__:
4 from jinja2scip-python python cadquery 2.8.0.dev0 jinja2/__init__: import Environment, select_autoescape, FileSystemLoader
5
6
7 def usagescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/usage().():
8 printscip-python python python-stdlib 3.11 builtins/print().("Web installer build script")
9 printscip-python python python-stdlib 3.11 builtins/print().("build.py <installer version> <tag version>")
10 printscip-python python python-stdlib 3.11 builtins/print().(
11 "The installer verison is the version number used within the conda constructor script"
12 )
13 printscip-python python python-stdlib 3.11 builtins/print().("The tag verison is the version of cadquery that will be pulled from github")
14
15
16 def write_filescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().(destpathscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().(destpath), contentsscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().(contents)):
17 with openscip-python python python-stdlib 3.11 builtins/open().(destpathscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().(destpath), "w") as destfile:
18 destfile.writescip-python python python-stdlib 3.11 io/TextIOBase#write().(contentsscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().(contents))
19
20
21 def run_cmdscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(cmdarrayscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(cmdarray), workingdirscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(workingdir), captureoutscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(captureout)=False):
22 stdout = stderr = None
23 if captureoutscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(captureout):
24 stdout = stderr = subprocessscip-python python python-stdlib 3.11 subprocess/__init__:.PIPEscip-python python python-stdlib 3.11 subprocess/PIPE.PIPE.
25 proc = subprocessscip-python python python-stdlib 3.11 subprocess/__init__:.Popenscip-python python python-stdlib 3.11 subprocess/Popen#(
26 cmdarrayscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(cmdarray), cwd=workingdirscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(workingdir), stdout=stdout, stderr=stderr, universal_newlines=True
27 )
28 proc_out, proc_err = proc.communicatescip-python python python-stdlib 3.11 subprocess/Popen#communicate().()
29 if proc.returncodescip-python python python-stdlib 3.11 subprocess/Popen#returncode. != 0:
30 raise RuntimeErrorscip-python python python-stdlib 3.11 builtins/RuntimeError#("Failure to run command")
31 return stdout, stderr
32
33
34 def generate_templatesscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(installer_versionscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(installer_version), tag_versionscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(tag_version)):
35 printscip-python python python-stdlib 3.11 builtins/print().("Generating Scripts")
36 env = Environment(loader=FileSystemLoader("."), autoescape=select_autoescape())
37
38 template = env.get_template("construct.yaml.jinja2")
39 output = template.render(installer_version=installer_versionscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(installer_version))
40 write_filescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().("construct.yaml", output)
41
42 template = env.get_template("post-install.bat.jinja2")
43 output = template.render(tag_version=tag_versionscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(tag_version))
44 write_filescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().("post-install.bat", output)
45
46 template = env.get_template("post-install.sh.jinja2")
47 output = template.render(tag_version=tag_versionscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(tag_version))
48 write_filescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/write_file().("post-install.sh", output)
49
50
51 def run_constructorscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_constructor().():
52 printscip-python python python-stdlib 3.11 builtins/print().("Running constructor")
53 scriptdir = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..dirnamescip-python python python-stdlib 3.11 posixpath/split().(osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..realpathscip-python python python-stdlib 3.11 posixpath/split().(__file__scip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/))
54 builddir = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 posixpath/split().(scriptdir, "build")
55 if not osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 posixpath/split().(builddir):
56 osscip-python python python-stdlib 3.11 os/__init__:.makedirsscip-python python python-stdlib 3.11 os/makedirs().(builddir)
57 run_cmdscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_cmd().(["constructor", scriptdir], builddir)
58
59
60 def mainscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/main().():
61 if len(sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.) < 2:
62 usagescip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/usage().()
63 return
64 installer_version = sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.[1]
65 tag_version = sysscip-python python python-stdlib 3.11 sys/__init__:.argvscip-python python python-stdlib 3.11 sys/argv.argv.[2]
66 generate_templatesscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/generate_templates().(installer_version, tag_version)
67 run_constructorscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/run_constructor().()
68
69
70 mainscip-python python cadquery 2.8.0.dev0 `conda.web-installer.build`/main().()