annotate tools/pkg-install.py @ 5494:898c27394c57

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