gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1766264 - in /gump/live/python/gump/core/build: configure.py gradle.py make.py maven.py msbuild.py mvn.py nant.py nuget.py script.py
Date Sun, 23 Oct 2016 10:06:58 GMT
Author: bodewig
Date: Sun Oct 23 10:06:57 2016
New Revision: 1766264

URL: http://svn.apache.org/viewvc?rev=1766264&view=rev
Log:
make pylint less unhappy

Modified:
    gump/live/python/gump/core/build/configure.py
    gump/live/python/gump/core/build/gradle.py
    gump/live/python/gump/core/build/make.py
    gump/live/python/gump/core/build/maven.py
    gump/live/python/gump/core/build/msbuild.py
    gump/live/python/gump/core/build/mvn.py
    gump/live/python/gump/core/build/nant.py
    gump/live/python/gump/core/build/nuget.py
    gump/live/python/gump/core/build/script.py

Modified: gump/live/python/gump/core/build/configure.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/configure.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/configure.py (original)
+++ gump/live/python/gump/core/build/configure.py Sun Oct 23 10:06:57 2016
@@ -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.
@@ -26,93 +26,85 @@ __license__   = "http://www.apache.org/l
 """
 
 import os.path
-import sys
 
 from gump import log
-from gump.core.run.gumprun import *
 from gump.core.build.script import getArgs
-from gump.core.config import dir, default, basicConfig
-
-from gump.util import dump, display, getIndent, logResourceUtilization, \
-                            invokeGarbageCollection
-from gump.util.note import Annotatable
-from gump.util.work import *
-
-from gump.util.tools import *
-
-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 *
+#from gump.core.config import setting
+from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, STATE_FAILED,\
+    STATE_SUCCESS
+from gump.core.run.gumprun import RunSpecific
+
+from gump.util.process.command import CMD_STATE_SUCCESS, CMD_STATE_TIMED_OUT, Cmd
+from gump.util.process.launcher import execute
+from gump.util.work import CommandWorkItem, WORK_TYPE_BUILD
 
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class ConfigureBuilder(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
+class ConfigureBuilder(RunSpecific):
+
+    def __init__(self, run):
         """
         A configure 'builder'
         """
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+        RunSpecific.__init__(self, run)
 
-    def buildProject(self,project,languageHelper,stats):
+    def buildProject(self, project, languageHelper, stats):
         """
         Run a project's configure script (doesn't support Windows, yet)
         """
-        
-        workspace=self.run.getWorkspace()
-                 
-        log.info('Run Project\'s configure script: #[' + `project.getPosition()` + '] : '
+ project.getName())
-                
+
+        workspace = self.run.getWorkspace()
+
+        log.info('Run Project\'s configure script: #[' + `project.getPosition()` +\
+                 '] : ' + project.getName())
+
         #
         # Get the appropriate build command...
         #
-        cmd=self.getConfigureCommand(project)
+        cmd = self.getConfigureCommand(project)
 
         if cmd:
             # Execute the command ....
-            cmdResult=execute(cmd,workspace.tmpdir)
-    
-            # Update Context    
-            work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
+            cmdResult = execute(cmd, workspace.tmpdir)
+
+            # Update Context
+            work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult)
             project.performedWork(work)
             project.setBuilt(True)
-                    
-            # Update Context w/ Results  
-            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 w/ Results
+            if 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 getConfigureCommand(self,project):
+
+    def getConfigureCommand(self, project):
         """ Return the command object for a <configure entry """
-        configure=project.configure
-           
+        configure = project.configure
+
         # Where to run this:
         basedir = configure.getBaseDirectory() or project.getBaseDirectory()
 
         # The script
-        scriptfile=os.path.abspath(os.path.join(basedir, 'configure'))
-        
-        cmd=Cmd(scriptfile,'buildscript_'+project.getModule().getName()+'_'+project.getName(),\
-            basedir)    
+        scriptfile = os.path.abspath(os.path.join(basedir, 'configure'))
+
+        cmd = Cmd(scriptfile, 'buildscript_'+project.getModule().getName()+'_'+project.getName(),
+                  basedir)
         cmd.addParameters(getArgs(configure))
-        
+
         return cmd
-        
-    def preview(self,project,languageHelper,stats):        
+
+    def preview(self, project, languageHelper, stats):
         """
         Preview what this would do
         """
-        command=self.getConfigureCommand(project) 
-        command.dump()
+        cmd = self.getConfigureCommand(project)
+        cmd.dump()

Modified: gump/live/python/gump/core/build/gradle.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/gradle.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/gradle.py (original)
+++ gump/live/python/gump/core/build/gradle.py Sun Oct 23 10:06:57 2016
@@ -16,6 +16,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from time import strftime
 import os.path
 
 from gump import log
@@ -31,8 +32,6 @@ from gump.util.process.command import Cm
 from gump.util.process.launcher import execute
 from gump.util.tools import catFileToFileHolder
 
-from time import strftime
-
 ###############################################################################
 # Classes
 ###############################################################################
@@ -67,7 +66,8 @@ def getGradleProperties(project):
 def getSysProperties(project):
     """ Get sysproperties for a project """
     properties = Parameters()
-    for property in project.getWorkspace().getSysProperties()+project.getGradle().getSysProperties():
+    for property in project.getWorkspace().getSysProperties() + \
+        project.getGradle().getSysProperties():
         properties.addPrefixedNamedParameter('-D', property.name, \
                                                  property.value, '=')
     return properties
@@ -169,7 +169,7 @@ class GradleBuilder(RunSpecific):
                 project.setBuilt(True)
 
                 # Update Context w/ Results
-                if not cmdResult.state == CMD_STATE_SUCCESS:
+                if cmdResult.state != CMD_STATE_SUCCESS:
                     reason = REASON_BUILD_FAILED
                     if cmdResult.state == CMD_STATE_TIMED_OUT:
                         reason = REASON_BUILD_TIMEDOUT
@@ -195,8 +195,8 @@ class GradleBuilder(RunSpecific):
 
                 try:
                     catFileToFileHolder(project, init_script,
-                        FILE_TYPE_CONFIG,
-                        os.path.basename(init_script))
+                                        FILE_TYPE_CONFIG,
+                                        os.path.basename(init_script))
                 except:
                     log.error('Display Init Script [ ' + init_script + \
                                   '] Failed', exc_info=1)

Modified: gump/live/python/gump/core/build/make.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/make.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/make.py (original)
+++ gump/live/python/gump/core/build/make.py Sun Oct 23 10:06:57 2016
@@ -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.
@@ -22,87 +22,77 @@ __license__   = "http://www.apache.org/l
 
 
 """
