Re: [jira] Updated: (GUMP-149) allow gump to bootstrap maven
I have almost completed all the changes. As for Index: pygump/python/gump/util/executor.py === --- pygump/python/gump/util/executor.py (revision 233131) +++ pygump/python/gump/util/executor.py (working copy) @@ -38,7 +38,7 @@ __copyright__ = Copyright (c) 2004-2005 The Apache Software Foundation __license__ = http://www.apache.org/licenses/LICENSE-2.0; -import sys +import sys, os I was getting this error while calling --do-updates, and found importing the os in executor.py fixed it. 09:16:13 ERROR ---apr--exception--exceptions.NameError:global name 'os' is not defined--: File C:\cygwin\home\merz\gump3_normal\pygump\python\gump\engine\algorithm.py , line 234, in _visit_module visitor._visit_module(module) File C:\cygwin\home\merz\gump3_normal\pygump\python\gump\plugins\__init__.py , line 112, in _visit_module self.visit_module(module) File C:\cygwin\home\merz\gump3_normal\pygump\python\gump\plugins\updater.py, line 109, in visit_module self.checkout(module, modulepath) File C:\cygwin\home\merz\gump3_normal\pygump\python\gump\plugins\updater.py, line 119, in checkout svn = Popen(['svn', 'checkout', repository, '.'], cwd=cwd, stdout=PIPE, stde rr=STDOUT) File C:\cygwin\home\merz\gump3_normal\pygump\python\gump\util\executor.py, l ine 62, in __init__ _log.info(Executing command:\n %s'%s'%s\n in directory ' %s' % (ansicolor.Blue, .join(args), ansicolor.Black, os.path.abspath(cwd or os.curdir))) -Justin whoohooh! A patch! Looks pretty sweet. Before we chuck it in, some comments... First of, I presume you have some tests (eg project.xml files and a sample workspace) against which you run this code. Could you submit those too? +def __init__(self, project, target, buildfile=maven.xml, basedir=None, properties=None): Isn't using 'maven.xml' mandatory? I think you can set the POM but not the buildfile... + #command line + args = [maven jar ] If I'm not mistaken args should be one-entry per array, eg [maven, jar] also, the target defined in the model as above is probably the maven goal to use instead of the hardcoded jar? Leo Simons wrote: Index: pygump/python/gump/engine/map.py could map.py go into gump/util or gump/plugins/java somewhere? Also, it'd be cool if this could be a config file of some sort that is read in, perhaps a format as simple as avalon-framework avalon-framework-api axis ws-axis Note that the 'gump' plugin for maven has many more of these mappings that would be nice to steal. Index: pygump/python/gump/engine/mavenizer.py === + if maven_node: + #parse DOM creating new gumped-maven file + #then return file location to be used instead + #of original maven file + gumped_maven_href = _parse_maven_file( maven_node, download_func, get_vfs ) + return gumped_maven_href + else: + return 'broken' you want to 'raise' an exception here. +def _parse_maven_file( project, download_func, get_vfs ): this looks pretty comprehensive! + mavenfile = open(%s\\%s % (home_dir, filename), w) ^^^ use os.path.seperator (or whatever its called) however, using the StringIO module would probably avoid the need for using a file at all, which would rock even more. Index: pygump/python/gump/config.py === --- pygump/python/gump/config.py(revision 233131) +++ pygump/python/gump/config.py(working copy) @@ -105,6 +105,7 @@ log.info(Not running updates! (pass --do-updates to enable them)) if config.do_build: + from gump.model import Maven from gump.model import Ant from gump.model import Script looks like a TAB character in there. Seems there's several more in your patch. Please get rid of those and just use spaces :) Index: pygump/python/gump/util/executor.py === --- pygump/python/gump/util/executor.py (revision 233131) +++ pygump/python/gump/util/executor.py (working copy) @@ -38,7 +38,7 @@ __copyright__ = Copyright (c) 2004-2005 The Apache Software Foundation __license__ = http://www.apache.org/licenses/LICENSE-2.0; -import sys +import sys, os huh, what? Why? Seems there's a few loose ends in the patch... Index: pygump/python/gump/util/io.py === --- pygump/python/gump/util/io.py (revision 233131) +++ pygump/python/gump/util/io.py (working copy) @@ -99,6 +99,9 @@ self.cachedir = os.path.normpath(os.path.abspath(cachedir)) else:
Re: [jira] Updated: (GUMP-149) allow gump to bootstrap maven
whoohooh! A patch! Looks pretty sweet. Before we chuck it in, some comments... First of, I presume you have some tests (eg project.xml files and a sample workspace) against which you run this code. Could you submit those too? +def __init__(self, project, target, buildfile=maven.xml, basedir=None, properties=None): Isn't using 'maven.xml' mandatory? I think you can set the POM but not the buildfile... + #command line + args = [maven jar ] If I'm not mistaken args should be one-entry per array, eg [maven, jar] also, the target defined in the model as above is probably the maven goal to use instead of the hardcoded jar? Leo Simons wrote: Index: pygump/python/gump/engine/map.py could map.py go into gump/util or gump/plugins/java somewhere? Also, it'd be cool if this could be a config file of some sort that is read in, perhaps a format as simple as avalon-framework avalon-framework-api axis ws-axis Note that the 'gump' plugin for maven has many more of these mappings that would be nice to steal. Index: pygump/python/gump/engine/mavenizer.py === + if maven_node: + #parse DOM creating new gumped-maven file + #then return file location to be used instead + #of original maven file + gumped_maven_href = _parse_maven_file( maven_node, download_func, get_vfs ) + return gumped_maven_href + else: + return 'broken' you want to 'raise' an exception here. +def _parse_maven_file( project, download_func, get_vfs ): this looks pretty comprehensive! + mavenfile = open(%s\\%s % (home_dir, filename), w) ^^^ use os.path.seperator (or whatever its called) however, using the StringIO module would probably avoid the need for using a file at all, which would rock even more. Index: pygump/python/gump/config.py === --- pygump/python/gump/config.py (revision 233131) +++ pygump/python/gump/config.py (working copy) @@ -105,6 +105,7 @@ log.info(Not running updates! (pass --do-updates to enable them)) if config.do_build: + from gump.model import Maven from gump.model import Ant from gump.model import Script looks like a TAB character in there. Seems there's several more in your patch. Please get rid of those and just use spaces :) Index: pygump/python/gump/util/executor.py === --- pygump/python/gump/util/executor.py (revision 233131) +++ pygump/python/gump/util/executor.py (working copy) @@ -38,7 +38,7 @@ __copyright__ = Copyright (c) 2004-2005 The Apache Software Foundation __license__ = http://www.apache.org/licenses/LICENSE-2.0; -import sys +import sys, os huh, what? Why? Seems there's a few loose ends in the patch... Index: pygump/python/gump/util/io.py === --- pygump/python/gump/util/io.py (revision 233131) +++ pygump/python/gump/util/io.py (working copy) @@ -99,6 +99,9 @@ self.cachedir = os.path.normpath(os.path.abspath(cachedir)) else: self.cachedir = None + +def return_path(self): + return self.filesystem_root feel free to just use the property directly, eg replace calls to myvfs.return_path() with simply myvfs.filesystem_root instead of writing accessors. Sun did the world a lot of harm by inventing getters/setters for java. Python certainly doesn't need them. cheers, Leo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[jira] Updated: (GUMP-149) allow gump to bootstrap maven
[ http://issues.apache.org/jira/browse/GUMP-149?page=all ] Justin Merz updated GUMP-149: - Attachment: gump-maven-patch.txt allow gump to bootstrap maven - Key: GUMP-149 URL: http://issues.apache.org/jira/browse/GUMP-149 Project: Gump Type: New Feature Components: Python-based Gump Versions: Gump3-alpha-5 Reporter: Justin Merz Attachments: gump-maven-patch.txt Allowing gump to read a maven project descriptor file. There must be a type=maven flag added to the module calling the maven project. Gump then creates its own project descriptor file from the maven file and calls the new gump file into the workspace. In the creation of the new gump-maven file a maven tag is added. This contains necessary information for gump to build a maven project using gumps maven plug-in. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]