Пример #1
0
from EDUtilsLibraryInstaller    import EDUtilsLibraryInstaller, installLibrary
from EDFactoryPluginStatic      import EDFactoryPluginStatic

moduleName = "numpy"
modulePath = os.path.join(os.environ["EDNA_HOME"], "libraries", "NumPy-1.5.1", EDUtilsPlatform.architecture)
moduleVersion = "1.4.0"

################################################################################
# Import the right version of numpy 
################################################################################

oModule = EDFactoryPluginStatic.preImport(moduleName, _strMethodVersion="version.version")
if not oModule:
    oModule = EDFactoryPluginStatic.preImport(moduleName, modulePath, _strMethodVersion="version.version")
    if oModule is None:
        installLibrary(modulePath)
        oModule = EDFactoryPluginStatic.preImport(moduleName, modulePath, _strMethodVersion="version.version")
try:
    version = oModule.version.version
except AttributeError:
    version = "0.0.0"

if version.split(".") < moduleVersion.split("."):
    EDVerbose.screen("Wrong %s library:  %s " % (moduleName, version))
    EDFactoryPluginStatic.unImport(moduleName)
    oModule = EDFactoryPluginStatic.preImport(moduleName, modulePath, moduleVersion, _strMethodVersion="version.version")

if oModule is None:
    EDVerbose.ERROR("Unable to download, compile or install module %s" % moduleName)
else:
    EDVerbose.screen("Version of %s: %s from %s" % (moduleName, oModule.version.version, oModule.__file__))
Пример #2
0
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "20110722"
import os, sys
if "EDNA_HOME" not in os.environ:
    EDNA_HOME = os.path.dirname(os.path.dirname(__file__))
    os.environ["EDNA_HOME"] = EDNA_HOME
else:
    EDNA_HOME = os.environ["EDNA_HOME"]
kernel_src = os.path.join(EDNA_HOME, "kernel", "src")
if kernel_src not in sys.path:
    sys.path.append(kernel_src)

from EDVerbose import EDVerbose
from EDUtilsPlatform import EDUtilsPlatform
from EDUtilsLibraryInstaller             import EDUtilsLibraryInstaller, installLibrary

specClientPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "SpecClient", EDUtilsPlatform.architecture)

###############################################################################
# Import the right version of SpecClient
###############################################################################
try:
    import SpecClient
except ImportError:
    if  os.path.isdir(specClientPath) and (specClientPath not in sys.path):
        sys.path.insert(1, specClientPath)
    else:
        installLibrary(specClientPath)
    import SpecClient

Пример #3
0
################################################################################
# Import the right version of Scipy
################################################################################
moduleName = "scipy"
modulePath = os.path.join(os.environ["EDNA_HOME"], "libraries",
                          "20090711-SciPy-0.7.1", EDUtilsPlatform.architecture)
moduleVersion = "0.7.0"

oModule = EDFactoryPluginStatic.preImport(moduleName,
                                          _strMethodVersion="version.version")
if not oModule:
    oModule = EDFactoryPluginStatic.preImport(
        moduleName, modulePath, _strMethodVersion="version.version")
    if oModule is None:
        installLibrary(modulePath)
        oModule = EDFactoryPluginStatic.preImport(
            moduleName, modulePath, _strMethodVersion="version.version")
try:
    version = oModule.version.version
except AttributeError:
    version = "0.0.0"

if version.split(".") < moduleVersion.split("."):
    EDVerbose.screen("Wrong %s library:  %s " % (moduleName, version))
    EDFactoryPluginStatic.unImport(moduleName)
    oModule = EDFactoryPluginStatic.preImport(
        moduleName,
        modulePath,
        moduleVersion,
        _strMethodVersion="version.version")
Пример #4
0
if "EDNA_HOME" not in os.environ:
    EDNA_HOME = os.path.dirname(os.path.dirname(__file__))
    os.environ["EDNA_HOME"] = EDNA_HOME
else:
    EDNA_HOME = os.environ["EDNA_HOME"]
kernel_src = os.path.join(EDNA_HOME, "kernel", "src")
if kernel_src not in sys.path:
    sys.path.append(kernel_src)

from EDVerbose import EDVerbose
from EDUtilsPlatform import EDUtilsPlatform
from EDUtilsLibraryInstaller             import EDUtilsLibraryInstaller, installLibrary

fabioPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "Fabio-r5080", EDUtilsPlatform.architecture)

################################################################################
# Import the good version of FabIO ... FABIO has not yet a version ... so it must be the good one
################################################################################
try:
    import fabio
except Exception:
    if os.path.isdir(fabioPath) and (fabioPath not in sys.path):
        sys.path.insert(1, fabioPath)
        import fabio
    else:
        installLibrary(fabioPath)


import fabio.openimage
from fabio.openimage import openimage
################################################################################
architecture = EDUtilsLibraryInstaller.getArchitecture()
imagingPath = os.path.join(os.environ["EDNA_HOME"], "libraries",
                           "20091115-PIL-1.1.7", architecture)

###############################################################################
# Import the right version of PIL
###############################################################################
pydictModulesBeforePIL = sys.modules.copy()
try:
    import Image
