1 from __future__
import print_function
8 log = logging.getLogger(__name__)
11 result = open(template).read()
15 print(
"Replacing",old,
"to",new)
16 result = result.replace(old,new)
21 datasetstr = datasetpath
23 if datasetstr[0] ==
'/': datasetstr = datasetstr[1:]
24 datasetstr = datasetstr.replace(
'/',
'_')
31 if not os.path.exists( path ):
32 log.error(
"Specified input path '%s' does not exist!" % path )
34 if path.endswith( extension ):
35 file_paths.append( path )
36 for root, dirnames, filenames
in os.walk( path ):
37 for filename
in fnmatch.filter( filenames,
'*' + extension ):
38 file_paths.append( os.path.join( root, filename ) )
41 def haddLocal(localdir,result_file,extension = 'root'):
42 if not os.path.exists( localdir ):
43 raise ValueError(
"localdir for hadd operation does not exist" )
46 process = subprocess.Popen( [
'hadd',
'-f', result_file] + files,
47 stdout=subprocess.PIPE,
48 stderr=subprocess.STDOUT)
49 stdout = process.communicate()[0]
50 return process.returncode
53 pset = imp.load_source(
"psetmodule",psetName)
57 module = __import__(psetPath)
58 process = sys.modules[psetPath].process
63 processNew = copy.copy(process)
67 for path
in process.paths:
68 getattr(process,path)._seq = getattr(process,seqname)*getattr(process,path)._seq
70 def stdinWait(text, default, time, timeoutDisplay = None, **kwargs):
72 signal.signal(signal.SIGALRM, interrupt)
79 except (KeyboardInterrupt):
80 printInterrupt = kwargs.get(
"printInterrupt",
True)
82 print(
"Keyboard interrupt")
87 if not timeoutDisplay
is None:
100 def ioctl_GWINSZ(fd):
102 import fcntl, termios, struct, os
103 cr = struct.unpack(
'hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,
108 cr = ioctl_GWINSZ(0)
or ioctl_GWINSZ(1)
or ioctl_GWINSZ(2)
111 fd = os.open(os.ctermid(), os.O_RDONLY)
112 cr = ioctl_GWINSZ(fd)
117 cr = (env.get(
'LINES', 25), env.get(
'COLUMNS', 80))
124 return int(cr[1]),
int(cr[0])
S & print(S &os, JobReport::InputFile const &f)