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

Source Code for Module EDInstallPyfftw3v0_2_1

 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  #                         Jérôme 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 fftw3 version 0.2.1""" 
31   
32  __authors__ = ["Olof Svensson", "Jérôme Kieffer"] 
33  __contact__ = "jerome.kieffer@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  from EDFactoryPluginStatic      import EDFactoryPluginStatic 
51   
52  moduleName = "fftw3" 
53  modulePath = os.path.join(os.environ["EDNA_HOME"], "libraries", "pyfftw3-0.2.1", EDUtilsPlatform.architecture) 
54  moduleVersion = "0.2.1" 
55   
56  ################################################################################ 
57  # Import the right (i.e ANY) version of  fftw3 
58  ################################################################################ 
59   
60  oModule = EDFactoryPluginStatic.preImport(moduleName) 
61  if not oModule: 
62      oModule = EDFactoryPluginStatic.preImport(moduleName) 
63      if oModule is None: 
64          installLibrary(modulePath) 
65          oModule = EDFactoryPluginStatic.preImport(moduleName, modulePath) 
66          version = "0.2.1" 
67   
68  if oModule is None: 
69      EDVerbose.ERROR("Unable to download, compile or install module %s" % moduleName) 
70  else: 
71      EDVerbose.screen("Version of %s: from %s" % (moduleName, oModule.__file__)) 
72