Module EDInstallSpecClient
[hide private]
[frames] | no frames]

Source Code for Module EDInstallSpecClient

 1  #!/usr/bin/env python 
 2  # -*- coding: utf8 -*- 
 3  # 
 4  #    Project: EDNA Libraries 
 5  #             http://www.edna-site.org 
 6  # 
 7  #    File: "$Id$" 
 8  # 
 9  #    Copyright (C) European Synchrotron Radiation Facility, Grenoble, France 
10  # 
11  #    Principal authors:   Olof Svensson (svensson@esrf.fr) 
12  #                         Jerome Kieffer (Jerome.Kieffer@ESRF.eu) 
13  # 
14  #    This program is free software: you can redistribute it and/or modify 
15  #    it under the terms of the GNU General Public License as published by 
16  #    the Free Software Foundation, either version 3 of the License, or 
17  #    (at your option) any later version. 
18  # 
19  #    This program is distributed in the hope that it will be useful, 
20  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
21  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
22  #    GNU General Public License for more details. 
23  # 
24  #    You should have received a copy of the GNU General Public License 
25  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
26  # 
27  # 
28  # 
29   
30  """EDNA installer for SpecClient""" 
31   
32  __authors__ = ["Olof Svensson", "Jerome Kieffer"] 
33  __contact__ = "svensson@esrf.fr" 
34  __license__ = "GPLv3+" 
35  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
36  __date__ = "20110722" 
37  import os, sys 
38  if "EDNA_HOME" not in os.environ: 
39      EDNA_HOME = os.path.dirname(os.path.dirname(__file__)) 
40      os.environ["EDNA_HOME"] = EDNA_HOME 
41  else: 
42      EDNA_HOME = os.environ["EDNA_HOME"] 
43  kernel_src = os.path.join(EDNA_HOME, "kernel", "src") 
44  if kernel_src not in sys.path: 
45      sys.path.append(kernel_src) 
46   
47  from EDVerbose import EDVerbose 
48  from EDUtilsPlatform import EDUtilsPlatform 
49  from EDUtilsLibraryInstaller             import EDUtilsLibraryInstaller, installLibrary 
50   
51  specClientPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "SpecClient", EDUtilsPlatform.architecture) 
52   
53  ############################################################################### 
54  # Import the right version of SpecClient 
55  ############################################################################### 
56  try: 
57      import SpecClient 
58  except ImportError: 
59      if  os.path.isdir(specClientPath) and (specClientPath not in sys.path): 
60          sys.path.insert(1, specClientPath) 
61      else: 
62          installLibrary(specClientPath) 
63      import SpecClient 
64