gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r942313 - /gump/trunk/python/gump/core/model/project.py
Date Sat, 08 May 2010 05:34:55 GMT
Author: bodewig
Date: Sat May  8 05:34:54 2010
New Revision: 942313

URL: http://svn.apache.org/viewvc?rev=942313&view=rev
Log:
allow shell glob patterns to be used in artifact names - I'm tired of bumping version numbers

Modified:
    gump/trunk/python/gump/core/model/project.py

Modified: gump/trunk/python/gump/core/model/project.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/project.py?rev=942313&r1=942312&r2=942313&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/project.py (original)
+++ gump/trunk/python/gump/core/model/project.py Sat May  8 05:34:54 2010
@@ -21,6 +21,7 @@
 
 """
 
+import glob
 import os
 import sys
 import gump.util.process.command
@@ -35,7 +36,7 @@ from gump.core.model.misc import Jar, As
     AddressPair
 from gump.core.model.object import NamedModelObject
 from gump.core.model.state import REASON_CONFIG_FAILED, STATE_FAILED, \
-    STATE_PREREQ_FAILED
+    STATE_PREREQ_FAILED, REASON_MISSING_OUTPUTS
 from gump.core.model.stats import Statable, Statistics
 from gump.util import getIndent, getStringFromUnicode
 from gump.util.domutils import transferDomInfo, hasDomAttribute, \
@@ -107,6 +108,7 @@ class Project(NamedModelObject, Statable
         # Outputs (Jars, Assemblies)
         #
         self.outputs = {}
+        self.outputs_expanded = False
 
         #############################################################
         # Misc
@@ -280,8 +282,27 @@ class Project(NamedModelObject, Statable
         return False
 
     def getOutputs(self):
+        self.expand_outputs()
         return self.outputs.values()
 
+    def expand_outputs(self):
+        """ expands glob patterns in output names """
+        if self.built and not self.outputs_expanded:
+            for output in self.outputs.values():
+                path = output.getPath()
+                log.debug("glob expanding " + path)
+                expansions = glob.glob(path)
+                count = len(expansions)
+                if count > 1:
+                    self.changeState(STATE_FAILED, REASON_MISSING_OUTPUTS)
+                    self.addError(path + " matched " + count + "  files.")
+                elif count == 1:
+                    log.debug("replacing " + path + " with " + expansions[0])
+                    output.setPath(expansions[0])
+                else:
+                    log.debug("didn't find any match for " + path)
+            self.outputs_expanded = True
+
     def hasAnyOutputs(self):
         """
         Does this project generate outputs (currently JARs)



Mime
View raw message