diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 646adc2cf5aeb768447e2e42de66da79c083c982..53b0d8025ab8896640e69f75986dd3096b0804ba 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -496,9 +496,9 @@ macro(pymod) return() endif() if (_ARG_OUTPUT_DIR) - set(PYMOD_DIR "openstructure/${_ARG_OUTPUT_DIR}") + set(PYMOD_DIR "python${PYTHON_VERSION}/site-packages/${_ARG_OUTPUT_DIR}") else() - set(PYMOD_DIR "openstructure/${_ARG_PREFIX}/${_ARG_NAME}") + set(PYMOD_DIR "python${PYTHON_VERSION}/site-packages/${_ARG_PREFIX}/${_ARG_NAME}") endif() set(_LIB_NAME ${_ARG_PREFIX}_${_ARG_NAME}) set(PYMOD_STAGE_DIR "${LIB_STAGE_PATH}/${PYMOD_DIR}") diff --git a/deployment/macos/deps.py b/deployment/macos/deps.py index 65474472153ea460b9e91860b58af7bf7277dbb4..6c699b92eaee6f96a0a9028cfdd98b3a5c04c08c 100644 --- a/deployment/macos/deps.py +++ b/deployment/macos/deps.py @@ -27,7 +27,7 @@ def _deps_for_lib(lib, pool, recursive=True): return def collect_deps(stage_dir, components, binaries, libexec_binaries, - site_packages, site_packages_dir): + site_packages, site_packages_dir, libexec_path='openstructure'): """ Collect the dependencies for the given components and returns a list of frameworks/libraries that the component depends on. @@ -50,7 +50,7 @@ def collect_deps(stage_dir, components, binaries, libexec_binaries, if bin_name not in pool: _deps_for_lib(bin_name, pool) for bin in libexec_binaries: - bin_name=os.path.abspath(os.path.join(stage_dir, 'libexec/openstructure', + bin_name=os.path.abspath(os.path.join(stage_dir, 'libexec', libexec_path, bin)) if not os.path.exists(bin_name): print 'WARNING:', bin_name, 'does not exist' @@ -239,7 +239,8 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, # when running in non-gui mode, we are most likely missing the boost # python library. Let's add it to the list of dependencies by # inspecting "_ost_base.so". - _deps_for_lib(os.path.join(stage_dir, 'lib/openstructure/ost/_ost_base.so'), + pymod_dir='lib/python%d.%d/site-packages' % sys.version_info[0:2] + _deps_for_lib(os.path.join(stage_dir, pymod_dir, 'ost/_ost_base.so'), deps, recursive=False) print 'copying dependencies' copy_deps(deps, outdir) @@ -249,8 +250,8 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, print 'copying binaries' copy_binaries(stage_dir, outdir, binaries, scripts, 'bin') print 'copying pymod' - shutil.copytree(os.path.join(stage_dir, 'lib/openstructure'), - os.path.join(outdir, 'lib/openstructure')) + shutil.copytree(os.path.join(stage_dir,pymod_dir), + os.path.join(outdir, pymod_dir)) copied_py_framework=False non_std_python=False if os.path.exists(os.path.join(outdir, 'lib/Python.framework')): @@ -310,9 +311,9 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, for sp in SITE_PACKAGES: src=get_python_module_path(sp) if os.path.isdir(src): - shutil.copytree(src, os.path.join(outdir, 'lib/openstructure', sp)) + shutil.copytree(src, os.path.join(outdir, pymod_dir, sp)) else: - shutil.copy(src, os.path.join(outdir, 'lib/openstructure', sp)) + shutil.copy(src, os.path.join(outdir, pymod_dir, sp)) print 'updating link commands of python shared objects' os.path.walk(os.path.join(outdir, 'lib'), update_pymod_shared_objects, diff --git a/doc/conf/conf.py b/doc/conf/conf.py index b2d284a53bf8f2843ea9a25b8b0828af9ccc2865..e87782b4c33be7d3f95160d365b9f600743470ad 100644 --- a/doc/conf/conf.py +++ b/doc/conf/conf.py @@ -13,13 +13,12 @@ import sys, os -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. +site_packs='python%d.%d/site-packages' % sys.version_info[0:2] sys.path.append(os.path.join(os.path.abspath('../..'), - 'stage/lib/openstructure')) + 'stage/lib', site_packs)) sys.path.append(os.path.join(os.path.abspath('../..'), - 'stage/lib64/openstructure')) + 'stage/lib64', site_packs)) +print site_packs import ost # -- General configuration ----------------------------------------------------- diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc index 49750b9dca33c65e927d52dad461d5973b96fc80..670c454c1886f0c1c2013954d3996a38060781b6 100644 --- a/modules/gui/src/gosty.cc +++ b/modules/gui/src/gosty.cc @@ -108,13 +108,20 @@ String get_ost_root() void setup_python_search_path(const String& root, PythonInterpreter& pi) { + std::stringstream site_pkgs; + site_pkgs << "python" << PY_MAJOR_VERSION << "." << PY_MINOR_VERSION; #ifdef _MSC_VER - pi.AppendModulePath(QString::fromStdString(root+"\\lib\\openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"\\lib\\"+site_pkgs.str() + +"\\site-packages")); #else # if (defined(__ppc64__) || defined(__x86_64__)) && !defined(__APPLE__) - pi.AppendModulePath(QString::fromStdString(root+"/lib64/openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"/lib64/"+ + site_pkgs.str()+ + "site-packages")); # else - pi.AppendModulePath(QString::fromStdString(root+"/lib/openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"/lib/"+ + site_pkgs.str()+ + "/site-packages")); # endif #endif pi.AppendModulePath("."); diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 0b6b429a45beebc7c2233d65218dba89fa86f32d..f9528d7e41622170ecdaade2734fc0a758f086ae 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -33,13 +33,13 @@ if (NOT ENABLE_STATIC) set(INIT_SCRIPTS init_cl.py ) - + set(SPD "${LIB_DIR}/python${PYTHON_VERSION}/site-packages") if (ENABLE_GUI) list(APPEND INIT_SCRIPTS init.py) endif() - copy_if_different("./" "${STAGE_DIR}/${LIB_DIR}/openstructure" + copy_if_different("./" "${STAGE_DIR}/${SPD}" "${INIT_SCRIPTS}" "python init scripts" ost_scripts) - install(FILES ${INIT_SCRIPTS} DESTINATION "${LIB_DIR}/openstructure") + install(FILES ${INIT_SCRIPTS} DESTINATION "${SPD}") endif() diff --git a/scripts/init_cl.py b/scripts/init_cl.py index 09b38ed9785b1075acbdc5dbfe8de8e1d14d21f3..d4a14df4cd339872dc62c2de5898b04f07e75c76 100644 --- a/scripts/init_cl.py +++ b/scripts/init_cl.py @@ -26,10 +26,11 @@ parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="v parser.disable_interspersed_args() (options, args) = parser.parse_args() +_site_packs='python%d.%d/site-packages' % sys.version_info[0:2] if platform.machine()=='x86_64': - sys.path.insert(0, os.getenv('DNG_ROOT')+'/lib64/openstructure') + sys.path.insert(0, os.path.join(os.getenv('DNG_ROOT'), 'lib64', _site_packs)) else: - sys.path.insert(0,os.getenv('DNG_ROOT')+'/lib/openstructure') + sys.path.insert(0,os.path.join(os.getenv('DNG_ROOT'), 'lib', _site_packs)) from ost import * import ost diff --git a/scripts/ost.in b/scripts/ost.in index 2891d37c28597c2fbdee3dbb05b1bd7bf20aca5c..5eee1638bdee1f44e731b405e872671da62c4283 100755 --- a/scripts/ost.in +++ b/scripts/ost.in @@ -31,7 +31,7 @@ BIN_DIR=`dirname "$SCRIPT_NAME"` source $BIN_DIR/../@LIBEXEC_PATH@/ost_config -$pyexec $interactive "$DNG_ROOT/@LIBDIR@/openstructure/init_cl.py" $opts +$pyexec $interactive "$DNG_ROOT/@LIBDIR@/python@PYTHON_VERSION@/site-packages/init_cl.py" $opts RC=$? exit $RC diff --git a/scripts/ost_config.in b/scripts/ost_config.in index faaae8e264e655496fe35471dc0bb685c6a6f59b..5894bdb12c62241d556e04fb909eb9f83a17c5ef 100644 --- a/scripts/ost_config.in +++ b/scripts/ost_config.in @@ -24,7 +24,7 @@ export DNG_ROOT=`cd "$BIN_DIR/..";pwd` export DNG_BINDIR="$DNG_ROOT/bin" export DNG_LIBDIR="$DNG_ROOT/@LIBDIR@" -export DNG_INITDIR="$DNG_LIBDIR/openstructure" +export DNG_INITDIR="$DNG_LIBDIR/python@PYTHON_VERSION@/site-packages" export PATH="$DNG_BINDIR:${PATH}" export DYLD_FRAMEWORK_PATH="$DNG_LIBDIR:${DYLD_FRAMEWORK_PATH}"