You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2003/04/18 16:58:35 UTC
[PATCH][gump.py] Implemented remote descriptor caching V1
I've implemented a simple caching for remote descriptors. Basically I
make a filename from the descriptor URL and use that to cache locally
the file. Then all continues as for the local descriptors. In subsequent
runs, the cached version is used.
I tried it with the nice gumpview.py script and I can see all the remote
descriptors too, cool :-)
<newbie> if I do dump('project',cocoon-2.1) it tells me that it cannot
find cocoon... why is the '-' giving problems?</newbie>
Since this works, next thing is to try and run Ant projects.
The full file is attached, below is the snippet starting at line 89.
if href:
if href.startswith('http://'): #if it's a remote descriptor
if debug: print 'url: ' + href
cachedir = './cache/' #here is where remote descriptors are cached
if not os.path.exists(cachedir): #if there is no cache dir
mkdir(cachedir) #create it
quotedHref = urllib.quote_plus(href) #the name of the cached
descriptor
newHref = cachedir+quotedHref #the path of the cached descriptor
if os.path.exists(newHref): #if a cached descriptor exists, all ok
if debug: print 'using cached descriptor'
else: #else, we have to download it to the cache
if debug: print 'caching...'
urllib.urlretrieve(href, cachedFile)
if debug: print '...done'
else:
newHref=href; #it's a local file, get it from there
if debug: print 'opening: ' + newHref + '\n'
element=SAXDispatcher(open(newHref),cls.__name__.lower(),cls).docElement
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: [PATCH][gump.py] Implemented remote descriptor caching V1
Posted by Nicola Ken Barozzi <ni...@apache.org>.
Nicola Ken Barozzi wrote, On 18/04/2003 16.58:
...
> The full file is attached
...now ;-)
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
[PATCH][gump.py] Project dependency resolving implemented
Posted by Nicola Ken Barozzi <ni...@apache.org>.
The attached files have a cleaned up descriptor caching and an initial
project dependency resolving. It resolves the dependencies for <depend>
elements but not yet <option> elements.
This merge+resolve run takes *2 seconds* on my 1Ghz machine.
Bye bye old merge! ;-P
IIUC this is basically ready to really start building. I just need to
run the right target on each project, and voilĂ ! Ok, ok, there are other
things to do, but I'm nevertheless impressed by how it's coming out in
Python. Hey, did I already say this? Ok, ok ;-)
For now I will just add things as I see I need them, so probably I won't
bother now with the option tag, and go straight to trying to do runs.
To test just do
python build.py
To use a particular descriptor (rubix.xml) and a particular project
(cocoon), do:
python build.py rubix.xml cocoon
As an example, attached is also what I get when running cocoon.
Enjoy :-D
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: [PATCH][gump.py] Implemented remote descriptor caching V1
Posted by Nicola Ken Barozzi <ni...@apache.org>.
Sam Ruby wrote, On 19/04/2003 12.26:
> Nicola Ken Barozzi wrote:
>
>> <newbie> if I do dump('project',cocoon-2.1) it tells me that it
>> cannot find cocoon... why is the '-' giving problems?</newbie>
>
> It looks to me that you are trying to subtract the floating point value
> '2.1' from the value of the variable named cocoon. And there is no such
> variable to be found.
:,-)) How dumb...
>
> What I believe you want instead is something along the lines of:
>
> project=Project.list['cocoon-2.1']
> dump('project',project)
I just found it out yesterday night... ugh...
Thanks :-)
I'm now writing the project build chain unrolling, hope to finish it,
time and Pyton learning permitting, very soon.
After the initial excitement about Python, I'm starting to see some
shortcomings. Alas, it's not the perfect language ;-)
But more I go forward, more I'm confident that Gump has to be in Python:
1) it's very readable, hence quickly hackable
2) it's cross-platform
3) for what we need it's probably faster than Java
http://twistedmatrix.com/users/glyph/rant/python-vs-java.html
I looked at the libraries for Python and they are really cool. There is
a nice one called py2exe, that makes an exe from the py file. Really nice.
:-D
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: [PATCH][gump.py] Implemented remote descriptor caching V1
Posted by Sam Ruby <ru...@apache.org>.
Nicola Ken Barozzi wrote:
>
> <newbie> if I do dump('project',cocoon-2.1) it tells me that it cannot
> find cocoon... why is the '-' giving problems?</newbie>
It looks to me that you are trying to subtract the floating point value
'2.1' from the value of the variable named cocoon. And there is no such
variable to be found.
What I believe you want instead is something along the lines of:
project=Project.list['cocoon-2.1']
dump('project',project)
- Sam Ruby