gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Simons <m...@leosimons.com>
Subject Re: Getting project file name from module
Date Fri, 08 Jul 2005 19:21:19 GMT
Hi Justin!

Justin Merz wrote:
> Since gump3 does not recoginze maven project descriptor files I am
> trying to access the file name from the module descriptor file (/tag if
> in same file). 

Actually, I think that gump, in the form of the Loader component,
manages to load the descriptor just fine. Eg it if you have

<workspace>
  ...
  <projects>
    ...
    <project href="somemavendescriptor.xml">
    </project>
  </projects>
  ...
</workspace>

then the Loader will get hold of somemavendescriptor.xml, and replace
said <project/> with the contents of that descriptor. But my memory is a
bit sketchy, and that's probably not tested. Might be a good idea ;)

> I believe the project descriptor tag is removed from the
> module file and placed into a dropped_tags list.

Hmm. I don't think so. I think after the "loading" stage is complete the
descriptors are still in the workspace.

> Is there anyway to
> access this list ie functions already written

Not really, but Engine._write_merge_files() does iterate over that list
and writes a new xml file. You might find it helpful. And the other bits
of gump.engine do a lot of xml manipulation to spy on. But no doubt
you're still going to have to figure out loads of DOM stuff :-)

See http://www.python.org/doc/current/lib/module-xml.dom.html

> or does anyone have a
> better idea how to access all of module's data by the time normalizer
> gets ahold of it?

In the example above, maybe we could have

<workspace>
  ...
  <projects>
    ...
    <project type="maven" href="somemavendescriptor.xml">
    </project>
  </projects>
  ...
</workspace>

And then you could build a Mavenizer component that does something like this

  projects = w.getElementsByTagName("project")
  for p in [p for p projects if p.getAttribute("type") == "maven"]:
      magic_goes_here()

Or maybe there's a good way to detect that we're dealing with a maven
definition (eg if all maven xml files always have a pomVersion or
something). I dunno. If you do an 'svn log' on normalizer.py and/or look
through the mailing list archives you might find ideas some of us had at
some point. But I'd just do the thinking myself if I were you ;)

> PS. please let me know if you think i am going in the wrong direction on
> this!

Nope, just keep going :-). Once you've got your first patch together
I'll try and give you more feedback to shake a stick at :-)

cheers,

Leo

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message