Mercurial > mxe-octave
annotate tools/pkg-install.py @ 5210:4eae7db624e8
* tools/pkg-install.py: add rebuild command
author | John Donoghue |
---|---|
date | Tue, 19 Nov 2019 07:57:29 -0500 |
parents | eb8b37422e16 |
children | b6ca48619aa6 |
rev | line source |
---|---|
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
2 import sys |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
3 import os |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
4 import re |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
5 import tempfile |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
6 import shutil |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
7 import fnmatch |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
8 import subprocess |
4084
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
9 import glob |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
10 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
11 class Env: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
12 mkoctfile = "mkoctfile"; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
13 octave_config = "octave-config"; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
14 make = "make" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
15 verbose = True; |
4102 | 16 prefix = ""; |
17 pkg = ""; | |
5210 | 18 use_pkg_prefix = True; |
4102 | 19 arch = ""; |
20 tmp = "/tmp"; | |
21 apiversion = ""; | |
22 bin_dir = ""; | |
23 m_dir = ""; | |
24 arch_dir = ""; | |
25 cleanup = False; | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
26 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
27 def show_usage(): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
28 print sys.argv(0), "[options] pkg1 [pkg2]" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
29 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
30 def verify_directory(dirname): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
31 for f in [ "COPYING", "DESCRIPTION" ]: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
32 if os.path.isfile(dirname + "/" + f) == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
33 raise Exception, "package is missing file " + f |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
34 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
35 def get_description(descfile): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
36 with open(descfile, 'r') as f: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
37 lines = f.read().splitlines() |
5210 | 38 pat_match = re.compile("(?P<name>[-\w]+):\s*(?P<value>\w.*)") |
39 lineval = "" | |
40 d={} | |
41 for l in lines: | |
42 if len(l) > 0: | |
43 if (l[0] == ' ' or l[0] == '\t'): | |
44 lineval = lineval + l | |
45 else: | |
46 lineval = l | |
47 | |
48 e = pat_match.match(lineval) | |
49 if e: | |
50 d[e.group("name")] = e.group("value") | |
51 | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
52 return d |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
53 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
54 def extract_pkg(filename, nm): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
55 pkg = [] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
56 with open(filename, 'r') as f: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
57 lines = f.read().splitlines() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
58 for l in lines: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
59 so = re.search(nm, l, re.M|re.S) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
60 if so: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
61 pkg.append(str(so.group(1))) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
62 return pkg |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
63 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
64 def write_index_file(env, desc, index_nm): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
65 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
66 with open(index_nm, 'w') as f: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
67 files = os.listdir(env.m_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
68 classes = fnmatch.filter(files, "@*") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
69 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
70 # check classes |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
71 for c in classes: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
72 class_name = c |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
73 class_path = env.m_dir + "/" + c; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
74 if os.path.isdir(class_path) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
75 class_files = list(class_name + "/" + a for a in os.listdir(class_path)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
76 files += class_files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
77 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
78 # arch dependant |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
79 if os.path.exists(env.arch_dir) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
80 archfiles = os.listdir(env.arch_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
81 files += archfiles |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
82 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
83 functions = [] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
84 for a in files: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
85 if a.endswith(".m"): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
86 functions.append( str(a[0:len(a)-2]) ) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
87 elif a.endswith(".oct"): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
88 functions.append( str(a[0:len(a)-4]) ) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
89 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
90 f.write(env.pkg + " >> " + desc['Title'] + "\n"); |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
91 f.write(desc['Categories'].replace(",", " ") + "\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
92 for a in functions: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
93 f.write(" " + a + "\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
94 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
95 def finish_installation(env, packdir): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
96 # octave would run post_install.m here - instead we will copy the post_install.m |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
97 # somewhere and then on initial startup, run the post_install |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
98 if os.path.isfile(packdir + "/post_install.m") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
99 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
100 print "Copying .. post_install.m" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
101 destdir = env.prefix + "/share/octave/site/m/once_only" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
102 if os.path.exists(destdir) == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
103 os.makedirs(destdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
104 shutil.copy2(packdir + "/post_install.m", destdir + "/" + env.pkg + "-post_install.m") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
105 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
106 def create_pkgadddel (env, packdir, nm): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
107 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
108 print "Creating...", nm |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
109 |
4111
d53c492ab48d
pkg-install.py append to inst/PKG_ADD/DEL it it exists (Bug #47481)
John Donoghue
parents:
4102
diff
changeset
|
110 instfid = open(env.m_dir + "/" + nm, "a") |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
111 if os.path.exists(env.arch_dir) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
112 archfid = open(env.arch_dir + "/" + nm, "w") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
113 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
114 archfid = instfid |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
115 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
116 # search inst .m files for PKG_ commands |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
117 instdir = packdir + "/inst" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
118 files = list(instdir + "/" + a for a in os.listdir(instdir)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
119 m_files = fnmatch.filter(files, "*.m") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
120 for f in m_files: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
121 for a in extract_pkg(f, '^[#%][#%]* *' + nm + ': *(.*)$'): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
122 instfid.write("%s\n" % str(a)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
123 |
4111
d53c492ab48d
pkg-install.py append to inst/PKG_ADD/DEL it it exists (Bug #47481)
John Donoghue
parents:
4102
diff
changeset
|
124 # search src .cc files for PKG_ commands |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
125 if os.path.exists(packdir + "/src") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
126 srcdir = packdir + "/src" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
127 files = list(srcdir + "/" + a for a in os.listdir(srcdir)) |
4348
223b967a2d40
* tools/pkg-install.py: look for pkd add/del in .cpp and cxx files
John D
parents:
4238
diff
changeset
|
128 cc_files = fnmatch.filter(files, "*.cc") |
223b967a2d40
* tools/pkg-install.py: look for pkd add/del in .cpp and cxx files
John D
parents:
4238
diff
changeset
|
129 cpp_files = fnmatch.filter(files, "*.cpp") |
223b967a2d40
* tools/pkg-install.py: look for pkd add/del in .cpp and cxx files
John D
parents:
4238
diff
changeset
|
130 cxx_files = fnmatch.filter(files, "*.cxx") |
223b967a2d40
* tools/pkg-install.py: look for pkd add/del in .cpp and cxx files
John D
parents:
4238
diff
changeset
|
131 for f in cc_files + cpp_files + cxx_files: |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
132 for a in extract_pkg(f, '^//* *' + nm + ': *(.*)$'): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
133 archfid.write("%s\n" % str(a)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
134 for a in extract_pkg(f, '^/\** *' + nm + ': *(.*) *\*/$'): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
135 archfid.write("%s\n" % a) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
136 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
137 # add PKG_XXX from packdir if exists |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
138 if os.path.isfile(packdir + "/" + nm) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
139 with open(packdir + "/" + nm, 'r') as f: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
140 lines = f.read().splitlines() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
141 for a in lines: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
142 archfid.write("%s\n" % a) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
143 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
144 # close files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
145 if archfid != instfid: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
146 archfid.close() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
147 if os.stat(env.arch_dir + "/" + nm).st_size == 0: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
148 os.remove(env.arch_dir + "/" + nm) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
149 instfid.close() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
150 if os.stat(env.m_dir + "/" + nm).st_size == 0: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
151 os.remove(env.m_dir + "/" + nm) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
152 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
153 def generate_lookfor_cache (env): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
154 # TODO create doc-cache |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
155 pass |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
156 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
157 def copyfile(files, destdir): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
158 if os.path.exists(destdir) == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
159 os.mkdir(destdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
160 for a in files: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
161 if os.path.isfile(a): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
162 shutil.copy2(a, destdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
163 if os.path.isdir(a): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
164 name= os.path.basename(a) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
165 morefiles=(a + "/" + b for b in os.listdir(a)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
166 copyfile(morefiles, destdir + "/" + name) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
167 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
168 def copy_files(env, pkgdir): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
169 if os.path.exists(env.m_dir) == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
170 os.makedirs(env.m_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
171 instdir = pkgdir + "/inst" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
172 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
173 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
174 print "Copying m files ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
175 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
176 files = list(instdir + "/" + a for a in os.listdir(instdir)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
177 # filter for arch folder |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
178 if os.path.exists(instdir + "/" + env.arch) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
179 files.remove(instdir + "/" + env.arch) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
180 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
181 copyfile(files, env.m_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
182 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
183 if os.path.exists(instdir + "/" + env.arch) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
184 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
185 print "Copying arch files ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
186 files = list(instdir + "/" + env.arch + "/" + a for a in os.listdir(instdir + "/" + env.arch)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
187 if len(files) > 0: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
188 if os.path.exists(env.arch_dir) == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
189 os.makedirs(env.arch_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
190 copyfile(files, env.arch_dir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
191 shutil.rmtree(instdir + "/" + env.arch) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
192 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
193 # packinfo |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
194 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
195 print "Copying packinfo files ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
196 if os.path.exists(env.m_dir + "/packinfo") == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
197 os.makedirs(env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
198 copyfile([pkgdir + "/DESCRIPTION"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
199 copyfile([pkgdir + "/COPYING"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
200 copyfile([pkgdir + "/CITATION"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
201 copyfile([pkgdir + "/NEWS"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
202 copyfile([pkgdir + "/ONEWS"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
203 copyfile([pkgdir + "/ChangeLog"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
204 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
205 # index file |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
206 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
207 print "Copying/creating INDEX ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
208 if os.path.isfile(pkgdir + "/INDEX") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
209 copyfile([pkgdir + "/INDEX"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
210 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
211 desc = get_description(pkgdir + "/DESCRIPTION") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
212 write_index_file(env, desc, env.m_dir + "/packinfo/INDEX") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
213 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
214 copyfile([pkgdir + "on_uninstall.m"], env.m_dir + "/packinfo") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
215 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
216 # doc dir ? |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
217 docdir = pkgdir + "/doc" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
218 if os.path.exists(docdir) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
219 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
220 print "Copying doc files ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
221 files = (docdir + "/" + a for a in os.listdir(docdir)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
222 copyfile(files, env.m_dir + "/doc") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
223 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
224 # bin dir ? |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
225 bindir = pkgdir + "/bin" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
226 if os.path.exists(bindir) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
227 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
228 print "Copying bin files ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
229 files = (bindir + "/" + a for a in os.listdir(bindir)) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
230 copyfile(files, env.m_dir + "/bin") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
231 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
232 def configure_make(env, packdir): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
233 if os.path.isdir(packdir + "/inst") == False: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
234 os.mkdir(packdir + "/inst") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
235 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
236 if os.path.isdir(packdir + "/src") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
237 src = packdir + "/src" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
238 os.chdir(src) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
239 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
240 if os.path.isfile(src + "/configure") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
241 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
242 print "running ./configure " + env.config_opts |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
243 |
4238
bdcbb82d57e2
pkg-install.py: fail pkg build if configure fails (Bug #49503)
John D
parents:
4111
diff
changeset
|
244 if os.system("./configure " + env.config_opts + "") != 0: |
bdcbb82d57e2
pkg-install.py: fail pkg build if configure fails (Bug #49503)
John D
parents:
4111
diff
changeset
|
245 raise Exception, "configure failed - stopping install" |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
246 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
247 if os.path.isfile(src + "/Makefile") == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
248 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
249 print "running make ..." |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
250 if os.system(env.make + " --directory '" + src + "'" ) != 0: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
251 raise Exception, "make failed during build - stopping install" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
252 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
253 # copy files to inst and inst arch |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
254 files = src + "/FILES" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
255 instdir = packdir + "/inst" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
256 archdir = instdir + "/" + env.arch |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
257 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
258 if os.path.isfile(files) == True: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
259 pass # TODO yet |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
260 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
261 # get .m, .oct and .mex files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
262 files = os.listdir(src) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
263 m_files = fnmatch.filter(files, "*.m") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
264 mex_files = fnmatch.filter(files, "*.mex") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
265 oct_files = fnmatch.filter(files, "*.oct") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
266 files = m_files + mex_files + oct_files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
267 files = list(src + "/" + s for s in files) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
268 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
269 # split files into arch and non arch files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
270 archdependant = fnmatch.filter(files, "*.mex") + fnmatch.filter(files,"*.oct") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
271 archindependant = list( x for x in files if x not in archdependant ) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
272 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
273 # copy the files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
274 copyfile(archindependant, instdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
275 copyfile(archdependant, archdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
276 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
277 def add_package_list(env, desc): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
278 #pkglist = env.prefix + "/share/octave/octave_packages" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
279 #with open(pkglist, 'r') as f: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
280 # lines = f.read().splitlines() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
281 # currently doing nothing for adding, will let installer do |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
282 pass |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
283 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
284 def uninstall_pkg(pkg,env): |
4084
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
285 # uninstall existing directories |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
286 |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
287 files=glob.glob(env.prefix + "/share/octave/packages/" + env.pkg + "-" + "*") |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
288 for f in files: |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
289 print "removing dir " + f |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
290 shutil.rmtree(f) |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
291 |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
292 files=glob.glob(env.prefix + "/lib/octave/packages/" + env.pkg + "-" + "*") |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
293 for f in files: |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
294 print "removing dir " + f |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
295 shutil.rmtree(f) |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
296 |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
297 pass |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
298 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
299 def install_pkg(pkg, env): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
300 pkg = os.path.abspath(pkg) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
301 currdir = os.getcwd() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
302 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
303 try: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
304 ## Check that the directory in prefix exist. If it doesn't: create it! |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
305 tmpdir = tempfile.mkdtemp("-pkg","tmp", env.tmp) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
306 os.chdir(tmpdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
307 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
308 # unpack dir |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
309 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
310 os.system("tar xzvf '" + pkg + "'") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
311 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
312 os.system("tar xzf '" + pkg + "'") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
313 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
314 # get list for files creates |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
315 files=os.listdir(tmpdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
316 if len(files) != 1: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
317 print "Expected to unpack to only one directory" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
318 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
319 packdir = os.path.abspath(files[0]) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
320 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
321 # verify have expected min files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
322 verify_directory(packdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
323 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
324 # read the description file |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
325 desc = get_description(packdir + "/DESCRIPTION") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
326 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
327 # make the path names |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
328 env.pkg = desc['Name'].lower() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
329 env.m_dir = env.prefix + "/share/octave/packages/" + env.pkg + "-" + desc['Version']; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
330 env.arch_dir = env.prefix + "/lib/octave/packages/" + env.pkg + "-" + desc['Version'] + "/" + env.arch + "-" + env.apiversion |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
331 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
332 configure_make (env, packdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
333 |
4084
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
334 # uninstall old packages |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
335 uninstall_pkg(pkg, env) |
fc806c8583a9
install: remove old octave pakages during intall of pkg
John Donoghue <john.donoghue@ieee.org>
parents:
4067
diff
changeset
|
336 |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
337 # install package files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
338 copy_files(env, packdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
339 create_pkgadddel (env, packdir, "PKG_ADD"); |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
340 create_pkgadddel (env, packdir, "PKG_DEL"); |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
341 finish_installation(env, packdir) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
342 generate_lookfor_cache (env); |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
343 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
344 # update package list |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
345 add_package_list(env, desc) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
346 finally: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
347 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
348 print "cleaning up" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
349 os.chdir(currdir) |
4102 | 350 |
351 if env.cleanup: | |
352 shutil.rmtree(tmpdir) | |
5210 | 353 |
354 def fix_depends(deps): | |
355 deplist = [s.strip() for s in deps.split(",") if len(s.strip()) > 0] | |
356 deppat = re.compile('\s*(?P<name>[-\w]+)\s*(\(\s*(?P<op>[<>=]+)\s*(?P<ver>\d+\.\d+(\.\d+)*)\s*\))*\s*') | |
357 deps = [] | |
358 for d in deplist: | |
359 e = deppat.match(d) | |
360 name = e.group("name") | |
361 ver = e.group("ver") | |
362 | |
363 if ver: | |
364 op = e.group("op") | |
365 else: | |
366 op = ">=" | |
367 ver = "0.0.0" | |
368 | |
369 deps.append({"package": name, "operator": op, "version": ver}) | |
370 | |
371 return deps | |
372 | |
373 def rebuild_pkg(env): | |
374 currdir = os.getcwd() | |
375 | |
376 try: | |
377 oct_dir = env.prefix + "/share/octave" | |
378 pkg_dir = oct_dir + "/packages" | |
379 arch_dir = env.prefix + "/lib/octave/packages" | |
380 | |
381 pkg_list_file = oct_dir + "/octave_packages" | |
382 | |
383 descs=glob.glob(pkg_dir + "/*/packinfo/DESCRIPTION") | |
384 | |
385 with open(pkg_list_file, "w") as f: | |
386 f.write("# Created by pkg-install.py\n") | |
387 f.write("# name: global_packages\n") | |
388 f.write("# type: cell\n"); | |
389 f.write("# rows: 1\n") | |
390 f.write("# columns: {}\n".format(len(descs))) | |
391 | |
392 for d in descs: | |
393 pkg = d[len(pkg_dir):-len("/packinfo/DESCRIPTION")] | |
394 if env.verbose: | |
395 print "Rebuilding {}".format(pkg) | |
396 desc = get_description(d) | |
397 desc["Name"] = desc["Name"].lower() | |
398 desc["Depends"] = fix_depends(desc.get("Depends","")) | |
399 | |
400 f.write("# name: <cell-element>\n"); | |
401 f.write("# type: scalar struct\n"); | |
402 f.write("# ndims: 2\n"); | |
403 f.write(" 1 1\n"); | |
404 f.write("# length: 13\n"); | |
405 | |
406 pkg_fields = [ "Name", "Version", "Date", "Author", "Maintainer", \ | |
407 "Title", "Description", "Depends", "Autoload", "License" ] | |
408 for field in pkg_fields: | |
409 name = field.lower() | |
410 value = desc.get(field, None) | |
411 if value is None: | |
412 if name == "autoload": | |
413 value = "no" | |
414 else: | |
415 value = "not set" | |
416 | |
417 f.write("# name: {}\n".format(name)) | |
418 if name == "depends": | |
419 f.write("# type: cell\n") | |
420 f.write("# rows: 1\n") | |
421 f.write("# columns: {}\n".format(len(value))) | |
422 dep_fields = [ "package", "operator", "version" ] | |
423 for dep in value: | |
424 f.write("# name: <cell-element>\n") | |
425 f.write("# type: scalar struct\n") | |
426 f.write("# ndims: 2\n") | |
427 f.write(" 1 1\n"); | |
428 f.write("# length: 3\n"); | |
429 | |
430 for df in dep_fields: | |
431 val = dep.get(df) | |
432 f.write("# name: {}\n".format(df)) | |
433 f.write("# type: sq_string\n") | |
434 f.write("# elements: 1\n") | |
435 f.write("# length: {}\n".format(len(str(val)))) | |
436 f.write("{}\n".format(str(val))) | |
437 f.write("\n\n"); | |
438 | |
439 f.write("\n\n"); | |
440 else: | |
441 f.write("# type: sq_string\n") | |
442 f.write("# elements: 1\n") | |
443 f.write("# length: {}\n".format(len(str(value)))) | |
444 f.write("{}\n".format(str(value))) | |
445 | |
446 f.write("\n\n"); | |
447 | |
448 f.write("# name: loaded\n") | |
449 f.write("# type: bool\n") | |
450 f.write("0\n") | |
451 f.write("\n\n"); | |
452 | |
453 name = "dir" | |
454 if env.use_pkg_prefix: | |
455 value = "__OH__/share/octave/packages" + pkg | |
456 else: | |
457 value = pkg_dir + pkg | |
458 | |
459 f.write("# name: {}\n".format(name)) | |
460 f.write("# type: sq_string\n") | |
461 f.write("# elements: 1\n") | |
462 f.write("# length: {}\n".format(len(str(value)))) | |
463 f.write("{}\n".format(str(value))) | |
464 f.write("\n\n"); | |
465 | |
466 name = "archprefix" | |
467 if env.use_pkg_prefix: | |
468 value = "__OH__/lib/octave/packages" + pkg | |
469 else: | |
470 value = arch_dir + pkg | |
471 f.write("# name: {}\n".format(name)) | |
472 f.write("# type: sq_string\n") | |
473 f.write("# elements: 1\n") | |
474 f.write("# length: {}\n".format(len(str(value)))) | |
475 f.write("{}\n".format(str(value))) | |
476 f.write("\n\n"); | |
477 finally: | |
478 os.chdir(currdir) | |
479 | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
480 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
481 def pkg (args): |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
482 arch = '' |
5210 | 483 operation = "install" |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
484 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
485 env = Env() |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
486 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
487 files = [] |
5210 | 488 |
489 operation = args[0] | |
490 if operation != "install" and operation != "rebuild": | |
491 raise Exception, "Expected pkg operation 'install' or 'rebuild'" | |
492 | |
493 | |
494 args = args[1:] | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
495 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
496 for a in args: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
497 c=a.split("=") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
498 key=c[0] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
499 if len(c) > 1: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
500 val=c[1] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
501 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
502 val="" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
503 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
504 if key == "-verbose": |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
505 env.verbose = True; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
506 elif key == "--verbose": |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
507 env.verbose = True; |
5210 | 508 elif key == "--no-pkg-prefix": |
509 env.use_pkg_prefix = False; | |
4102 | 510 elif key == "-no-cleanup": |
511 env.cleanup = False; | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
512 elif val == "": |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
513 files.append(key) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
514 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
515 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
516 if os.environ.get("OCTAVE_CONFIG") != None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
517 env.octave_config = os.environ["OCTAVE_CONFIG"] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
518 if os.environ.get("MAKE") != None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
519 env.make = os.environ["MAKE"] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
520 if os.environ.get("MKOCTFILE") != None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
521 env.mkoctfile = os.environ["MKOCTFILE"] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
522 if os.environ.get("TMP") != None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
523 env.tmp = os.environ["TMP"] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
524 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
525 if env.verbose: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
526 env.mkoctfile = env.mkoctfile + " --verbose" |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
527 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
528 # make sure we have these set up in env |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
529 os.environ['OCTAVE_CONFIG'] = env.octave_config; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
530 os.environ['MAKE'] = env.make; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
531 os.environ['MKOCTFILE'] = env.mkoctfile; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
532 os.environ['TMP'] = env.tmp; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
533 os.environ['OCTAVE'] = 'echo'; |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
534 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
535 if os.environ.get("CC") == None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
536 os.environ['CC'] = os.popen(env.mkoctfile + " -p CC").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
537 if os.environ.get("CXX") == None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
538 os.environ['CXX'] = os.popen(env.mkoctfile + " -p CXX").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
539 if os.environ.get("AR") == None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
540 os.environ['AR'] = os.popen(env.mkoctfile + " -p AR").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
541 if os.environ.get("RANLIB") == None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
542 os.environ['RANLIB'] = os.popen(env.mkoctfile + " -p RANLIB").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
543 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
544 if os.environ.get("CONFIGURE_OPTIONS") != None: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
545 env.config_opts = os.environ['CONFIGURE_OPTIONS'] |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
546 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
547 # work out what arch is etc from mkoctfile/config |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
548 if env.prefix == "": |
4408
eb8b37422e16
pkg-install.py: Check for OCTAVE_HOME, then PREFIX.
John W. Eaton <jwe@octave.org>
parents:
4349
diff
changeset
|
549 env.prefix = os.popen(env.octave_config + " -p OCTAVE_HOME").read().rstrip("\r\n") |
eb8b37422e16
pkg-install.py: Check for OCTAVE_HOME, then PREFIX.
John W. Eaton <jwe@octave.org>
parents:
4349
diff
changeset
|
550 if env.prefix == "": |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
551 env.prefix = os.popen(env.octave_config + " -p PREFIX").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
552 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
553 env.arch = os.popen(env.octave_config + " -p CANONICAL_HOST_TYPE").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
554 env.apiversion = os.popen(env.octave_config + " -p API_VERSION").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
555 env.bindir = os.popen(env.octave_config + " -p BINDIR").read().rstrip("\r\n") |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
556 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
557 if env.verbose: |
5210 | 558 print "operation=", operation |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
559 print "mkoctfile=", env.mkoctfile |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
560 print "arch=", env.arch |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
561 print "apiversion=", env.apiversion |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
562 print "prefix=", env.prefix |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
563 print "files=", files |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
564 print "verbose=", env.verbose |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
565 |
5210 | 566 if operation == "install": |
567 for a in files: | |
568 install_pkg(a, env) | |
569 # rebuild pkg list afterwards | |
570 rebuild_pkg(env) | |
571 else: | |
572 rebuild_pkg(env) | |
4067
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
573 return 0 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
574 |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
575 if __name__ == "__main__": |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
576 if len(sys.argv) > 1: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
577 pkg(sys.argv[1:]) |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
578 else: |
bdcddfdc57d0
Install binary of-* packages
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
579 show_usage() |