-	An make builder (uses make to build projects)
+        An make builder (uses make to build projects)
 """
 
-import os.path
-import sys
-
 from gump import log
-from gump.core.run.gumprun import *
+from gump.core.run.gumprun import RunSpecific
 from gump.core.build.script import getArgs
-from gump.core.config import dir, default, basicConfig
+#from gump.core.config import setting
+from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, STATE_FAILED,\
+    STATE_SUCCESS
+
+from gump.util.process.command import CMD_STATE_SUCCESS, CMD_STATE_TIMED_OUT, Cmd
+from gump.util.process.launcher import execute
+from gump.util.work import CommandWorkItem, WORK_TYPE_BUILD
 
-from gump.util import dump, display, getIndent, logResourceUtilization, \
-                            invokeGarbageCollection
-from gump.util.note import Annotatable
-from gump.util.work import *
-
-from gump.util.tools import *
-
-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 *
 
 
 ###############################################################################
 # Classes
 ###############################################################################
 
-class MakeBuilder(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
+class MakeBuilder(RunSpecific):
+
+    def __init__(self, run):
         """
         A make 'builder'
         """
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+        RunSpecific.__init__(self, run)
 
-    def buildProject(self,project,languageHelper,stats):
+    def buildProject(self, project, languageHelper, stats):
         """
         Run a project's make file
         """
-        
-        workspace=self.run.getWorkspace()
-                 
+
+        workspace = self.run.getWorkspace()
+
         log.info('Run make on project: #[' + `project.getPosition()` + '] : ' + project.getName())
-                
+
         #
         # Get the appropriate build command...
         #
-        cmd=self.getMakeCommand(project)
+        cmd = self.getMakeCommand(project)
 
         if cmd:
             # Execute the command ....
-            cmdResult=execute(cmd,workspace.tmpdir)
-    
-            # Update Context    
-            work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
+            cmdResult = execute(cmd, workspace.tmpdir)
+
+            # Update Context
+            work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult)
             project.performedWork(work)
             project.setBuilt(True)
-                    
-            # Update Context w/ Results  
-            if not cmdResult.state==CMD_STATE_SUCCESS:
-                reason=REASON_BUILD_FAILED
-                if cmdResult.state==CMD_STATE_TIMED_OUT:
-                    reason=REASON_BUILD_TIMEDOUT
+
+            # Update Context w/ Results
+            if 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:                         
+
+            else:
                 # For now, things are going good...
                 project.changeState(STATE_SUCCESS)
-   
-    def getMakeCommand(self,project):
+
+    def getMakeCommand(self, project):
         """ Return the command object for a <make entry """
-        make=project.make
-           
+        make = project.make
+
         # Where to run this:
         basedir = make.getBaseDirectory() or project.getBaseDirectory()
 
         # The make target (or none == ALL)
-        target= make.getTarget()
+        target = make.getTarget()
 
         # The make file (or none == Makefile)
         makefile = make.getMakeFile()
@@ -110,25 +100,26 @@ class MakeBuilder(gump.core.run.gumprun.
         # The make command, defaults to "make"
         makeCommand = project.getWorkspace().getMakeCommand()
 
-        cmd=Cmd(makeCommand,'build_'+project.getModule().getName()+'_'+project.getName(),
-            basedir)
-        
+        cmd = Cmd(makeCommand, 'build_'+project.getModule().getName()+'_'+project.getName(),
+                  basedir)
+
         # Pass the makefile
-        if makefile: cmd.addParameter('-f', makefile)
-    
+        if makefile:
+            cmd.addParameter('-f', makefile)
+
         cmd.addParameters(getArgs(make))
 
         # End with the target (or targets)...
-        if target: 
+        if target:
             for targetParam in target.split():
                 cmd.addParameter(targetParam)
 
         return cmd
-        
-        
-    def preview(self,project,languageHelper,stats):        
+
+
+    def preview(self, project, languageHelper, stats):
         """
         Preview what this would do
         """
-        command=self.getMakeCommand(project) 
-        command.dump()
+        cmd = self.getMakeCommand(project)
+        cmd.dump()

Modified: gump/live/python/gump/core/build/maven.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/maven.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/maven.py (original)
+++ gump/live/python/gump/core/build/maven.py Sun Oct 23 10:06:57 2016
@@ -7,11 +7,11 @@
 # 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, 
+# 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.
@@ -22,9 +22,9 @@ __copyright__ = "Copyright (c) 1999-2004
 __license__   = "http://www.apache.org/licenses/LICENSE-2.0"
 
 
-import gump
 import os.path
 import time
+import gump
 
 from gump import log
 from gump.core.model.workspace import CommandWorkItem, \
@@ -63,11 +63,11 @@ def getMavenCommand(project):
     #
     # Allow maven-level debugging...
     #
-    if project.getWorkspace().isDebug() or project.isDebug() or debug: 
+    if project.getWorkspace().isDebug() or project.isDebug() or debug:
         cmd.addParameter('--debug')
     if project.getWorkspace().isVerbose()  or project.isVerbose() \
-            or verbose: 
-        cmd.addParameter('--exception') 
+            or verbose:
+        cmd.addParameter('--exception')
 
     #
     # Suppress downloads
@@ -75,14 +75,14 @@ def getMavenCommand(project):
     cmd.addParameter('--offline')
 
     # End with the goal...
-    if goal: 
+    if goal:
         for goalParam in goal.split(', '):
             cmd.addParameter(goalParam)
 
     return cmd
 
 # The propertiesFile parameter is primarily for testing.
-def generateMavenProperties(project, languageHelper, propertiesFile = None):
+def generateMavenProperties(project, languageHelper, propertiesFile=None):
     """Set properties/overrides for a Maven project"""
 
     #:TODO: Does Maven have the idea of system properties?
@@ -91,7 +91,7 @@ def generateMavenProperties(project, lan
     # Where to put this:
     #
     basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
-    if not propertiesFile: 
+    if not propertiesFile:
         propertiesFile = os.path.abspath(os.path.join(basedir,
                                                       'build.properties'))
 
@@ -110,7 +110,7 @@ def generateMavenProperties(project, lan
     props = open(propertiesFile, 'w')
 
     props.write(("""# ------------------------------------------------------------------------
-# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT

+# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT
 #
 # File Automatically Generated by Gump, see http://gump.apache.org/
 #
@@ -120,7 +120,7 @@ def generateMavenProperties(project, lan
 #
 # DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT
 # ------------------------------------------------------------------------
-""")    %       (project.getName(), time.strftime('%Y-%m-%d %H:%M:%S')) )
+""")    %       (project.getName(), time.strftime('%Y-%m-%d %H:%M:%S')))
 
     #
     # Output basic properties
@@ -128,11 +128,11 @@ def generateMavenProperties(project, lan
     for property in project.getWorkspace().getProperties() + \
             project.getMaven().getProperties():
         # build.sysclasspath makes Maven sick.
-        if not 'build.sysclasspath' == property.name:
+        if 'build.sysclasspath' != property.name:
             props.write(('%s = %s\n') % \
                             (property.name,
                              property.value.replace('\\', '/'))
-                        )
+                       )
 
     #
     # Output classpath properties
@@ -155,14 +155,14 @@ maven.jar.override = on
             bootclasspath.getPathParts():
         if isinstance(annotatedPath, gump.core.language.path.AnnotatedPath):
             props.write(('# Contributor: %s\nmaven.jar.%s = %s\n') % \
-                (   annotatedPath.getContributor(), 
-                    annotatedPath.getId(), 
-                    annotatedPath.getPath().replace('\\', '/')))
+                (annotatedPath.getContributor(),
+                 annotatedPath.getId(),
+                 annotatedPath.getPath().replace('\\', '/')))
 
     return propertiesFile
 
 def locateMavenProjectPropertiesFile(project):
