comparison tools/pkg-install.py @ 4084:fc806c8583a9

install: remove old octave pakages during intall of pkg * dist-files.mk: add pkg-install.py * tools/pkg-install.py: add uninstall implmentation and call from install
author John Donoghue <john.donoghue@ieee.org>
date Sat, 30 Jan 2016 08:17:24 -0500
parents bdcddfdc57d0
children 3e78f9bcd779
comparison
equal deleted inserted replaced
4083:ab391f476b81 4084:fc806c8583a9
4 import re 4 import re
5 import tempfile 5 import tempfile
6 import shutil 6 import shutil
7 import fnmatch 7 import fnmatch
8 import subprocess 8 import subprocess
9 import glob
9 10
10 class Env: 11 class Env:
11 mkoctfile = "mkoctfile"; 12 mkoctfile = "mkoctfile";
12 octave_config = "octave-config"; 13 octave_config = "octave-config";
13 make = "make" 14 make = "make"
262 # lines = f.read().splitlines() 263 # lines = f.read().splitlines()
263 # currently doing nothing for adding, will let installer do 264 # currently doing nothing for adding, will let installer do
264 pass 265 pass
265 266
266 def uninstall_pkg(pkg,env): 267 def uninstall_pkg(pkg,env):
268 # uninstall existing directories
269
270 files=glob.glob(env.prefix + "/share/octave/packages/" + env.pkg + "-" + "*")
271 for f in files:
272 print "removing dir " + f
273 shutil.rmtree(f)
274
275 files=glob.glob(env.prefix + "/lib/octave/packages/" + env.pkg + "-" + "*")
276 for f in files:
277 print "removing dir " + f
278 shutil.rmtree(f)
279
267 pass 280 pass
268 281
269 def install_pkg(pkg, env): 282 def install_pkg(pkg, env):
270 pkg = os.path.abspath(pkg) 283 pkg = os.path.abspath(pkg)
271 currdir = os.getcwd() 284 currdir = os.getcwd()
298 env.pkg = desc['Name'].lower() 311 env.pkg = desc['Name'].lower()
299 env.m_dir = env.prefix + "/share/octave/packages/" + env.pkg + "-" + desc['Version']; 312 env.m_dir = env.prefix + "/share/octave/packages/" + env.pkg + "-" + desc['Version'];
300 env.arch_dir = env.prefix + "/lib/octave/packages/" + env.pkg + "-" + desc['Version'] + "/" + env.arch + "-" + env.apiversion 313 env.arch_dir = env.prefix + "/lib/octave/packages/" + env.pkg + "-" + desc['Version'] + "/" + env.arch + "-" + env.apiversion
301 314
302 configure_make (env, packdir) 315 configure_make (env, packdir)
316
317 # uninstall old packages
318 uninstall_pkg(pkg, env)
303 319
304 # install package files 320 # install package files
305 copy_files(env, packdir) 321 copy_files(env, packdir)
306 create_pkgadddel (env, packdir, "PKG_ADD"); 322 create_pkgadddel (env, packdir, "PKG_ADD");
307 create_pkgadddel (env, packdir, "PKG_DEL"); 323 create_pkgadddel (env, packdir, "PKG_DEL");