8 return os.path.realpath(os.path.abspath(os.path.expanduser(path)))
14 with tempfile.TemporaryFile()
as cout, open(os.devnull)
as cerr:
15 subprocess.check_call([
"scramv1",
"runtime",
"-sh"],stdout=cout,stderr=cerr)
17 for byte_line
in cout:
18 line = byte_line.decode(
"utf-8").strip()
19 if line[0:6] ==
"unset ":
20 var_list = line.split()[1:]
23 elif line[0:7] ==
"export ":
24 vname, vval = line[7:].rstrip(
";").split(
"=")
25 os.environ[vname] = vval.strip(
'"')
27 raise Exception(
"Did not understand line: {}".format(line))
34 return self.
path+
" is not a ROOT file" 41 return "Could not open "+self.
path+
" in "+self.
mode+
" mode" 45 if os.path.splitext(path)[1] !=
".root":
51 if self.file.IsZombie()
or not self.file.IsOpen():
def __init__(self, path, mode)
def __exit__(self, type, value, traceback)
def __init__(self, path, mode)