-    """Return Maven project properties file location""" 
+    """Return Maven project properties file location"""
     basedir = project.maven.getBaseDirectory() or project.getBaseDirectory()
     return os.path.abspath(os.path.join(basedir, 'project.properties'))
 
@@ -215,7 +215,7 @@ class Maven1Builder(RunSpecific):
                 project.setBuilt(True)
 
                 # Update Context w/ Results
-                if not cmdResult.state == CMD_STATE_SUCCESS:
+                if cmdResult.state != CMD_STATE_SUCCESS:
                     reason = REASON_BUILD_FAILED
                     if cmdResult.state == CMD_STATE_TIMED_OUT:
                         reason = REASON_BUILD_TIMEDOUT
@@ -225,12 +225,12 @@ class Maven1Builder(RunSpecific):
                     project.changeState(STATE_SUCCESS)
 
         if project.wasBuilt():
-            pomFile = locateMavenProjectFile(project) 
+            pomFile = locateMavenProjectFile(project)
             if os.path.exists(pomFile):
-                project.addDebug('Maven POM in: ' + pomFile) 
-                catFileToFileHolder(project, pomFile, FILE_TYPE_CONFIG) 
+                project.addDebug('Maven POM in: ' + pomFile)
+                catFileToFileHolder(project, pomFile, FILE_TYPE_CONFIG)
 
-            projpFile = locateMavenProjectPropertiesFile(project) 
+            projpFile = locateMavenProjectPropertiesFile(project)
             if os.path.exists(projpFile):
                 project.addDebug('Maven project properties in: ' + projpFile)
                 catFileToFileHolder(project, projpFile, FILE_TYPE_CONFIG)
@@ -247,20 +247,20 @@ class Maven1Builder(RunSpecific):
                                      propertiesFile)
 
                 try:
