About to break everything with a merge
[ipdf/code.git] / tools / build.py
1 #!/usr/bin/python
2
3 from common import *
4
5 import subprocess
6
7 def Build(binname):
8         global options
9         
10         tokens = binname.split("-")
11         transformations = "direct"
12         mpfr_prec = 23
13         if tokens[0] == "path":
14                 transformations = "path"
15                 tokens = tokens[1:]
16         elif tokens[0] == "cumul":
17                 transformations = "cumulative"
18                 tokens = tokens[1:]
19
20         realname = tokens[0]
21         realtype = options["real_names"].index(realname)
22         
23         mainreal = 0
24         pathreal = 0
25         if transformations == "direct":
26                 mainreal = realtype
27         else:
28                 pathreal = realtype # hackky.
29                 realtype = 1
30         
31         if realname == "mpfr":
32                 mpfr_prec = int(tokens[1])
33         
34         quadtree = "disabled"
35         if "qtree" in tokens:
36                 quadtree = "enabled"
37         
38         
39         if (os.system("make -C %s clean; make -C %s REALTYPE=%d MPFR_PRECISION=%d QUADTREE=%s CONTROLPANEL=disabled TRANSFORMATIONS=%s PATHREAL=%d" % (options["ipdf_src"], options["ipdf_src"], mainreal, mpfr_prec, quadtree, transformations, pathreal)) != 0):
40                 raise Exception("Make failed.")
41
42         os.rename(options["ipdf_bin"], options["local_bin"]+binname)
43
44
45 def BuildAll():
46         p = ProgressBar(len(options["tobuild"]))
47         print("Building: %s" % str(options["tobuild"]))
48         p.animate(0)
49         for (i,b) in enumerate(options["tobuild"]): #options["real_names"]:
50                 if b in options["ignore"]:
51                         continue
52                 #try:
53                 Build(b)
54                 options["built"] += [b]
55                 #except:
56                 #       display("Failed to build %s" % b)
57                 p.animate(i+1)
58
59 if __name__ == "__main__":
60         BuildAll()

UCC git Repository :: git.ucc.asn.au