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/07/11 08:26:50 UTC
svn commit: r962993 - in /gump/trunk/python/gump: core/build/nant.py
test/nant.py
Author: bodewig
Date: Sun Jul 11 06:26:50 2010
New Revision: 962993
URL: http://svn.apache.org/viewvc?rev=962993&view=rev
Log:
make pylint happier
Modified:
gump/trunk/python/gump/core/build/nant.py
gump/trunk/python/gump/test/nant.py
Modified: gump/trunk/python/gump/core/build/nant.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/build/nant.py?rev=962993&r1=962992&r2=962993&view=diff
==============================================================================
--- gump/trunk/python/gump/core/build/nant.py (original)
+++ gump/trunk/python/gump/core/build/nant.py Sun Jul 11 06:26:50 2010
@@ -26,6 +26,23 @@ from gump.util.work import CommandWorkIt
from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, \
REASON_PREBUILD_FAILED, STATE_FAILED, STATE_SUCCESS
+def getNAntProperties(project):
+ """ Get properties for a project """
+ return collect_properties(project.getWorkspace().getProperties() + \
+ project.getNAnt().getProperties())
+
+def getNAntSysProperties(project):
+ """ Get sysproperties for a project """
+ return collect_properties(project.getWorkspace().getSysProperties() + \
+ project.getNAnt().getSysProperties())
+
+def collect_properties(props):
+ """ collect named properties for a project """
+ properties = Parameters()
+ for prop in props:
+ properties.addPrefixedNamedParameter('-D:', prop.name, prop.value, '=')
+ return properties
+
class NAntBuilder(RunSpecific):
"""
A NAnt builder (uses nant to build projects)
@@ -38,7 +55,7 @@ class NAntBuilder(RunSpecific):
"""
RunSpecific.__init__(self, run)
- def buildProject(self, project, language, _stats):
+ def buildProject(self, project, _language, _stats):
"""
Build a project using NAnt, based off the <nant metadata.
@@ -52,7 +69,7 @@ class NAntBuilder(RunSpecific):
'] : ' + project.getName())
# Get the appropriate build command...
- cmd = self.getNAntCommand(project, language)
+ cmd = self.getNAntCommand(project)
if cmd:
# Execute the command ....
@@ -73,7 +90,7 @@ class NAntBuilder(RunSpecific):
# For now, things are going good...
project.changeState(STATE_SUCCESS)
- def getNAntCommand(self, project, _languageHelper):
+ def getNAntCommand(self, project):
"""
Build an NANT command for this project, based on the <nant metadata
select targets and build files as appropriate.
@@ -103,10 +120,10 @@ class NAntBuilder(RunSpecific):
basedir = nant.getBaseDirectory() or project.getBaseDirectory()
# Get properties
- properties = self.getNAntProperties(project)
+ properties = getNAntProperties(project)
# Get system properties
- sysproperties = self.getNAntSysProperties(project)
+ sysproperties = getNAntSysProperties(project)
# Run NAnt...
cmd = Cmd(self.run.env.get_nant_command(),
@@ -153,28 +170,10 @@ class NAntBuilder(RunSpecific):
return cmd
- def getNAntProperties(self, project):
- """ Get properties for a project """
- properties = Parameters()
- for prop in project.getWorkspace().getProperties() + \
- project.getNAnt().getProperties():
- properties.addPrefixedNamedParameter('-D:', prop.name,
- prop.value, '=')
- return properties
-
- def getNAntSysProperties(self, project):
- """ Get sysproperties for a project """
- 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.
"""
- cmd = self.getNAntCommand(project, language)
+ cmd = self.getNAntCommand(project)
cmd.dump()
Modified: gump/trunk/python/gump/test/nant.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/test/nant.py?rev=962993&r1=962992&r2=962993&view=diff
==============================================================================
--- gump/trunk/python/gump/test/nant.py (original)
+++ gump/trunk/python/gump/test/nant.py Sun Jul 11 06:26:50 2010
@@ -29,8 +29,6 @@ import gump.core.config
from gump.core.model.state import *
from gump.core.build.nant import NAntBuilder
-import gump.core.language.csharp
-
from gump.util import *
from gump.test import getWorkedTestRun
from gump.test.pyunit import UnitTestSuite
@@ -58,12 +56,11 @@ class NAntTestSuite(UnitTestSuite):
self.assertNotNone('Needed a nant project', self.nant1)
self.nantBuilder=NAntBuilder(self.run)
- self.csharpHelper=gump.core.language.csharp.CSharpHelper(self.run)
def testNAntCommand(self):
self.assertTrue('NAnt project has a NAnt object', self.nant1.hasNAnt())
- cmd=self.nantBuilder.getNAntCommand(self.nant1,self.csharpHelper)
+ cmd=self.nantBuilder.getNAntCommand(self.nant1)
#cmd.dump()