-                    catFileToFileHolder(project, propertiesFile, 
-                        FILE_TYPE_CONFIG, 
-                        os.path.basename(propertiesFile))
+                    catFileToFileHolder(project, propertiesFile,
+                                        FILE_TYPE_CONFIG,
+                                        os.path.basename(propertiesFile))
                 except:
                     log.error('Display Properties [ ' + propertiesFile + \
-                                  '] Failed', exc_info = 1)
+                                  '] Failed', exc_info=1)
 
             except Exception, details:
                 message = 'Generate Maven Properties Failed:' + str(details)
                 log.error(message, exc_info = 1)
                 project.addError(message)
                 project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
- 
+
     def preview(self, project, _languageHelper, _stats):
-        cmd = getMavenCommand(project) 
+        cmd = getMavenCommand(project)
         cmd.dump()
 

Modified: gump/live/python/gump/core/build/msbuild.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/msbuild.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/msbuild.py (original)
+++ gump/live/python/gump/core/build/msbuild.py Sun Oct 23 10:06:57 2016
@@ -73,7 +73,7 @@ class MSBuildBuilder(RunSpecific):
             project.setBuilt(True)
 
             # Update context state based of the result
-            if not cmdResult.state == CMD_STATE_SUCCESS:
+            if cmdResult.state != CMD_STATE_SUCCESS:
                 reason = REASON_BUILD_FAILED
                 if cmdResult.state == CMD_STATE_TIMED_OUT:
                     reason = REASON_BUILD_TIMEDOUT
@@ -117,14 +117,14 @@ class MSBuildBuilder(RunSpecific):
         # Run MSBuild...
         cmd = Cmd(self.run.env.get_msbuild_command(),
                   'build_' + project.getModule().getName() + '_' + \
-                    project.getName(), 
+                    project.getName(),
                   basedir)
 
         # Allow MSBuild-level debugging...
-        if project.getWorkspace().isDebug() or project.isDebug() or debug: 
+        if project.getWorkspace().isDebug() or project.isDebug() or debug:
             cmd.addParameter('/verbosity:diagnostic')
         if project.getWorkspace().isVerbose() or project.isVerbose() \
-                or verbose: 
+                or verbose:
             cmd.addParameter('/verbosity:detailed')
 
         # These are from the project and/or workspace
@@ -132,7 +132,7 @@ class MSBuildBuilder(RunSpecific):
         cmd.addNamedParameters(properties)
 
         # target (or targets)...
-        if target: 
+        if target:
             cmd.addParameter('/target:' + target)
 
         # Pass the buildfile
@@ -145,6 +145,6 @@ class MSBuildBuilder(RunSpecific):
         """
                 Preview what an MSBuild build would look like.
         """
-        cmd = self.getMSBuildCommand(project) 
+        cmd = self.getMSBuildCommand(project)
         cmd.dump()
- 
+

Modified: gump/live/python/gump/core/build/mvn.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/mvn.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/mvn.py (original)
+++ gump/live/python/gump/core/build/mvn.py Sun Oct 23 10:06:57 2016
@@ -7,15 +7,16 @@
 # 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.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from time import strftime
 import os.path
 
 from gump import log
@@ -31,8 +32,6 @@ from gump.util.process.command import Cm
 from gump.util.process.launcher import execute
 from gump.util.tools import catFileToFileHolder
 
-from time import strftime
-
 ###############################################################################
 # Classes
 ###############################################################################
@@ -44,7 +43,7 @@ def write_mirror_entry(props, prefix, mi
       <name>Apache Gump proxying %s</name>
       <url>http://localhost:%s%s</url>
       <mirrorOf>%s</mirrorOf>
-    </mirror>""" % (mirror_of, mirror_of, port, prefix, mirror_of) )
+    </mirror>""" % (mirror_of, mirror_of, port, prefix, mirror_of))
 
 def locateMavenProjectFile(project):
     """Return Maven project file location"""
@@ -66,7 +65,7 @@ def getMavenProperties(project):
                                                  property.value, '=')
     return properties
 
-def getMavenCommand(project, executable = 'mvn'):
+def getMavenCommand(project, executable='mvn'):
     """ Build an Maven command for this project """
     maven = project.mvn
 
