summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'distfiles-indexer.py')
-rwxr-xr-xdistfiles-indexer.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/distfiles-indexer.py b/distfiles-indexer.py
index 49590f2..b6fb7aa 100755
--- a/distfiles-indexer.py
+++ b/distfiles-indexer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.4
+#!/usr/bin/env python
import tarfile
import zipfile
@@ -7,7 +7,6 @@ import sys
import datetime
try:
- # FIXME: this does not work
import hashlib
md5_cons = hashlib.md5
sha1_cons = hashlib.sha1
@@ -128,37 +127,35 @@ class ArchiveInfo:
def main():
import getopt
try:
- optlist, list = getopt.getopt(sys.argv[1:],
- 'f:P:hu:')
+ optlist, files = getopt.getopt(sys.argv[1:],
+ 'P:hu:')
except getopt.GetoptError:
usage(sys.argv[0])
sys.exit(2)
- infilename = None
outdir = "."
for opt, arg in optlist:
if opt == '-h':
usage(sys.argv[0])
sys.exit(0)
- if opt == '-f':
- infilename = arg
if opt == '-P':
outdir = arg
- if not infilename:
+ if len(files) == 0:
print "Please specify a filename."
else:
- try:
- a = ArchiveInfo(infilename)
- filename = a.write_info(outdir)
- except:
- print infilename, " could not be opened"
+ for infilename in files:
+ try:
+ a = ArchiveInfo(infilename)
+ filename = a.write_info(outdir)
+ except Error, e:
+ print infilename, " could not be opened: %s" % str(e)
def usage(programname):
""" Print usage information """
- print "Usage: %s [-h] [-P <dir>] [-f <file>]" % (programname)
+ print "Usage: %s [-h] [-P <dir>] <file> [<file> ..]" % (programname)
print '''
-This script opens the file specified by -f, and writes the index to the directory specified by -P.
+This script opens the file(s) specified, and writes the index to the directory specified by -P.
Parameters:
-h Display this help