Changeset 17803 for fact


Ignore:
Timestamp:
05/08/14 07:43:55 (11 years ago)
Author:
dneise
Message:
adjusted libz loading to new_pyfact/pyfact.py
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/pyscripts/pyfact/pyfact.py

    r17794 r17803  
    44# ETH Zurich, TU Dortmund
    55#
     6import sys
    67from ctypes import *
    78import numpy as np
     
    1516# having it in PYTHONPATH is *not* sufficient
    1617hostname = ROOT.gSystem.HostName()
    17 if 'isdc' in hostname:
    18     ROOT.gSystem.Load("/usr/lib64/libz.so")
    19 elif ('neiseLenovo' in hostname or 'factcontrol' in hostname):
    20     ROOT.gSystem.Load("/usr/lib/libz.so")
    21 elif ("max-K50AB" in hostname or "watz" in hostname or "TPK-Ubuntu" in hostname):
    22     ROOT.gSystem.Load("/usr/lib/x86_64-linux-gnu/libz.so")
    23 elif ("grolsch" in hostname):
    24     ROOT.gSystem.Load("/usr/lib/i386-linux-gnu/libz.so")
    25 else:
    26     print "Error,Warning,Whatever libz stuff makes me crazy."
     18libz_path_dict = {
     19    # hostname  :   /path/to/libz.so
     20    'isdc'          : "/usr/lib64/libz.so",
     21    'neiseLenovo'   : "/usr/lib/libz.so",
     22    'factcontrol'   : "/usr/lib/libz.so",
     23    "max-K50AB"     : "/usr/lib/x86_64-linux-gnu/libz.so",
     24    "watz"          : "/usr/lib/x86_64-linux-gnu/libz.so",
     25    "grolsch"       : "/usr/lib/i386-linux-gnu/libz.so",
     26}
     27libz_loaded = False
     28for my_hostname in libz_path_dict:
     29    if my_hostname in hostname:
     30        ROOT.gSystem.Load(libz_path_dict[my_hostname])
     31        libz_loaded = True
     32if not libz_loaded:
     33    print """Warning - Warning - Warning - Warning - Warning - Warning - Warning
     34    I most probably need to load libz.so but I don't know where it is.
     35   
     36    Please edit pyfact.py around line 16-24 and insert your hostname and your
     37    path to your libz.so
     38    Sorry for the inconvenience.
     39    """
     40    sys.exit(-1)
     41
    2742   
    2843root_make_string = ROOT.gSystem.GetMakeSharedLib()
     
    10151030if __name__ == '__main__':
    10161031    """ tests  """
    1017     import sys
    10181032   
    10191033    f = fits(sys.argv[1])
Note: See TracChangeset for help on using the changeset viewer.