@@ -91,11 +90,11 @@ def getMavenCommand(project, executable
     #
     # Allow maven-level debugging...
     #
-    if project.getWorkspace().isDebug() or project.isDebug() or debug: 
+    if project.getWorkspace().isDebug() or project.isDebug() or debug:
         cmd.addParameter('--debug')
     if project.getWorkspace().isVerbose() \
-            or project.isVerbose() or verbose: 
-        cmd.addParameter('--exception') 
+            or project.isVerbose() or verbose:
+        cmd.addParameter('--exception')
 
     props = getMavenProperties(project)
     cmd.addNamedParameters(props)
@@ -108,7 +107,7 @@ def getMavenCommand(project, executable
         cmd.addPrefixedParameter('-P', profile)
 
     # End with the goal...
-    if goal: 
+    if goal:
         for goalParam in goal.split(','):
             cmd.addParameter(goalParam)
 
@@ -178,7 +177,7 @@ class MavenBuilder(RunSpecific):
                 project.setBuilt(True)
 
                 # Update Context w/ Results
-                if not cmdResult.state == CMD_STATE_SUCCESS:
+                if cmdResult.state != CMD_STATE_SUCCESS:
                     reason = REASON_BUILD_FAILED
                     if cmdResult.state == CMD_STATE_TIMED_OUT:
                         reason = REASON_BUILD_TIMEDOUT
@@ -188,11 +187,11 @@ class MavenBuilder(RunSpecific):
                     project.changeState(STATE_SUCCESS)
 
         if project.wasBuilt():
-            pomFile = locateMavenProjectFile(project) 
+            pomFile = locateMavenProjectFile(project)
             if os.path.exists(pomFile):
-                project.addDebug('Maven POM in: ' + pomFile) 
+                project.addDebug('Maven POM in: ' + pomFile)
                 catFileToFileHolder(project, pomFile, FILE_TYPE_CONFIG)
- 
+
 
     # Do this even if not ok
     def performPreBuild(self, project, languageHelper, _stats):
@@ -206,20 +205,20 @@ class MavenBuilder(RunSpecific):
 
                 try:
                     catFileToFileHolder(project, settingsFile,
-                        FILE_TYPE_CONFIG,
-                        os.path.basename(settingsFile))
+                                        FILE_TYPE_CONFIG,
+                                        os.path.basename(settingsFile))
                 except:
                     log.error('Display Settings [ ' + settingsFile + \
-                                  '] Failed', exc_info = 1)
+                                  '] Failed', exc_info=1)
 
             except Exception, details:
                 message = 'Generate Maven Settings Failed:' + str(details)
-                log.error(message, exc_info = 1)
+                log.error(message, exc_info=1)
                 project.addError(message)
                 project.changeState(STATE_FAILED, REASON_PREBUILD_FAILED)
 
     def preview(self, project, _languageHelper, _stats):
-        command = getMavenCommand(project) 
+        command = getMavenCommand(project)
         command.dump()
 
     def generateMvnSettings(self, project, _languageHelper):
@@ -243,7 +242,7 @@ class MavenBuilder(RunSpecific):
             localRepositoryDir = os.path.abspath(\
                 os.path.join(self.run.getWorkspace()
                              .getLocalRepositoryDirectory(), "shared")
-                )
+                                                )
 
         props = open(settingsFile, 'w')
 
@@ -265,7 +264,7 @@ class MavenBuilder(RunSpecific):
   limitations under the License.
 -->
 <!--
-# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT

+# DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT  DO NOT EDIT
 #
 # File Automatically Generated by Gump, see http://gump.apache.org/
 #

Modified: gump/live/python/gump/core/build/nant.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/nant.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/nant.py (original)
+++ gump/live/python/gump/core/build/nant.py Sun Oct 23 10:06:57 2016
@@ -6,11 +6,11 @@
 # 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, 
