1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/df1452d451ec/ changeset: df1452d451ec user: greg date: 2012-08-30 20:40:28 summary: Change the implementation for importing proprietary datatype class modules that are included in installed tool shed repositories. This approach will correctly import proprietary datatype classes whose file names conflict with a Python standard library module name (e.g., if a proprietary datatype class file is named xml.py, it will conflict with the Python standard library's xml module when attempting to import it). affected #: 1 file diff -r 9e35739c2da19583f24784d1b06e656dede2643a -r df1452d451ece4e33b720c481077ad792bb0b71a lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -1,7 +1,7 @@ """ Provides mapping between extensions and datatypes, mime-types, etc. """ -import os, sys, tempfile, threading, logging +import os, sys, tempfile, threading, logging, imp import data, tabular, interval, images, sequence, qualityscore, genetics, xml, coverage, tracks, chrominfo, binary, assembly, ngsindex import galaxy.util from galaxy.util.odict import odict @@ -55,10 +55,9 @@ being installed. Since installation is occurring after the datatypes registry has been initialized, its contents cannot be overridden by new introduced conflicting data types. """ - def __import_module( full_path, datatype_module ): - sys.path.insert( 0, full_path ) - imported_module = __import__( datatype_module ) - sys.path.pop( 0 ) + def __import_module( full_path, datatype_module, datatype_class_name ): + open_file_obj, file_name, description = imp.find_module( datatype_module, [ full_path ] ) + imported_module = imp.load_module( datatype_class_name, open_file_obj, file_name, description ) return imported_module if root_dir and config: handling_proprietary_datatypes = False @@ -130,12 +129,12 @@ datatype_module = fields[0] datatype_class_name = fields[1] datatype_class = None - if proprietary_path and proprietary_datatype_module: + if proprietary_path and proprietary_datatype_module and datatype_class_name: # We need to change the value of sys.path, so do it in a way that is thread-safe. lock = threading.Lock() lock.acquire( True ) try: - imported_module = __import_module( proprietary_path, proprietary_datatype_module ) + imported_module = __import_module( proprietary_path, proprietary_datatype_module, datatype_class_name ) if imported_module not in self.imported_modules: self.imported_modules.append( imported_module ) if hasattr( imported_module, datatype_class_name ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.