Cleanup manifest code
This commit is contained in:
parent
956d552e10
commit
1e58df6034
|
@ -231,30 +231,36 @@ class FileHelpers:
|
||||||
class Manifest:
|
class Manifest:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print_to_stdout (s, strict = True):
|
def read (s, strict = True):
|
||||||
|
|
||||||
if not os.path.exists (s):
|
if not os.path.exists (s):
|
||||||
if strict:
|
if strict:
|
||||||
print >> sys.stderr, "%s: %s does not exist" (sys.argv[0], s)
|
print >> sys.stderr, "%s: %s does not exist" (sys.argv[0], s)
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
return
|
return
|
||||||
|
|
||||||
if os.path.isdir (s):
|
s = os.path.normpath (s)
|
||||||
|
|
||||||
if s[-1] in '/\\':
|
if os.path.isdir (s):
|
||||||
s = s[:-1]
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
m = file (os.path.join (s, "MANIFEST"))
|
m = file (os.path.join (s, "MANIFEST"))
|
||||||
items = [x.strip () for x in m.readlines ()]
|
items = [x.strip () for x in m.readlines ()]
|
||||||
for f in items:
|
for f in items:
|
||||||
Manifest.print_to_stdout (s + f)
|
for p in Manifest.read (os.path.join (s, f)):
|
||||||
|
yield p
|
||||||
except IOError:
|
except IOError:
|
||||||
if strict:
|
if strict:
|
||||||
print >> sys.stderr, "%s: %s does not exist" (sys.argv[0], os.path.join (s, "MANIFEST"))
|
print >> sys.stderr, "%s: %s does not exist" (sys.argv[0], os.path.join (s, "MANIFEST"))
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
print s
|
yield s
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def print_to_stdout (s, strict = True):
|
||||||
|
for f in Manifest.read (s, strict=strict):
|
||||||
|
print f
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_recursive (s):
|
def update_recursive (s):
|
||||||
|
|
Loading…
Reference in New Issue