+# 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.
@@ -52,7 +52,7 @@ class NAntBuilder(RunSpecific):
     def __init__(self, run):
         """
                 The NAnt Builder is a .NET Builder
-        """ 
+        """
         RunSpecific.__init__(self, run)
 
     def buildProject(self, project, _language, _stats):
@@ -81,7 +81,7 @@ class NAntBuilder(RunSpecific):
             project.setBuilt(True)
 
             # Update context state based of the result
-            if not cmdResult.state == CMD_STATE_SUCCESS:
+            if cmdResult.state != CMD_STATE_SUCCESS:
                 reason = REASON_BUILD_FAILED
                 if cmdResult.state == CMD_STATE_TIMED_OUT:
                     reason = REASON_BUILD_TIMEDOUT
@@ -128,7 +128,7 @@ class NAntBuilder(RunSpecific):
         # Run NAnt...
         cmd = Cmd(self.run.env.get_nant_command(),
                   'build_' + project.getModule().getName() + '_' + \
-                    project.getName(), 
+                    project.getName(),
                   basedir)
 
         # Launch with specified framework (e.g. mono-1.0.1) if
@@ -143,10 +143,10 @@ class NAntBuilder(RunSpecific):
         cmd.addNamedParameters(sysproperties)
 
         # Allow NAnt-level debugging...
-        if project.getWorkspace().isDebug() or project.isDebug() or debug: 
+        if project.getWorkspace().isDebug() or project.isDebug() or debug:
             cmd.addParameter('-debug')
         if project.getWorkspace().isVerbose() or project.isVerbose() \
-                or verbose: 
+                or verbose:
             cmd.addParameter('-verbose')
 
         # Some builds might wish for this information
@@ -164,7 +164,7 @@ class NAntBuilder(RunSpecific):
             cmd.addParameter('-buildfile', buildfile, ':')
 
         # End with the target (or targets)...
-        if target: 
+        if target:
             for targetParam in target.split(', '):
                 cmd.addParameter(targetParam)
 
@@ -174,6 +174,6 @@ class NAntBuilder(RunSpecific):
         """
                 Preview what an NAnt build would look like.
         """
-        cmd = self.getNAntCommand(project) 
+        cmd = self.getNAntCommand(project)
         cmd.dump()
- 
+

Modified: gump/live/python/gump/core/build/nuget.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/nuget.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/nuget.py (original)
+++ gump/live/python/gump/core/build/nuget.py Sun Oct 23 10:06:57 2016
@@ -69,7 +69,7 @@ class NuGetBuilder(RunSpecific):
             project.setBuilt(True)
 
             # Update Context w/ Results
-            if not cmdResult.state == CMD_STATE_SUCCESS:
+            if cmdResult.state != CMD_STATE_SUCCESS:
                 reason = REASON_BUILD_FAILED
                 if cmdResult.state == CMD_STATE_TIMED_OUT:
                     reason = REASON_BUILD_TIMEDOUT

Modified: gump/live/python/gump/core/build/script.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/script.py?rev=1766264&r1=1766263&r2=1766264&view=diff
==============================================================================
--- gump/live/python/gump/core/build/script.py (original)
+++ gump/live/python/gump/core/build/script.py Sun Oct 23 10:06:57 2016
@@ -7,9 +7,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.
@@ -27,25 +27,16 @@ __license__   = "http://www.apache.org/l
 """
 
 import os.path
-import sys
 
 from gump import log
-from gump.core.run.gumprun import *
-from gump.core.config import dir, default, basicConfig
-
-from gump.util import dump, display, getIndent, logResourceUtilization, \
-                            invokeGarbageCollection
-from gump.util.note import Annotatable
-from gump.util.work import *
-
-from gump.util.tools import *
-
-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 *
+from gump.core.run.gumprun import RunSpecific
+#from gump.core.config import setting
+from gump.core.model.state import REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, STATE_FAILED,\
+    STATE_SUCCESS
+
+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
 
 
 ###############################################################################
@@ -57,100 +48,101 @@ def getArgs(script):
     for arg in script.getProperties():
         if arg.name.startswith('--') or not arg.name.startswith('-'):
             if arg.value and arg.value != "*Unset*": # TODO: fix this properly. Ugly!
-                args.addNamedParameter(arg.name,arg.value,'=')
+                args.addNamedParameter(arg.name, arg.value, '=')
             else:
                 args.addParameter(arg.name)
         else:
             args.addParameter(arg.name)
             args.addParameter(arg.value)
     return args
