[jhbuild: 27/27] [config, tests] factor out update_build_targets to be used from mock object



commit e52857cc2d63f91afdbfb7e56ecff0a16be6baed
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat May 16 15:32:44 2009 +0200

    [config,tests] factor out update_build_targets to be used from mock object
---
 jhbuild/config.py |    4 +++-
 tests/mock.py     |    6 +++++-
 tests/tests.py    |   15 +--------------
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/jhbuild/config.py b/jhbuild/config.py
index aab4cbe..ed8534d 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -343,6 +343,9 @@ class Config:
                     valarr.remove(x)
             os.environ['LD_PRELOAD'] = ' '.join(valarr)
 
+        self.update_build_targets()
+
+    def update_build_targets(self):
         # update build targets according to old flags
         if self.makecheck and not 'check' in self.build_targets:
             self.build_targets.insert(0, 'check')
@@ -353,7 +356,6 @@ class Config:
             for phase in ('configure', 'build', 'check', 'clean', 'install'):
                 if phase in self.build_targets:
                     self.build_targets.remove(phase)
-            self.build_targets.remove('install')
             self.build_targets.append('checkout')
         if self.makedist and not 'dist' in self.build_targets:
             self.build_targets.append('dist')
diff --git a/tests/mock.py b/tests/mock.py
index f78c279..ae42908 100644
--- a/tests/mock.py
+++ b/tests/mock.py
@@ -23,8 +23,9 @@ import time
 import jhbuild.frontends.buildscript
 import jhbuild.versioncontrol
 import jhbuild.errors
+import jhbuild.config
 
-class Config:
+class Config(jhbuild.config.Config):
     buildroot = '/tmp/'
     builddir_pattern = '%s'
     use_lib64 = False
@@ -54,6 +55,9 @@ class Config:
 
     prefix = '/tmp/'
 
+    def __init__(self):
+        pass
+
 
 class PackageDB:
     time_delta = 0
diff --git a/tests/tests.py b/tests/tests.py
index cc0a571..73eed1a 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -198,20 +198,7 @@ class BuildTestCase(unittest.TestCase):
         self.config.build_targets = ['install', 'test']
         for k in kwargs:
             setattr(self.config, k, kwargs[k])
-
-        if self.config.makecheck and not 'check' in self.config.build_targets:
-            self.config.build_targets.insert(0, 'check')
-        if self.config.makeclean and not 'clean' in self.config.build_targets:
-            self.config.build_targets.insert(0, 'clean')
-        if self.config.nobuild:
-            for phase in ('configure', 'build', 'check', 'clean', 'install'):
-                if phase in self.config.build_targets:
-                    self.config.build_targets.remove(phase)
-            self.config.build_targets.append('checkout')
-        if self.config.makedist and not 'dist' in self.config.build_targets:
-            self.config.build_targets.append('dist')
-        if self.config.makedistcheck and not 'distcheck' in self.config.build_targets:
-            self.config.build_targets.append('distcheck')
+        self.config.update_build_targets()
 
         if not self.buildscript or packagedb_params:
             self.buildscript = mock.BuildScript(self.config, self.modules)



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