|
8 | 8 | import re |
9 | 9 | import sys |
10 | 10 | import importlib.util |
11 | | -SPEC_EXPORTCPP = importlib.util.find_spec('madgraph.iolibs.export_cpp') |
12 | | -PLUGIN_export_cpp = importlib.util.module_from_spec(SPEC_EXPORTCPP) |
13 | | -SPEC_EXPORTCPP.loader.exec_module(PLUGIN_export_cpp) |
14 | | -sys.modules['PLUGIN.CUDACPP_OUTPUT.PLUGIN_export_cpp'] = PLUGIN_export_cpp # allow 'import PLUGIN.CUDACPP_OUTPUT.PLUGIN_export_cpp' in model_handling.py |
15 | | -del SPEC_EXPORTCPP |
16 | | -###print('id(export_cpp)=%s'%id(export_cpp)) |
17 | | -###print('id(PLUGIN_export_cpp)=%s'%id(PLUGIN_export_cpp)) |
18 | 11 |
|
19 | | -# AV - use template files from PLUGINDIR instead of MG5DIR |
| 12 | +# AV - PLUGIN_NAME can be one of PLUGIN/CUDACPP_OUTPUT or MG5aMC_PLUGIN/CUDACPP_OUTPUT |
| 13 | +PLUGIN_NAME = __name__.rsplit('.',1)[0] |
| 14 | + |
| 15 | +# AV - use templates for source code, scripts and Makefiles from PLUGINDIR instead of MG5DIR |
20 | 16 | ###from madgraph import MG5DIR |
21 | 17 | PLUGINDIR = os.path.dirname( __file__ ) |
22 | 18 |
|
23 | | -# AV - model_handling includes the custom FileWriter, ALOHAWriter, UFOModelConverter, OneProcessExporter and HelasCallWriter, plus additional patches |
24 | | -import PLUGIN.CUDACPP_OUTPUT.model_handling as model_handling |
25 | | -import PLUGIN.CUDACPP_OUTPUT.output as output |
| 19 | +__import__('%s.output'%PLUGIN_NAME) |
| 20 | +output = sys.modules['%s.output'%PLUGIN_NAME] |
| 21 | +__import__('%s.model_handling'%PLUGIN_NAME) |
| 22 | +model_handling = sys.modules['%s.model_handling'%PLUGIN_NAME] |
| 23 | + |
| 24 | +import importlib.util |
| 25 | +SPEC_EXPORTCPP = importlib.util.find_spec('madgraph.iolibs.export_cpp') |
| 26 | +PLUGIN_export_cpp = importlib.util.module_from_spec(SPEC_EXPORTCPP) |
| 27 | +SPEC_EXPORTCPP.loader.exec_module(PLUGIN_export_cpp) |
| 28 | +###sys.modules['PLUGIN.CUDACPP_OUTPUT.PLUGIN_export_cpp'] = PLUGIN_export_cpp # allow 'import PLUGIN.CUDACPP_OUTPUT.PLUGIN_export_cpp' in model_handling.py |
| 29 | +sys.modules['%s.PLUGIN_export_cpp'%PLUGIN_NAME] = PLUGIN_export_cpp # allow 'import <PLUGIN_NAME>.PLUGIN_export_cpp' in model_handling.py |
| 30 | +del SPEC_EXPORTCPP |
26 | 31 |
|
27 | 32 | # AV - create a plugin-specific logger |
28 | 33 | import logging |
29 | | -logger = logging.getLogger('madgraph.PLUGIN.CUDACPP_OUTPUT.output') |
30 | | -from madgraph import MG5DIR |
| 34 | +logger = logging.getLogger('madgraph.%s.model_handling'%PLUGIN_NAME) |
| 35 | + |
| 36 | +#------------------------------------------------------------------------------------ |
| 37 | + |
| 38 | + |
31 | 39 | #------------------------------------------------------------------------------------ |
32 | 40 |
|
33 | 41 | from os.path import join as pjoin |
|
0 commit comments