-        
+
 ###############################################################################
 # Classes
 ###############################################################################
 
-class ScriptBuilder(gump.core.run.gumprun.RunSpecific):
-    
-    def __init__(self,run):
+class ScriptBuilder(RunSpecific):
+
+    def __init__(self, run):
         """
         A script 'builder'
         """
-        gump.core.run.gumprun.RunSpecific.__init__(self,run)
+        RunSpecific.__init__(self, run)
 
-    def buildProject(self,project,languageHelper,stats):
+    def buildProject(self, project, languageHelper, stats):
         """
         Run a project's script (a .bat or a .sh as appropriate)
         """
-        
-        workspace=self.run.getWorkspace()
-                 
-        log.info('Run Project (as a script): #[' + `project.getPosition()` + '] : ' + project.getName())
-                
+
+        workspace = self.run.getWorkspace()
+
+        log.info('Run Project (as a script): #[' + `project.getPosition()` +\
+                 '] : ' + project.getName())
+
         #
         # Get the appropriate build command...
         #
-        cmd=self.getScriptCommand(project,languageHelper)
+        cmd = self.getScriptCommand(project, languageHelper)
 
         if cmd:
             # Execute the command ....
-            cmdResult=execute(cmd,workspace.tmpdir)
-    
-            # Update Context    
-            work=CommandWorkItem(WORK_TYPE_BUILD,cmd,cmdResult)
+            cmdResult = execute(cmd, workspace.tmpdir)
+
+            # Update Context
+            work = CommandWorkItem(WORK_TYPE_BUILD, cmd, cmdResult)
             project.performedWork(work)
             project.setBuilt(True)
-                    
-            # Update Context w/ Results  
-            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 w/ Results
+            if 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 getScriptCommand(self,project,languageHelper):
+
+    def getScriptCommand(self, project, languageHelper):
         """ Return the command object for a <script entry """
-        script=project.script
-           
+        script = project.script
+
         # Where to run this:
         basedir = script.getBaseDirectory() or project.getBaseDirectory()
 
-        scriptfullname=script.getName()
-        
+        scriptfullname = script.getName()
+
         # The script
-        scriptfile=os.path.abspath(os.path.join(basedir, scriptfullname))
-        
+        scriptfile = os.path.abspath(os.path.join(basedir, scriptfullname))
+
         # If the script exists (and is a plain file, i.e. not a dir)
         # use it's exact name, else add a platform specific extension.
         if not os.path.exists(scriptfile) \
             or not os.path.isfile(scriptfile):
             # Add .sh  or .bat as appropriate to platform
-            if not os.name in ['dos', 'nt']:
+            if os.name not in ['dos', 'nt']:
                 scriptfullname += '.sh'
             else:
                 scriptfullname += '.bat'
-                                
+
             # Recalculate with the script extension
-            scriptfile=os.path.abspath(os.path.join(basedir, scriptfullname))
-  
+            scriptfile = os.path.abspath(os.path.join(basedir, scriptfullname))
+
         # Needed for (at least) a compiler...
-        (classpath,bootclasspath)=languageHelper.getClasspaths(project)
+        (classpath, bootclasspath) = languageHelper.getClasspaths(project)
+
+        cmd = Cmd(scriptfile,
+                  'buildscript_'+project.getModule().getName()+'_'+project.getName(),
+                  basedir,
+                  {'CLASSPATH':classpath})
 
-        cmd=Cmd( scriptfile,
-                 'buildscript_'+project.getModule().getName()+'_'+project.getName(),
-                 basedir,
-                 {'CLASSPATH':classpath})    
-        
         cmd.addParameters(getArgs(script))
 
         return cmd
-        
-    def preview(self,project,languageHelper,stats):        
+
+    def preview(self, project, languageHelper, stats):
         """
         Preview what this would do
         """
-        command=self.getScriptCommand(project,languageHelper) 
-        command.dump()
+        cmd = self.getScriptCommand(project, languageHelper) 
+        cmd.dump()




Mime
View raw message