You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2010/06/14 06:38:00 UTC
svn commit: r954359 - in /gump/live: ./ python/gump/core/build/nant.py
python/gump/core/run/gumpenv.py python/gump/core/update/bzr.py
python/gump/core/update/darcs.py python/gump/core/update/git.py
python/gump/core/update/hg.py
Author: bodewig
Date: Mon Jun 14 04:37:59 2010
New Revision: 954359
URL: http://svn.apache.org/viewvc?rev=954359&view=rev
Log:
merge git and NAnt changes from trunk
Modified:
gump/live/ (props changed)
gump/live/python/gump/core/build/nant.py
gump/live/python/gump/core/run/gumpenv.py
gump/live/python/gump/core/update/bzr.py (props changed)
gump/live/python/gump/core/update/darcs.py (props changed)
gump/live/python/gump/core/update/git.py
gump/live/python/gump/core/update/hg.py (props changed)
Propchange: gump/live/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 04:37:59 2010
@@ -1 +1 @@
-/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848
+/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169
Modified: gump/live/python/gump/core/build/nant.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/nant.py?rev=954359&r1=954358&r2=954359&view=diff
==============================================================================
--- gump/live/python/gump/core/build/nant.py (original)
+++ gump/live/python/gump/core/build/nant.py Mon Jun 14 04:37:59 2010
@@ -1,6 +1,5 @@
#!/usr/bin/python
-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
@@ -11,180 +10,177 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
+# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-__revision__ = "$Rev: 36667 $"
-__date__ = "$Date: 2004-08-20 08:55:45 -0600 (Fri, 20 Aug 2004) $"
-__copyright__ = "Copyright (c) 1999-2004 Apache Software Foundation"
-__license__ = "http://www.apache.org/licenses/LICENSE-2.0"
+from gump import log
+from gump.core.run.gumprun import RunSpecific
+
+from gump.util.process.command import CMD_STATE_SUCCESS, CMD_STATE_TIMED_OUT, \
+ Cmd, Parameters
+from gump.util.process.launcher import execute
+from gump.util.work import CommandWorkItem, WORK_TYPE_BUILD
+from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, \
+ REASON_PREBUILD_FAILED, STATE_FAILED, STATE_SUCCESS
-"""
- A NAnt builder (uses nant to build projects)
-"""
+class NAntBuilder(RunSpecific):
+ """
+ A NAnt builder (uses nant to build projects)
+ """
-import os.path
-import sys
-from gump import log
-from gump.core.run.gumprun import *
-from gump.core.config import dir, default, basicConfig
+ def __init__(self, run):
+ """
+ The NAnt Builder is a .NET Builder
+ """
+ RunSpecific.__init__(self, run)
+
+ def buildProject(self, project, language, _stats):
+ """
+ Build a project using NAnt, based off the <nant metadata.
+
+ Note: switch on -verbose|-debug based of the stats for this
+ project, i.e. how long in a state of failure.
+ """
-from gump.util.note import Annotatable
-from gump.util.work import *
+ workspace = self.run.getWorkspace()
-from gump.util.tools import *
+ log.info('Run NAnt on Project: #[' + `project.getPosition()` + \
+ '] : ' + project.getName())
-from gump.core.model.workspace import *
-from gump.core.model.module import Module
-from gump.core.model.project import Project
-from gump.core.model.depend import ProjectDependency
-from gump.core.model.stats import *
-from gump.core.model.state import *
-
-class NAntBuilder(gump.core.run.gumprun.RunSpecific):
-
- def __init__(self,run):
- """
- The NAnt Builder is a Java Builder
- """
- gump.core.run.gumprun.RunSpecific.__init__(self,run)
-
- def buildProject(self,project,language,stats):
- """
- Build a project using NAnt, based off the <nant metadata.
-
- Note: switch on -verbose|-debug based of the stats for this
- project, i.e. how long in a state of failure.
- """
-
- workspace=self.run.getWorkspace()
-
- log.info('Run NAnt on Project: #[' + `project.getPosition()` + '] : ' + project.getName())
-
# Get the appropriate build command...
- cmd=self.getNAntCommand(project, language)
+ cmd = self.getNAntCommand(project, language)
if cmd:
# Execute the command ....
- cmdResult=execute(cmd,workspace.tmpdir)
-
+ cmdResult = execute(cmd, workspace.tmpdir)
+
# Update context with the fact that this work was done
- work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
+ work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult)
project.performedWork(work)
project.setBuilt(True)
-
- # Update context state based of the result
- if not cmdResult.state==CMD_STATE_SUCCESS:
- reason=REASON_BUILD_FAILED
- if cmdResult.state==CMD_STATE_TIMED_OUT:
- reason=REASON_BUILD_TIMEDOUT
- project.changeState(STATE_FAILED,reason)
- else:
+
+ # Update context state based of the result
+ if not cmdResult.state == CMD_STATE_SUCCESS:
+ reason = REASON_BUILD_FAILED
+ if cmdResult.state == CMD_STATE_TIMED_OUT:
+ reason = REASON_BUILD_TIMEDOUT
+ project.changeState(STATE_FAILED, reason)
+ else:
# For now, things are going good...
project.changeState(STATE_SUCCESS)
-
- def getNAntCommand(self,project,languageHelper):
+
+ def getNAntCommand(self, project, languageHelper):
"""
- Build an ANT command for this project, based on the <nant metadata
- select targets and build files as appropriate.
+ Build an NANT command for this project, based on the <nant metadata
+ select targets and build files as appropriate.
"""
-
+
+ if not self.run.env.get_nant_command():
+ message = "Can't run NAnt builds since NAnt hasn't been found"
+ log.error(message)
+ project.addError(message)
+ project.setBuilt(True)
+ project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
+ return None
+
# The original model information...
- nant=project.nant
+ nant = project.nant
# The nant target (or none == nant default target)
- target= nant.getTarget()
-
+ target = nant.getTarget()
+
# The nant build file (or none == build.xml)
buildfile = nant.getBuildFile()
-
+
# Optional 'verbose' or 'debug'
- verbose=nant.isVerbose()
- debug=nant.isDebug()
-
+ verbose = nant.isVerbose()
+ debug = nant.isDebug()
+
# Where to run this:
basedir = nant.getBaseDirectory() or project.getBaseDirectory()
-
+
# Build a classpath (based upon dependencies)
- #(classpath,bootclasspath)=language.getClasspaths(project)
-
+ #(classpath, bootclasspath) = language.getClasspaths(project)
+
# Get properties
- properties=self.getNAntProperties(project)
-
+ properties = self.getNAntProperties(project)
+
# Get system properties
- sysproperties=self.getNAntSysProperties(project)
-
+ sysproperties = self.getNAntSysProperties(project)
+
# Library Path
- libpath=languageHelper.getAssemblyPath(project)
-
- # Run java on apache NAnt...
- cmd=Cmd('NAnt.exe','build_'+project.getModule().getName()+'_'+project.getName(),
- basedir,{'DEVPATH':libpath})
-
+ libpath = languageHelper.getAssemblyPath(project)
+
+ # Run NAnt...
+ cmd = Cmd(self.run.env.get_nant_command(),
+ 'build_' + project.getModule().getName() + '_' + \
+ project.getName(),
+ basedir, {'DEVPATH' : libpath})
+
# Launch with specified framework (e.g. mono-1.0.1) if
# required.
- workspace=self.run.getWorkspace()
+ workspace = self.run.getWorkspace()
if workspace.hasDotNetInformation():
- dotnetInfo=workspace.getDotNetInformation()
- if dotnetInfo.hasFramework():
- cmd.addParameter('-t:',dotnetInfo.getFramework(),'')
-
+ dotnetInfo = workspace.getDotNetInformation()
+ if dotnetInfo.hasFramework():
+ cmd.addParameter('-t:', dotnetInfo.getFramework(), '')
+
# These are workspace + project system properties
cmd.addNamedParameters(sysproperties)
-
- # Get/set JVM properties
- #jvmargs=language.getJVMArgs(project)
- #if jvmargs:
- # cmd.addParameters(jvmargs)
-
- # Allow ant-level debugging...
+
+ # Allow NAnt-level debugging...
if project.getWorkspace().isDebug() or project.isDebug() or debug:
- cmd.addParameter('-debug')
- if project.getWorkspace().isVerbose() or project.isVerbose() or verbose:
- cmd.addParameter('-verbose')
-
+ cmd.addParameter('-debug')
+ if project.getWorkspace().isVerbose() or project.isVerbose() \
+ or verbose:
+ cmd.addParameter('-verbose')
+
# Some builds might wish for this information
# :TODO: Grant greater access to Gump variables from
# within.
- mergeFile=project.getWorkspace().getMergeFile()
+ mergeFile = project.getWorkspace().getMergeFile()
if mergeFile:
- cmd.addPrefixedParameter('-D:','gump.merge',str(mergeFile),'=')
-
+ cmd.addPrefixedParameter('-D:', 'gump.merge', str(mergeFile), '=')
# These are from the project and/or workspace
# These are 'normal' properties.
cmd.addNamedParameters(properties)
-
+
# Pass the buildfile
- if buildfile: cmd.addParameter('-buildfile',buildfile, ':')
-
+ if buildfile:
+ cmd.addParameter('-buildfile', buildfile, ':')
+
# End with the target (or targets)...
if target:
- for targetParam in target.split(','):
+ for targetParam in target.split(', '):
cmd.addParameter(targetParam)
-
+
return cmd
-
- def getNAntProperties(self,project):
+
+ def getNAntProperties(self, project):
""" Get properties for a project """
- properties=Parameters()
- for property in project.getWorkspace().getProperties()+project.getNAnt().getProperties():
- properties.addPrefixedNamedParameter('-D:',property.name,property.value,'=')
+ properties = Parameters()
+ for prop in project.getWorkspace().getProperties() + \
+ project.getNAnt().getProperties():
+ properties.addPrefixedNamedParameter('-D:', prop.name,
+ prop.value, '=')
return properties
- def getNAntSysProperties(self,project):
+ def getNAntSysProperties(self, project):
""" Get sysproperties for a project """
- properties=Parameters()
- for property in project.getWorkspace().getSysProperties()+project.getNAnt().getSysProperties():
- properties.addPrefixedNamedParameter('-D:',property.name,property.value,'=')
+ properties = Parameters()
+ for prop in project.getWorkspace().getSysProperties() + \
+ project.getNAnt().getSysProperties():
+ properties.addPrefixedNamedParameter('-D:', prop.name,
+ prop.value, '=')
return properties
-
- def preview(self,project,language,stats):
+
+ def preview(self, project, language, _stats):
"""
- Preview what an NAnt build would look like.
+ Preview what an NAnt build would look like.
"""
- command=self.getNAntCommand(project,language)
- command.dump()
+ cmd = self.getNAntCommand(project, language)
+ cmd.dump()
Modified: gump/live/python/gump/core/run/gumpenv.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/run/gumpenv.py?rev=954359&r1=954358&r2=954359&view=diff
==============================================================================
--- gump/live/python/gump/core/run/gumpenv.py (original)
+++ gump/live/python/gump/core/run/gumpenv.py Mon Jun 14 04:37:59 2010
@@ -6,9 +6,9 @@
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
"""
A gump environment (i.e. what tools are available in this machine's
environment, and so forth).
-
+
TODO: a lot of this stuff needs to be available in other environments
as well, for example when we run dynagump or the unit tests we also
want to know about our environment. Either this class is refactored so
@@ -30,31 +30,30 @@
import os.path
import sys
from types import NoneType
-from fnmatch import fnmatch
-from gump.core.config import *
+from gump.core.config import dir, EXIT_CODE_BAD_ENVIRONMENT, \
+ EXIT_CODE_MISSING_UTILITY, time
from gump.util.note import Annotatable
-from gump.util.work import *
import gump.util.process.command
import gump.util.process.launcher
-from gump.util.tools import *
+from gump.util.tools import CommandWorkItem, execute, STATE_SUCCESS, \
+ tailFileToString, Workable, WORK_TYPE_CHECK
-from gump.core.model.state import *
-from gump.core.model.propagation import *
+from gump.core.model.propagation import Propogatable
#TODO: any reason checkEnvironment can't simply be called once (on __init__)
# and after that simply used? It'd certainly simplify the code a bit..
-class GumpEnvironment(Annotatable,Workable,Propogatable):
+class GumpEnvironment(Annotatable, Workable, Propogatable):
"""
Represents the environment that Gump is running within.
-
- What environment variables are set, what tools are
+
+ What environment variables are set, what tools are
available, what Java command to use, etc.
-
+
If some required bit of environment is missing, this class will actually
short-circuit gump and call sys.exit.
"""
@@ -63,187 +62,210 @@ class GumpEnvironment(Annotatable,Workab
Annotatable.__init__(self)
Workable.__init__(self)
Propogatable.__init__(self)
- #Stateful.__init__(self) -- redundant, already called from Propogatable.__init__
-
- if not log: from gump import log
+ #Stateful.__init__(self) -- redundant, already called from
+ #Propogatable.__init__
+
+ if not log:
+ from gump import log
self.log = log
-
+
self.checked = False
self.set = False
-
+
self.noMono = False
- self.noNAnt = False
- self.noMaven = False
+ self.noNAnt = False
+ self.nant_command = None
+ self.noMaven = False
self.noMaven2 = False
- self.noSvn = False
- self.noCvs = False
- self.noP4 = False
+ self.noSvn = False
+ self.noCvs = False
+ self.noP4 = False
self.noJava = False
self.noJavac = False
- self.noMake = False
+ self.noMake = False
self.noMvnRepoProxy = False
self.noGit = False
self.noDarcs = False
self.noHg = False
self.noBzr = False
-
+
self.javaProperties = None
-
+
# GUMP_HOME
self.gumpHome = None
-
+
# JAVACMD can override this, see checkEnvironment
self.javaHome = None
self.javaCommand = 'java'
self.javacCommand = 'javac'
-
+
# Timezone and offset from UTC
self.timezone = time.tzname
self.timezoneOffset = time.timezone
-
- def checkEnvironment(self,exitOnError=False):
- """
- Take a look at the environment and populate this object's properties based on that.
- """
-
- if self.checked: return
-
+
+ def checkEnvironment(self, exitOnError = False):
+ """
+ Take a look at the environment and populate this object's
+ properties based on that.
+ """
+
+ if self.checked:
+ return
+
# Check for directories
-
- self._checkEnvVariable('GUMP_HOME')
+
+ self._checkEnvVariable('GUMP_HOME')
self.gumpHome = os.environ['GUMP_HOME']
-
+
# JAVA_CMD can be set (perhaps for JRE verse JDK)
- if os.environ.has_key('JAVA_CMD'):
+ if os.environ.has_key('JAVA_CMD'):
self.javaCommand = os.environ['JAVA_CMD']
- self.addInfo('JAVA_CMD environmental variable setting java command to ' + self.javaCommand )
+ self.addInfo('JAVA_CMD environmental variable setting java' + \
+ ' command to ' + self.javaCommand )
# JAVAC_CMD can be set (perhaps for JRE verse JDK)
- if os.environ.has_key('JAVAC_CMD'):
+ if os.environ.has_key('JAVAC_CMD'):
self.javacCommand = os.environ['JAVAC_CMD']
- self.addInfo('javaCommand environmental variable setting javac command to ' + self.javacCommand )
+ self.addInfo('javaCommand environmental variable setting javac' + \
+ ' command to ' + self.javacCommand )
else:
# Default to $JAVA_HOME/bin/java, can be overridden with $JAVA_CMD.
- if os.environ.has_key('JAVA_HOME'):
- self.javaCommand = os.path.join(os.environ['JAVA_HOME'],'bin',self.javaCommand)
- self.addInfo('javaCommand set to $JAVA_HOME/bin/java = ' + self.javaCommand )
-
+ if os.environ.has_key('JAVA_HOME'):
+ self.javaCommand = os.path.join(os.environ['JAVA_HOME'],
+ 'bin', self.javaCommand)
+ self.addInfo('javaCommand set to $JAVA_HOME/bin/java = ' + \
+ self.javaCommand )
+
self._checkEnvVariable('JAVA_HOME')
-
- if os.environ.has_key('JAVA_HOME'):
+
+ if os.environ.has_key('JAVA_HOME'):
self.javaHome = os.environ['JAVA_HOME']
- self.addInfo('JAVA_HOME environmental variable setting java home to ' + self.javaHome )
-
- if not self.noMaven and not self._checkEnvVariable('MAVEN_HOME',False):
- self.noMaven=True
- self.addWarning('MAVEN_HOME environmental variable not found, no maven builds.')
-
- if not self.noMaven2 and not self._checkEnvVariable('M2_HOME',False):
- self.noMaven=True
- self.addWarning('M2_HOME environmental variable not found, no mvn builds.')
-
+ self.addInfo('JAVA_HOME environmental variable setting java' + \
+ ' home to ' + self.javaHome )
+
+ if not self.noMaven and not self._checkEnvVariable('MAVEN_HOME', False):
+ self.noMaven = True
+ self.addWarning('MAVEN_HOME environmental variable not found, ' + \
+ ' no maven builds.')
+
+ if not self.noMaven2 and not self._checkEnvVariable('M2_HOME', False):
+ self.noMaven = True
+ self.addWarning('M2_HOME environmental variable not found, ' + \
+ ' no mvn builds.')
+
if not self.noMvnRepoProxy \
and not self._checkEnvVariable('MVN_PROXY_HOME', False):
self.noMvnRepoProxy = True
- self.addWarning('MVN_PROXY_HOME environmental variable not found, no using a proxy for Maven2 repository')
+ self.addWarning('MVN_PROXY_HOME environmental variable not' + \
+ ' found, no using a proxy for Maven2' + \
+ ' repository')
# Check for executables
-
- self._checkExecutable('env','',False)
-
- if not self.noJava and not self._checkExecutable(self.javaCommand,'-version',exitOnError,1):
- self.noJava=True
- self.noJavac=True
- if not self.noJavac and not self._checkExecutable('javac','-help',False):
- self.noJavac=True
+ self._checkExecutable('env', '', False)
- if not self.noJavac and not self._checkExecutable('java com.sun.tools.javac.Main','-help',False,False,'check_java_compiler'):
- self.noJavac=True
+ if not self.noJava and not self._checkExecutable(self.javaCommand,
+ '-version',
+ exitOnError, 1):
+ self.noJava = True
+ self.noJavac = True
+
+ if not self.noJavac and not self._checkExecutable('javac',
+ '-help', False):
+ self.noJavac = True
+
+ if not self.noJavac and \
+ not self._checkExecutable('java com.sun.tools.javac.Main',
+ '-help', False, False,
+ 'check_java_compiler'):
+ self.noJavac = True
self.noCvs = self._checkWithDashVersion('cvs',
'no CVS repository updates')
-
+
self.noSvn = self._checkWithDashVersion('svn',
'no svn repository updates')
-
+
self.noP4 = self._checkWithDashVersion('p4',
'no Perforce repository updates',
'-V')
-
+
self.noMaven = not self.noMaven and not \
self._checkWithDashVersion('maven', "no Maven 1.x builds")
-
+
self.noMaven2 = not self.noMaven2 and not \
self._checkWithDashVersion('mvn', "no Maven 2.x builds")
- self.noNAnt = self._checkWithDashVersion('NAnt', "no NAnt builds")
-
+ self._check_nant()
self.noMono = self._checkWithDashVersion('mono', "no Mono runtime")
self.noMake = self._checkWithDashVersion('make', "no make builds")
-
+
self.noGit = self._checkWithDashVersion('git',
'no git repository updates')
-
+
self.noDarcs = self._checkWithDashVersion('darcs',
'no darcs repository updates')
-
+
self.noHg = self._checkWithDashVersion('hg',
- 'no Mercurial repository updates')
-
+ 'no Mercurial repository ' + \
+ 'updates')
+
self.noBzr = self._checkWithDashVersion('bzr',
'no Bazar repository updates')
-
-
+
+
self.checked = True
-
+
self.changeState(STATE_SUCCESS)
-
+
def setEnvironment(self):
- """
- Customize the actual environment to reflect the way gump needs things to be.
"""
-
- if self.set: return
-
+ Customize the actual environment to reflect the way gump needs
+ things to be.
+ """
+
+ if self.set:
+ return
+
# Blank the CLASSPATH
os.environ['CLASSPATH'] = ''
-
- self.set=True
-
+
+ self.set = True
+
def getGumpHome(self):
# Ensure we've determined the Gump Home
- self.checkEnvironment()
+ self.checkEnvironment()
return self.gumpHome
-
+
def getJavaHome(self):
# Ensure we've determined the Java Home
- self.checkEnvironment()
+ self.checkEnvironment()
return self.javaHome
-
+
def getJavaProperties(self):
"""
- Ask the JAVA instance what it's system properties are,
+ Ask the JAVA instance what it's system properties are,
primarily so we can log/display them (for user review).
"""
-
- if not isinstance(self.javaProperties,NoneType):
+
+ if not isinstance(self.javaProperties, NoneType):
return self.javaProperties
# Ensure we've determined the Java Compiler to use
self.checkEnvironment()
-
- if self.noJavac:
- self.log.error("Can't obtain Java properties since Java Environment was not found")
+
+ if self.noJavac:
+ self.log.error("Can't obtain Java properties since Java " + \
+ "Environment was not found")
return {}
import commands, re
JAVA_SOURCE = dir.tmp + '/sysprop.java'
- source = open(JAVA_SOURCE,'w')
+ source = open(JAVA_SOURCE, 'w')
source.write("""
import java.util.Enumeration;
public class sysprop {
@@ -257,23 +279,25 @@ class GumpEnvironment(Annotatable,Workab
}
""")
source.close()
-
+
cmd = self.javacCommand + " " + JAVA_SOURCE
os.system(cmd)
os.unlink(JAVA_SOURCE)
-
+
cmd = self.javaCommand + ' -cp ' + dir.tmp + ' sysprop'
result = commands.getoutput(cmd)
self.javaProperties = dict(re.findall('(.*?): (.*)', result))
- JAVA_CLASS = JAVA_SOURCE.replace('.java','.class')
- if os.path.exists(JAVA_CLASS): os.unlink(JAVA_CLASS)
+ JAVA_CLASS = JAVA_SOURCE.replace('.java', '.class')
+ if os.path.exists(JAVA_CLASS):
+ os.unlink(JAVA_CLASS)
- for (name,value) in self.javaProperties.items():
- self.log.debug("Java Property: " + name + " => " + value)
+ for (name, value) in self.javaProperties.items():
+ self.log.debug("Java Property: " + name + " = > " + value)
return self.javaProperties
- def _checkWithDashVersion(self,commandName,consequence,version='--version'):
+ def _checkWithDashVersion(self, commandName, consequence,
+ version = '--version'):
"""
Determine whether a particular command is or is not available
by using the --version switch
@@ -285,78 +309,106 @@ class GumpEnvironment(Annotatable,Workab
+ consequence)
return ok
- def _checkExecutable(self,command,options,mandatory,logOutput=False,name=None):
+ def _checkExecutable(self, exe, options, mandatory, logOutput = False,
+ name = None):
"""
Determine whether a particular command is or is not available.
"""
ok = False
try:
- if not name: name = 'check_'+command
- cmd = gump.util.process.command.getCmdFromString(command+" "+options,name)
+ if not name:
+ name = 'check_' + exe
+ cmd = gump.util.process.command.getCmdFromString(exe + " " + \
+ options,
+ name)
result = execute(cmd)
ok = result.isOk()
if ok:
- self.log.warning('Detected [' + command + ' ' + options + ']')
+ self.log.warning('Detected [' + exe + ' ' + options + ']')
else:
- self.log.warning('Failed to detect [' + command + ' ' + options + ']')
+ self.log.warning('Failed to detect [' + exe + ' ' + \
+ options + ']')
except Exception, details:
ok = False
- self.log.error('Failed to detect [' + command + ' ' + options + '] : ' + str(details))
+ self.log.error('Failed to detect [' + exe + ' ' + options + \
+ '] : ' + str(details))
result = None
-
- # Update
- self.performedWork(CommandWorkItem(WORK_TYPE_CHECK,cmd,result))
-
+
+ # Update
+ self.performedWork(CommandWorkItem(WORK_TYPE_CHECK, cmd, result))
+
if not ok and mandatory:
print
- print "Unable to detect/test mandatory [" + command+ "] in path:"
+ print "Unable to detect/test mandatory [" + exe + "] in path:"
for p in sys.path:
print " " + str(os.path.abspath(p))
sys.exit(EXIT_CODE_MISSING_UTILITY)
-
+
# Store the output
if logOutput and result.output:
- out = tailFileToString(result.output,10)
+ out = tailFileToString(result.output, 10)
self.addInfo(name + ' produced: \n' + out)
-
+
return ok
-
- def _checkEnvVariable(self,env,mandatory=True):
+
+ def _checkEnvVariable(self, envvar, mandatory = True):
"""
Determine whether a particular environment variable is set.
"""
ok = False
try:
- ok = os.environ.has_key(env)
+ ok = os.environ.has_key(envvar)
if not ok:
- self.log.info('Failed to find environment variable [' + env + ']')
-
+ self.log.info('Failed to find environment variable [' + \
+ envvar + ']')
+
except Exception, details:
ok = False
- self.log.error('Failed to find environment variable [' + env + '] : ' + str(details))
-
+ self.log.error('Failed to find environment variable [' + envvar + \
+ '] : ' + str(details))
+
if not ok and mandatory:
print
- print "Unable to find mandatory [" + env + "] in environment:"
+ print "Unable to find mandatory [" + envvar + "] in environment:"
for e in os.environ.keys():
try:
v = os.environ[e]
print " " + e + " = " + v
except:
- print " " + e
+ print " " + e
sys.exit(EXIT_CODE_BAD_ENVIRONMENT)
-
+
return ok
-
+
def getJavaCommand(self):
return self.javaCommand
-
+
def getTimezone(self):
return self.timezone
-
+
def getTimezoneOffset(self):
return self.timezoneOffset
-
+
+ def _check_nant(self):
+ if not self.checked:
+ if not self._checkWithDashVersion('NAnt', "no NAnt builds"):
+ if not self._checkWithDashVersion('NAnt.exe', "no NAnt builds"):
+ self.noNAnt = self._checkWithDashVersion('nant',
+ "no NAnt builds",
+ '-help')
+ if self.noNAnt:
+ self.nant_command = 'nant'
+ else:
+ self.nant_command = 'NAnt.exe'
+ else:
+ self.nant_command = 'NAnt'
+
+ def get_nant_command(self):
+ self._check_nant()
+ if not self.noNAnt:
+ return None
+ return self.nant_command
+
if __name__ == '__main__':
env = GumpEnvironment()
env.checkEnvironment()
Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 04:37:59 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/bzr.py:815848
+/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169
Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 04:37:59 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/darcs.py:815848
+/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169
Modified: gump/live/python/gump/core/update/git.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/update/git.py?rev=954359&r1=954358&r2=954359&view=diff
==============================================================================
--- gump/live/python/gump/core/update/git.py (original)
+++ gump/live/python/gump/core/update/git.py Mon Jun 14 04:37:59 2010
@@ -43,8 +43,9 @@ class GitUpdater(ScmUpdater):
Build the appropriate GIT command for clone
"""
log_repository_and_url(module, 'git')
- cmd = Cmd('git-clone', 'update_' + module.getName(),
+ cmd = Cmd('git', 'update_' + module.getName(),
module.getWorkspace().getSourceControlStagingDirectory())
+ cmd.addParameter('clone')
maybe_make_quiet(module, cmd)
cmd.addParameter(module.getScm().getRootUrl())
cmd.addParameter(module.getName())
@@ -55,8 +56,9 @@ class GitUpdater(ScmUpdater):
Build the appropriate GIT command for pull
"""
log_repository_and_url(module, 'git')
- cmd = Cmd('git-pull', 'update_' + module.getName(),
+ cmd = Cmd('git', 'update_' + module.getName(),
module.getSourceControlStagingDirectory())
+ cmd.addParameter('pull')
maybe_make_quiet(module, cmd)
return cmd
Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 04:37:59 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/hg.py:815848
+/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169