Python tools to manipulate JARs ?

2007-01-31 Thread Andy Dingley
I run build processes for a Java shop using Python (and some Ant).

Would anyone care to suggest favoured tools for manipulating the
innards of JARs? Or do I just treat them as plain zipfiles and get
stuck right in there?

Mainly I'm trying to query lists of classes and their embedded
versions and do some library dependency reporting. Performance speed
is starting to be an issue, as there's 1500+ classes in this bucket
and it's an interactive query.

Thanks for any suggestions

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Python tools to manipulate JARs ?

2007-01-31 Thread Sells, Fred
I have not tried this, but...
Assuming jython is out of the question
You might want to try a simple java command line program you could run from
popen

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Behalf Of Andy Dingley
Sent: Wednesday, January 31, 2007 11:11 AM
To: python-list@python.org
Subject: Python tools to manipulate JARs ?


I run build processes for a Java shop using Python (and some Ant).

Would anyone care to suggest favoured tools for manipulating the
innards of JARs? Or do I just treat them as plain zipfiles and get
stuck right in there?

Mainly I'm trying to query lists of classes and their embedded
versions and do some library dependency reporting. Performance speed
is starting to be an issue, as there's 1500+ classes in this bucket
and it's an interactive query.

Thanks for any suggestions

-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python tools to manipulate JARs ?

2007-01-31 Thread Laszlo Nagy
Andy Dingley írta:
> I run build processes for a Java shop using Python (and some Ant).
>
> Would anyone care to suggest favoured tools for manipulating the
> innards of JARs? Or do I just treat them as plain zipfiles and get
> stuck right in there?
>
> Mainly I'm trying to query lists of classes and their embedded
> versions and do some library dependency reporting. Performance speed
> is starting to be an issue, as there's 1500+ classes in this bucket
> and it's an interactive query.
>   
I believe that you can rename any jar file to .zip and use zip tools to 
list its contents.

   Laszlo

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python tools to manipulate JARs ?

2007-01-31 Thread [EMAIL PROTECTED]
On Jan 31, 1:50 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
> Andy Dingley írta:> I run build processes for a Java shop using Python (and 
> some Ant).
>
> > Would anyone care to suggest favoured tools for manipulating the
> > innards of JARs? Or do I just treat them as plain zipfiles and get
> > stuck right in there?
>
> > Mainly I'm trying to query lists of classes and their embedded
> > versions and do some library dependency reporting. Performance speed
> > is starting to be an issue, as there's 1500+ classes in this bucket
> > and it's an interactive query.
>
> I believe that you can rename any jar file to .zip and use zip tools to
> list its contents.
>
>Laszlo


To print out the classes you can use zipfile
it will list the contents of a jar file also


import zipfile

zf = zipfile.ZipFile("some.jar")

for info in zf.infolist():
print  info.filename

Or print to a file

import zipfile

zf = zipfile.ZipFile("some.jar")

for info in zf.infolist():
classes = info.filename
myfile = file("classes.txt", 'w')
print >> myfile, classes


Enjoy
-Rob Marchetti

-- 
http://mail.python.org/mailman/listinfo/python-list