def get_build_from_file (platform, file_name, name): gub_name = file_name.replace (os.getcwd () + '/', '') logging.verbose ('reading spec: %(gub_name)s\n' % locals ()) # Ugh, FIXME # This loads gub/specs/darwin/python.py in PYTHON. namespace, # overwriting the PYTHON. namespace from gub/specs/python.py # Current workaround: always/also use __darwin etc. postfixing # of class names, also in specs/darwin/ etc. warnings.filterwarnings ('ignore', '''Parent module 'python-2' ''') module = misc.load_module (file_name, name) # cross/gcc.py:Gcc will be called: cross/Gcc.py, # to distinguish from specs/gcc.py:Gcc.py base = os.path.basename (name) class_name = ((base[0].upper () + base[1:]) .replace ('-', '_') .replace ('.', '_') .replace ('++', '_xx_') .replace ('+', '_x_') + ('-' + platform).replace ('-', '__')) logging.debug ('LOOKING FOR: %(class_name)s\n' % locals ()) cls = misc.most_significant_in_dict (module.__dict__, class_name, '__') if (platform == 'tools32' and (not cls or issubclass (cls, target.AutoBuild))): cls = misc.most_significant_in_dict (module.__dict__, class_name.replace ('tools32', 'tools'), '__') if ((platform == 'tools' or platform == 'tools32') and (issubclass (cls, target.AutoBuild) and not issubclass (cls, tools.AutoBuild) and not issubclass (cls, tools32.AutoBuild))): cls = None return cls
def get_build_from_file (platform, file_name, name): gub_name = file_name.replace (os.getcwd () + '/', '') logging.verbose ('reading spec: %(gub_name)s\n' % locals ()) # Ugh, FIXME # This loads gub/specs/darwin/python.py in PYTHON. namespace, # overwriting the PYTHON. namespace from gub/specs/python.py # Current workaround: always/also use __darwin etc. postfixing # of class names, also in specs/darwin/ etc. module = misc.load_module (file_name, name) # cross/gcc.py:Gcc will be called: cross/Gcc.py, # to distinguish from specs/gcc.py:Gcc.py base = os.path.basename (name) class_name = ((base[0].upper () + base[1:]) .replace ('-', '_') .replace ('.', '_') .replace ('++', '_xx_') .replace ('+', '_x_') + ('-' + platform).replace ('-', '__')) logging.debug ('LOOKING FOR: %(class_name)s\n' % locals ()) return misc.most_significant_in_dict (module.__dict__, class_name, '__')