Script edna_plugin_launcher_py
[hide private]
[frames] | no frames]

Source Code for Script script-edna_plugin_launcher_py

 1  #!/usr/bin/env python  
 2  #-*- coding: UTF8 -*- 
 3  # 
 4  #    Project: The EDNA Kernel 
 5  #             http://www.edna-site.org 
 6  # 
 7  #    File: "$Id$" 
 8  # 
 9  #    Copyright (C) 2008-2010 European Synchrotron Radiation Facility 
10  #                            Grenoble, France 
11  # 
12  #    Principal author: Olof Svensson (svensson@esrf.fr)  
13  #                      Jérôme Kieffer (kieffer@srf.fr) 
14  # 
15  #    This program is free software: you can redistribute it and/or modify 
16  #    it under the terms of the GNU Lesser General Public License as published 
17  #    by the Free Software Foundation, either version 3 of the License, or 
18  #    (at your option) any later version. 
19  # 
20  #    This program is distributed in the hope that it will be useful, 
21  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
22  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
23  #    GNU Lesser General Public License for more details. 
24  # 
25  #    You should have received a copy of the GNU General Public License 
26  #    and the GNU Lesser General Public License  along with this program.   
27  #    If not, see <http://www.gnu.org/licenses/>. 
28  # 
29   
30  __authors__ = ["Olof Svensson", "Jerome Kieffer"] 
31  __contact__ = "svensson@esrf.fr" 
32  __license__ = "GPLv3" 
33  __date__ = "2010-02-02" 
34  __copyright__ = "ESRF" 
35   
36  # 
37  # Set up PYTHON path for the EDNA kernel 
38  # 
39  # First locate EDNA_HOME 
40  # 
41   
42   
43  import sys, os.path 
44  pyStrProgramPath = os.path.abspath(sys.argv[0]) 
45  pyStrBinPath = os.path.split(pyStrProgramPath)[0] 
46  pyStrKernelPath = os.path.split(pyStrBinPath)[0] 
47  pyStrEdnaHomePath = os.path.split(pyStrKernelPath)[0] 
48  os.environ["EDNA_HOME"] = pyStrEdnaHomePath 
49  # 
50  # Then add kernel/src to PYTHONPATH 
51  # 
52  sys.path.append(os.path.join(pyStrEdnaHomePath, "kernel", "src")) 
53  # 
54  # Now the EDApplication can be imported and started 
55  # 
56  from EDApplication import EDApplication 
57  edApplication = EDApplication() 
58  edApplication.execute() 
59