18 from __future__
import with_statement, print_function
20 from future
import standard_library
21 standard_library.install_aliases()
24 print (
":: extracting GUID for [%i] files... "% len(files))
27 sc,exe = subprocess.getstatusoutput(
'which pool_extractFileIdentifier')
29 print (
":: could not find 'pool_extractFileIdentifier' !")
33 cmd =
"%s %s" % (exe,
" ".
join(files))
34 sc, out = subprocess.getstatusoutput(cmd)
36 out = os.linesep.join(
37 [o
for o
in out.splitlines()
38 if not (o.startswith(
"Warning in <TClass::TClass>: no dictionary for class ")
or
39 o.startswith(
'Warning in <TEnvRec::ChangeValue>: duplicate entry'))]
43 print (
":: problem running pool_extractFileIdentifier:")
48 print (
":: extracting GUID for [%i] files... [done]" % len(files))
51 if __name__ ==
"__main__":
53 from optparse
import OptionParser
54 parser = OptionParser(usage=
"%prog file1.pool [file2.pool [...]]")
55 parser.add_option(
"-f",
"--files",
57 help =
"(list of) files to extract the GUID(s) from")
58 options, args = parser.parse_args()
62 files = [ arg
for arg
in args
if arg[0] !=
"-" ]
65 if options.files
is None and len(files) == 0:
66 str(parser.print_help()
or "")
67 print (
":: You have to provide at least one POOL file to extract a GUID from:")
68 print (
" shell> pool_extractFileIdentifier.py aod.pool")
71 if not (options.files
is None):
73 for f
in options.files.split():
74 f = os.path.expandvars(os.path.expanduser(f))