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

Source Code for Module install

  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 author:       Jerome Kieffer (Jerome.Kieffer@ESRF.eu) 
 12  # 
 13  #    This program is free software: you can redistribute it and/or modify 
 14  #    it under the terms of the GNU General Public License as published by 
 15  #    the Free Software Foundation, either version 3 of the License, or 
 16  #    (at your option) any later version. 
 17  # 
 18  #    This program is distributed in the hope that it will be useful, 
 19  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 20  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 21  #    GNU General Public License for more details. 
 22  # 
 23  #    You should have received a copy of the GNU General Public License 
 24  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 25  # 
 26  # 
 27  # 
 28   
 29  """EDNA-Builder for the FFTw3 library""" 
 30  __contact__ = "Jerome.Kieffer@ESRF.eu" 
 31  __author__ = "Jerome Kieffer" 
 32  __license__ = "GPLv3+" 
 33  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
 34   
 35  import os, sys 
 36  #to be compatible with windows 
 37  #strEdnaHome = os.path.join(os.sep, *tuple(os.path.abspath(sys.argv[0]).split(os.sep)[:-3])) 
 38  from os.path  import dirname 
 39  strEdnaHome = dirname(dirname(dirname(os.path.abspath(sys.argv[0])))) 
 40  if ("EDNA_HOME" in os.environ): 
 41      if  (os.environ["EDNA_HOME"] != strEdnaHome): 
 42          print("Warning: EDNA_HOME redefined to %s" % strEdnaHome) 
 43          os.environ["EDNA_HOME"] = strEdnaHome 
 44  else: 
 45      os.environ["EDNA_HOME"] = strEdnaHome 
 46   
 47  sys.path.append(os.path.join(os.environ["EDNA_HOME"], "kernel", "src")) 
 48  from EDVerbose                  import EDVerbose 
 49  from EDUtilsLibraryInstaller    import EDUtilsLibraryInstaller 
 50  from EDUtilsParallel            import  EDUtilsParallel 
 51   
 52   
 53  strLibrary = "PyFFTW3-0.2.1.tar.gz" 
 54   
 55   
 56  if __name__ == "__main__": 
 57      installDir = os.path.abspath(sys.argv[0]).split(os.sep)[-2] 
 58      EDVerbose.screen("Building %s" % strLibrary) 
 59      install = EDUtilsLibraryInstaller(installDir, strLibrary) 
 60      install.checkPythonVersion() 
 61      install.downloadLibrary() 
 62      install.getArchiveName() 
 63      install.unZipArchive() 
 64      install.buildSources() 
 65      install.installBuilt() 
 66      install.cleanSources() 
 67   
 68  #if os.name == "nt": 
 69  #    fftw - 3.2.2.pl1 - dll32.zip 
 70  #elif os.name == "posix": 
 71  #    fftwLibrary = "hdf5-1.8.5.tar.bz2" 
 72  #else: 
 73  #    fftwLibrary = None 
 74  #laFile = "libfftw3.so" 
 75   
 76  #if __name__ == "__main__": 
 77  #    installDir = os.path.abspath(sys.argv[0]).split(os.sep)[-2] 
 78  #    EDVerbose.screen("Building %s" % installDir) 
 79  #    installer = EDUtilsLibraryInstaller(installDir, pyfftwLibrary) 
 80  #    pathClib = installer.searchCLib(laFile) 
 81  #    if pathClib is None: 
 82  #        installer.checkPythonVersion() 
 83  #        installer.getArchitecture() 
 84  #        installer.downloadLibrary() 
 85  #        installer.unZipArchive() 
 86  #        pthreadPath = installer.searchCLib("libpthread.so") 
 87  #        EDVerbose.DEBUG("Libpthread found in %s" % pthreadPath) 
 88  #        if pthreadPath is None: 
 89  #            try: 
 90  #                installer.configure("--prefix=%s" % (installer.getDestinationDirectory())) 
 91  #            except Exception: 
 92  #                EDVerbose.ERROR("Error in the configure step, no pthread") 
 93  #        else: 
 94  #            try: 
 95  #                installer.configure("--prefix=%s --enable-threadsafe --with-pthread=%s" % (installer.getDestinationDirectory(), pthreadPath)) 
 96  #            except Exception: 
 97  #                EDVerbose.ERROR("Error in the configure step, with pthread") 
 98  #        try: 
 99  #            installer.make("-j %i" % EDUtilsParallel.detectNumberOfCPUs()) 
100  #        except Exception: 
101  #            EDVerbose.ERROR("Error in the 'make' step") 
102  # 
103  #        try: 
104  #            installer.make("install") 
105  #        except Exception: 
106  #            EDVerbose.ERROR("Error in the 'make install' step") 
107  #        pathClib = installer.getDestinationDirectory() 
108  #        installer.cleanSources() 
109  #    else: 
110  #        pathClib = os.path.dirname(pathClib) 
111  #    EDVerbose.DEBUG("Building H5Py with HDF5 library from %s " % (pathClib)) 
112  #    install = EDUtilsLibraryInstaller(installDir, h5pyLibrary) 
113  #    install.checkPythonVersion() 
114  #    install.dependency("numpy", "20090405-Numpy-1.3") 
115  #    install.downloadLibrary() 
116  #    install.getArchiveName() 
117  #    install.unZipArchive() 
118  #    try: 
119  #        install.buildSources("--hdf5=%s" % pathClib) 
120  #    except Exception: 
121  #        EDVerbose.ERROR("Error in the building of %s" % (h5pyLibrary)) 
122  #        sys.exit(0) 
123  #    install.installBuilt() 
124  #    if not EDVerbose.isVerboseDebug(): 
125  #        install.cleanSources() 
126  # 
127  #else: 
128  #    EDVerbose.ERROR("This installer program is not made to be imported, please just run it") 
129