[jhbuild: 6/27] add uninstall targets to autotools and waf module types



commit 4a814da9b3e8b65092272635b481e2b42958ef55
Author: Frederic Peters <fpeters 0d be>
Date:   Tue May 5 17:05:54 2009 +0200

    add uninstall targets to autotools and waf module types
---
 jhbuild/modtypes/autotools.py |   17 +++++++++++++++++
 jhbuild/modtypes/waf.py       |    7 +++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 7722d36..afd1992 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -272,6 +272,23 @@ class AutogenModule(Package):
                     extra_env = self.extra_env)
     do_distclean.depends = [PHASE_CONFIGURE]
 
+    def skip_uninstall(self, buildscript, last_phase):
+        srcdir = self.get_srcdir(buildscript)
+        if not os.path.exists(srcdir):
+            return True
+        if not os.path.exists(os.path.join(srcdir, self.makefile)):
+            return True
+        return False
+
+    def do_uninstall(self, buildscript):
+        buildscript.set_action(_('Uninstalling'), self)
+        makeargs = self.makeargs + ' ' + self.config.module_makeargs.get(
+                self.name, self.config.makeargs)
+        cmd = '%s %s uninstall' % (os.environ.get('MAKE', 'make'), makeargs)
+        buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
+                extra_env = self.extra_env)
+        buildscript.packagedb.remove(self.name)
+
     def xml_tag_and_attrs(self):
         return ('autotools',
                 [('autogenargs', 'autogenargs', ''),
diff --git a/jhbuild/modtypes/waf.py b/jhbuild/modtypes/waf.py
index 4270af4..e9aa515 100644
--- a/jhbuild/modtypes/waf.py
+++ b/jhbuild/modtypes/waf.py
@@ -143,6 +143,13 @@ class WafModule(Package):
         buildscript.packagedb.add(self.name, self.get_revision() or '')
     do_install.depends = [PHASE_BUILD]
 
+    def do_uninstall(self, buildscript):
+        buildscript.set_action(_('Uninstalling'), self)
+        cmd = [self.waf_cmd, 'uninstall']
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+        buildscript.packagedb.remove(self.name)
+    do_install.depends = [PHASE_BUILD]
+
     def xml_tag_and_attrs(self):
         return 'waf', [('id', 'name', None),
                        ('waf-command', 'waf_cmd', 'waf')]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]