55
66
77def usage ():
8- print ('Web installer build script' )
9- print ('build.py <installer version> <tag version>' )
10- print ('The installer verison is the version number used within the conda constructor script' )
11- print ('The tag verison is the version of cadquery that will be pulled from github' )
8+ print ("Web installer build script" )
9+ print ("build.py <installer version> <tag version>" )
10+ print (
11+ "The installer verison is the version number used within the conda constructor script"
12+ )
13+ print ("The tag verison is the version of cadquery that will be pulled from github" )
14+
1215
1316def write_file (destpath , contents ):
14- with open (destpath , "w" ) as destfile :
15- destfile .write (contents )
17+ with open (destpath , "w" ) as destfile :
18+ destfile .write (contents )
19+
1620
1721def run_cmd (cmdarray , workingdir , captureout = False ):
1822 stdout = stderr = None
1923 if captureout :
2024 stdout = stderr = subprocess .PIPE
21- proc = subprocess .Popen (cmdarray , cwd = workingdir , stdout = stdout , stderr = stderr , universal_newlines = True )
25+ proc = subprocess .Popen (
26+ cmdarray , cwd = workingdir , stdout = stdout , stderr = stderr , universal_newlines = True
27+ )
2228 proc_out , proc_err = proc .communicate ()
2329 if proc .returncode != 0 :
24- raise RuntimeError (' Failure to run command' )
30+ raise RuntimeError (" Failure to run command" )
2531 return stdout , stderr
2632
33+
2734def generate_templates (installer_version , tag_version ):
28- print ('Generating Scripts' )
29- env = Environment (
30- loader = FileSystemLoader ("." ),
31- autoescape = select_autoescape ()
32- )
35+ print ("Generating Scripts" )
36+ env = Environment (loader = FileSystemLoader ("." ), autoescape = select_autoescape ())
3337
3438 template = env .get_template ("construct.yaml.jinja2" )
3539 output = template .render (installer_version = installer_version )
36- write_file (' construct.yaml' , output )
40+ write_file (" construct.yaml" , output )
3741
3842 template = env .get_template ("post-install.bat.jinja2" )
3943 output = template .render (tag_version = tag_version )
40- write_file (' post-install.bat' , output )
44+ write_file (" post-install.bat" , output )
4145
4246 template = env .get_template ("post-install.sh.jinja2" )
4347 output = template .render (tag_version = tag_version )
44- write_file (' post-install.sh' , output )
48+ write_file (" post-install.sh" , output )
4549
4650
4751def run_constructor ():
48- print (' Running constructor' )
52+ print (" Running constructor" )
4953 scriptdir = os .path .dirname (os .path .realpath (__file__ ))
5054 builddir = os .path .join (scriptdir , 'build' )
5155 if not os .path .exists (builddir ):
5256 os .makedirs (builddir )
5357 run_cmd (['constructor' , scriptdir ], builddir )
5458
55- # TODO
5659
5760def main ():
5861 if len (sys .argv ) < 2 :
@@ -63,4 +66,5 @@ def main():
6366 generate_templates (installer_version , tag_version )
6467 run_constructor ()
6568
69+
6670main ()
0 commit comments