source: fact/tools/pyscripts/pyfact/next_steps/install.py@ 18729

Last change on this file since 18729 was 17689, checked in by dneise, 11 years ago
some new deveolpment. not really working .. just some thoughts
File size: 2.1 KB
Line 
1import sys
2import os
3
4if len(sys.argv) > 1:
5 path_to_libz_so = sys.argv[1]
6else:
7 path_to_libz_so = None
8
9def readlinkabs(l):
10 """
11 Return an absolute path for the destination
12 of a symlink
13 """
14 assert (os.path.islink(l))
15 p = os.readlink(l)
16 if os.path.isabs(p):
17 return p
18 return os.path.join(os.path.dirname(l), p)
19
20def find_libz():
21 print "Searching for libz.so ..."
22 search_pathes = ['/usr']
23 found_pathes = []
24
25 for sp in search_pathes:
26 find_result = os.popen("find %s | grep libz.so"%sp).readlines()
27 for line in find_result:
28 found_pathes.append(line.split())
29 if len(found_pathes) == 0:
30 print "Error: libz.so not found!"
31 return None
32 elif len(found_pathes) > 1:
33 print "Error: Multiple Possibilities found, please choose one from:"
34 print found_pathes
35 return None
36 else:
37 print "Found libz.so in", found_pathes[0]
38 return found_pathes[0]
39
40
41print "Welcome to the pyfact installer"
42print "-------------------------------"
43
44print "Trying to import ROOT"
45try:
46 import ROOT
47 root_available = True
48except ImportError:
49 root_available = False
50
51if not root_available:
52 print "Was not able to import ROOT ... aborting"
53 sys.exit(1)
54
55print "Found ROOT Version", ROOT.gROOT.GetVersion(), "in", ROOT.__file__
56print
57print "Checking if libz is already loaded into ROOT."
58print "(Please ignore ROOT ouput):"
59libz_loaded_check = ROOT.gSystem.Load("libz")
60print " End of ROOT output"
61if libz_loaded_check != 1:
62 print "libz is not loaded into ROOT"
63 if not path_to_libz_so:
64 print "Searching for libz.so ..."
65 path_to_libz_so = find_libz()
66 if not path_to_libz_so:
67 print "Was not able to find unique libz.so path ... aborting"
68 sys.exit(1)
69 ROOT.gSystem.Load(path_to_libz_so)
70
71print "Compiling C++ headers with ACliC"
72ROOT.gROOT.ProcessLine(".L extern_Mars_mcore/izstream.h+O");
73ROOT.gROOT.ProcessLine(".L fits.h+O");
74ROOT.gROOT.ProcessLine(".L extern_Mars_mcore/zfits.h+O");
75ROOT.gROOT.ProcessLine(".L extern_Mars_mcore/factfits.h+O");
76ROOT.gROOT.ProcessLine(".L calfactfits.h+O");
77
78print
79print "done."
80sys.exit(0)
Note: See TracBrowser for help on using the repository browser.