except Exception:
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

if map(int, Image.VERSION.split(".")) < [1, 1, 6]:
    print "Wrong PIL: Remove old PIL from imported modules"
    for oneModule in sys.modules.copy():
        if oneModule not in pydictModulesBeforePIL:
            del sys.modules[oneModule]
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

print "Version of Python Imaging Library found: %s" % Image.VERSION
del pydictModulesBeforePIL
Пример #6
0
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "20110722"
import os, sys
if "EDNA_HOME" not in os.environ:
    EDNA_HOME = os.path.dirname(os.path.dirname(__file__))
    os.environ["EDNA_HOME"] = EDNA_HOME
else:
    EDNA_HOME = os.environ["EDNA_HOME"]
kernel_src = os.path.join(EDNA_HOME, "kernel", "src")
if kernel_src not in sys.path:
    sys.path.append(kernel_src)

from EDVerbose import EDVerbose
from EDUtilsPlatform import EDUtilsPlatform
from EDUtilsLibraryInstaller             import EDUtilsLibraryInstaller, installLibrary

edfFilePath = os.path.join(os.environ["EDNA_HOME"], "libraries", "EdfFile", EDUtilsPlatform.architecture)

###############################################################################
# Import the right version of EdfFile
###############################################################################
try:
    import EdfFile
except ImportError:
    if  os.path.isdir(edfFilePath) and (edfFilePath not in sys.path):
        sys.path.insert(1, edfFilePath)
    else:
        installLibrary(edfFilePath)
    import EdfFile
Пример #7
0
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "20110722"
import os, sys
if "EDNA_HOME" not in os.environ:
    EDNA_HOME = os.path.dirname(os.path.dirname(__file__))
    os.environ["EDNA_HOME"] = EDNA_HOME
else:
    EDNA_HOME = os.environ["EDNA_HOME"]
kernel_src = os.path.join(EDNA_HOME, "kernel", "src")
if kernel_src not in sys.path:
    sys.path.append(kernel_src)

from EDVerbose import EDVerbose
from EDUtilsPlatform import EDUtilsPlatform
from EDUtilsLibraryInstaller import EDUtilsLibraryInstaller, installLibrary

edfFilePath = os.path.join(os.environ["EDNA_HOME"], "libraries", "EdfFile",
                           EDUtilsPlatform.architecture)

###############################################################################
# Import the right version of EdfFile
###############################################################################
try:
    import EdfFile
except ImportError:
    if os.path.isdir(edfFilePath) and (edfFilePath not in sys.path):
        sys.path.insert(1, edfFilePath)
    else:
        installLibrary(edfFilePath)
    import EdfFile
imagingPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "20091115-PIL-1.1.7", architecture)
numpyPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "20090405-Numpy-1.3", architecture)


###############################################################################
# Import the right version of PIL
###############################################################################
pydictModulesBeforePIL = sys.modules.copy()

try:
    import Image
except Exception:
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

if map(int, Image.VERSION.split(".")) < [1, 1, 6]:
    print "Wrong PIL: Remove old PIL from imported modules"
    for oneModule in sys.modules.copy():
        if oneModule not in pydictModulesBeforePIL:
            del sys.modules[oneModule]
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

print "Version of Python Imaging Library found: %s" % Image.VERSION
del pydictModulesBeforePIL
fabioPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "Fabio-r5080",
                         architecture)
numpyPath = os.path.join(os.environ["EDNA_HOME"], "libraries",
                         "20090405-Numpy-1.3", architecture)

###############################################################################
# Import the right version of PIL
###############################################################################
pydictModulesBeforePIL = sys.modules.copy()
try:
    import Image
except Exception:
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

if map(int, Image.VERSION.split(".")) < [1, 1, 6]:
    print "Wrong PIL: Remove old PIL from imported modules"
    for oneModule in sys.modules.copy():
        if oneModule not in pydictModulesBeforePIL:
            del sys.modules[oneModule]
    if os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

print "Version of Python Imaging Library found: %s" % Image.VERSION
del pydictModulesBeforePIL
architecture = EDUtilsPlatform.architecture
imagingPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "20091115-PIL-1.1.7", architecture)
fabioPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "Fabio-r5080", architecture)
numpyPath = os.path.join(os.environ["EDNA_HOME"], "libraries", "20090405-Numpy-1.3", architecture)

###############################################################################
# Import the right version of PIL
###############################################################################
pydictModulesBeforePIL = sys.modules.copy()
try:
    import Image
except Exception:
    if  os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

if map(int, Image.VERSION.split(".")) < [1, 1, 6]:
    print "Wrong PIL: Remove old PIL from imported modules"
    for oneModule in sys.modules.copy():
        if oneModule not in pydictModulesBeforePIL:
            del sys.modules[ oneModule ]
    if  os.path.isdir(imagingPath) and (imagingPath not in sys.path):
        sys.path.insert(1, imagingPath)
    else:
        installLibrary(imagingPath)
    import Image

print "Version of Python Imaging Library found: %s" % Image.VERSION
del pydictModulesBeforePIL