changeset 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 ab391f476b81
children c25eb2c88594
files dist-files.mk tools/pkg-install.py
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Fri Jan 29 13:12:18 2016 -0500
+++ b/dist-files.mk	Sat Jan 30 08:17:24 2016 -0500
@@ -845,6 +845,7 @@
   install-sh \
   make-shared-from-static \
   patch-tool-mxe \
+  pkg-install.py \
   s3-fetch-and-sync \
   set-mxe-env.sh.in
 
--- a/tools/pkg-install.py	Fri Jan 29 13:12:18 2016 -0500
+++ b/tools/pkg-install.py	Sat Jan 30 08:17:24 2016 -0500
@@ -6,6 +6,7 @@
 import shutil
 import fnmatch
 import subprocess
+import glob
 
 class Env:
   mkoctfile = "mkoctfile";
@@ -264,6 +265,18 @@
   pass
   
 def uninstall_pkg(pkg,env):
+  # uninstall existing directories
+
+  files=glob.glob(env.prefix + "/share/octave/packages/" + env.pkg + "-" + "*")
+  for f in files:
+    print "removing dir " + f
+    shutil.rmtree(f)
+
+  files=glob.glob(env.prefix + "/lib/octave/packages/" + env.pkg + "-" + "*")
+  for f in files:
+    print "removing dir " + f
+    shutil.rmtree(f)
+
   pass
 
 def install_pkg(pkg, env):
@@ -301,6 +314,9 @@
 
     configure_make (env, packdir)
 
+    # uninstall old packages
+    uninstall_pkg(pkg, env)
+
     # install package files
     copy_files(env, packdir)
     create_pkgadddel (env, packdir, "PKG_ADD");