diff --git a/QFramework/CMakeLists.txt b/QFramework/CMakeLists.txt index 1fb77b6e3ff8768b5584b0c364515e8966fc5aad..abe57753aabfca3ab2b6fffcdc2bb625704039db 100644 --- a/QFramework/CMakeLists.txt +++ b/QFramework/CMakeLists.txt @@ -50,7 +50,17 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO HistPainter Matrix Gpa # set some variables for easier handling set(QFrameworkLinkDef ${CMAKE_CURRENT_BINARY_DIR}/LinkDef.h) -set(QFrameworkPythonInit ${CMAKE_CURRENT_BINARY_DIR}/__init__.py) +if(NOT WITHOUT_ASG) + # With ASG, use x86_64 location for python modules + set(QFrameworkPythonInit ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/QFramework/__init__.py) + # Remove old files, to force switch to new directory + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__init__.py) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__init__.pyc) +ELSE() + # Use legacy path + set(QFrameworkPythonInit ${CMAKE_CURRENT_BINARY_DIR}/__init__.py) +ENDIF() + file(GLOB QFrameworkPython "python/*.py") #note: this does not include __init__.py since it's not generated yet! file(GLOB QFrameworkSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Root/[A-Za-z]*.cxx") file(GLOB QFrameworkHeaders RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "QFramework/[A-Za-z]*.h") @@ -90,8 +100,8 @@ if(NOT WITHOUT_ASG) LINK_LIBRARIES xAODCore xAODRootAccess xAODTruth xAODBase xAODCutFlow ${ROOT_LIBRARIES} PRIVATE_LINK_LIBRARIES ${LIBXML2_LIBRARIES} ) - atlas_install_python_modules( python/*.py ) - + atlas_install_python_modules( ${QFrameworkPython} ) + # register the test cases find_package(PythonInterp REQUIRED) foreach(TestScript ${QFrameworkPythonTests}) diff --git a/QFramework/share/generateBindings.py b/QFramework/share/generateBindings.py index e5f08d2e4b01aeba82601fe886db123a525ce3b0..df316f1fe9f05c57a7da3490c9dd7cae64604ea2 100644 --- a/QFramework/share/generateBindings.py +++ b/QFramework/share/generateBindings.py @@ -1,5 +1,17 @@ #!/bin/env python +import os +import errno + +def ensure_dir(directory): + """Create (parent) directories if non-existent""" + try: + os.makedirs(directory) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + def fhash(fname): # get a hash of a file (using stupid filesize replacement for now) import os @@ -29,6 +41,8 @@ class Dummysink(object): def datasink(filename): if filename: + directory = os.path.dirname(filename) + ensure_dir(directory) return open(filename, "wt") else: return Dummysink()