diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index fb478ec085f04136e2ec359fc5f8c460572742ff..1145f5cdb9adfac9bc2a60e12bb738e352b1ed16 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -423,6 +423,7 @@ macro(script) if (NOT _ARG_INPUT) message(FATAL_ERROR "script() can only substitute when INPUT is present.") endif() + substitute(IN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_INPUT}" OUT_FILE ${_ARG_NAME} DICT ${_ARG_SUBSTITUTE}) endif() @@ -687,15 +688,21 @@ macro(ost_unittest) set_target_properties("${_test_name}_run" PROPERTIES EXCLUDE_FROM_ALL "1") endif() endif() + foreach(py_test ${PY_TESTS}) if(WIN32) - set (PY_TESTS_CMD "${EXECUTABLE_OUTPUT_PATH}/ost.bat") + set (PY_TESTS_CMD "${PYTHON_BINARY}") add_custom_target("${py_test}_run" CALL "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "running checks ${py_test}" VERBATIM) else() - set (PY_TESTS_CMD "${EXECUTABLE_OUTPUT_PATH}/ost") + set(python_path $ENV{PYTHONPATH}) + if(python_path) + set(python_path "${python_path}:") + endif(python_path) + set(python_path "${python_path}${LIB_STAGE_PATH}/python${PYTHON_VERSION}/site-packages") + set (PY_TESTS_CMD "PYTHONPATH=${python_path} ${PYTHON_BINARY}") add_custom_target("${py_test}_run" sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/modules/base/pymod/CMakeLists.txt b/modules/base/pymod/CMakeLists.txt index 6a011018fb032d44e07680e214e9bfcb5c14e454..433dfeb9f35290e7330ea5a608e35f39292a5b88 100644 --- a/modules/base/pymod/CMakeLists.txt +++ b/modules/base/pymod/CMakeLists.txt @@ -7,5 +7,28 @@ set(OST_BASE_PYMOD_SOURCES if (NOT ENABLE_STATIC) pymod(NAME base OUTPUT_DIR ost CPP ${OST_BASE_PYMOD_SOURCES} - PY __init__.py settings.py stutil.py table.py xmlrunner.py testutils.py) + PY settings.py stutil.py table.py xmlrunner.py testutils.py) endif() + +set(SQ "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'") +set(SUBST_DICT "ALL_ADDITIONAL_MODULES=") +if(ENABLE_GUI) + set(SUBST_DICT "${SUBST_DICT},${SQ}gui${SQ}") +endif(ENABLE_GUI) +if(ENABLE_GFX) + set(SUBST_DICT "${SUBST_DICT},${SQ}gfx${SQ}") +endif(ENABLE_GFX) +if(ENABLE_IMG) + set(SUBST_DICT "${SUBST_DICT},${SQ}img${SQ}") +endif(ENABLE_IMG) +if(ENABLE_INFO) + set(SUBST_DICT ${SUBST_DICT},${SQ}info${SQ}) +endif(ENABLE_INFO) + + +script(NAME __init__.py + INPUT __init__.py.in + SUBSTITUTE "${SUBST_DICT}" + TARGET ost_base_pymod + OUTPUT_DIR "${LIB_DIR}/python${PYTHON_VERSION}/site-packages/ost") + diff --git a/modules/base/pymod/__init__.py b/modules/base/pymod/__init__.py.in similarity index 67% rename from modules/base/pymod/__init__.py rename to modules/base/pymod/__init__.py.in index 8ecfacd79cddae2336ab0000b30def062c46a515..4b1be9f6cdfd7c504bf4cd7b0b5094b0f5b8a147 100644 --- a/modules/base/pymod/__init__.py +++ b/modules/base/pymod/__init__.py.in @@ -16,27 +16,12 @@ # along with this library; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #------------------------------------------------------------------------------ -from _ost_base import * -from stutil import * -from ost import geom -from ost import io -from ost import mol -from ost import seq -try: - from ost import gfx - scene = gfx.Scene() - scene.Stereo=gfx.Stereo -except ImportError: - pass - - -try: - from ost import img -except ImportError: - pass +__all__=['Correl', 'FileLogSink', 'FloatList', 'GetCurrentLogSink', 'GetPrefixPath', 'GetSharedDataPath', 'GetVerbosityLevel', 'Histogram', 'IntList', 'LogDebug', 'LogError', 'LogInfo', 'LogScript', 'LogSink', 'LogTrace', 'LogVerbose', 'LogWarning', 'Max', 'Mean', 'Median', 'Min', 'MultiLogSink', 'PopLogSink', 'PopVerbosityLevel', 'PushLogSink', 'PushVerbosityLevel', 'Range', 'SetPrefixPath', 'StdDev', 'StreamLogSink', 'StringList', 'StringLogSink', 'Units', 'VERSION', 'VERSION_MAJOR', 'VERSION_MINOR', 'VERSION_PATCH', 'WITH_NUMPY', 'conop', 'geom', 'io', 'mol', 'seq', 'stutil' @ALL_ADDITIONAL_MODULES@] +from _ost_base import * +from stutil import * class StreamLogSink(LogSink): def __init__(self, stream): diff --git a/modules/base/tests/test_log.py b/modules/base/tests/test_log.py index cec9378edc965174e460c392ee8bf28a69d106e8..2527159d43b7470ca681a158f700f8dc2315d410 100644 --- a/modules/base/tests/test_log.py +++ b/modules/base/tests/test_log.py @@ -30,6 +30,7 @@ class TestLog(unittest.TestCase): self.severity=severity ost.PushLogSink(ls) ls=CapturingLogSink() + ost.PushVerbosityLevel(1) ost.PushLogSink(ls) ost.LogError('error message') self.assertEqual(ls.message, 'error message\n') diff --git a/modules/bindings/tests/test_blast.py b/modules/bindings/tests/test_blast.py index 54a5c4ef805d5214ba470e3662b2facbe7e8022f..85a65ea24370cfa34161b4c8d3395221f0a16ee2 100644 --- a/modules/bindings/tests/test_blast.py +++ b/modules/bindings/tests/test_blast.py @@ -1,3 +1,4 @@ +import sys import unittest from ost import * from ost import settings diff --git a/modules/bindings/tests/test_clustalw.py b/modules/bindings/tests/test_clustalw.py index fa5a5e6b5eb44cbe11a0a11a68dc93d7d64cf123..9aaf210f8be644f2126b7a1bff6e859c43ce3fe0 100644 --- a/modules/bindings/tests/test_clustalw.py +++ b/modules/bindings/tests/test_clustalw.py @@ -1,3 +1,4 @@ +import sys import unittest from ost import * from ost import settings diff --git a/modules/conop/tests/test_cleanup.py b/modules/conop/tests/test_cleanup.py index 1dc280f4fbaac9867c7f7a1063217bb4527cfbd0..11df64187377f67f636813c2218fb37256a449cd 100644 --- a/modules/conop/tests/test_cleanup.py +++ b/modules/conop/tests/test_cleanup.py @@ -1,3 +1,4 @@ +import sys import unittest from ost import geom, conop from ost.conop import cleanup diff --git a/modules/gui/pymod/dng/init.py b/modules/gui/pymod/dng/init.py index d46af73d8e1a93678a576698e06bdd69b552b84c..ef122cd97ad5e2e46ca1fc98d9640349807113af 100644 --- a/modules/gui/pymod/dng/init.py +++ b/modules/gui/pymod/dng/init.py @@ -12,6 +12,9 @@ try: except ImportError: _img_present=False pass +ost.scene = gfx.Scene() +ost.scene.Stereo=gfx.Stereo + import httplib from PyQt4 import QtGui, QtCore diff --git a/modules/io/tests/test_io_mmcif.py b/modules/io/tests/test_io_mmcif.py index 94eb063301b5e56f697c7d67f43452c023b38f56..46eda067e5c1868099f3559cc9814749082ac881 100644 --- a/modules/io/tests/test_io_mmcif.py +++ b/modules/io/tests/test_io_mmcif.py @@ -1,4 +1,5 @@ import unittest +import ost from ost import * class TestMMCifInfo(unittest.TestCase): diff --git a/modules/mol/alg/tests/test_convenient_superpose.py b/modules/mol/alg/tests/test_convenient_superpose.py index eb4331ca3e8e6b65b0201197e5755cb2e5fcab15..728f315dea87ccca22f99e399669fbf9591d35c6 100644 --- a/modules/mol/alg/tests/test_convenient_superpose.py +++ b/modules/mol/alg/tests/test_convenient_superpose.py @@ -1,3 +1,4 @@ +from ost import io,mol,geom import unittest import os import random diff --git a/modules/seq/alg/tests/test_renumber.py b/modules/seq/alg/tests/test_renumber.py index 51e4727d3cfb7b3f87fea3517f9664fe7c896b16..8f234f859624416d2533d8a9de3d0c9b6d5c86c2 100644 --- a/modules/seq/alg/tests/test_renumber.py +++ b/modules/seq/alg/tests/test_renumber.py @@ -1,3 +1,4 @@ +import sys import unittest from ost import * from ost import settings diff --git a/scripts/init_cl.py b/scripts/init_cl.py index bb8090b5ef7c3947c28e51701711f64231c70591..2c7a048109f132aa4428b208cbd37a97ac237615 100644 --- a/scripts/init_cl.py +++ b/scripts/init_cl.py @@ -34,6 +34,12 @@ else: from ost import * import ost +try: + from ost import gfx + ost.scene = gfx.Scene() + ost.scene.Stereo=gfx.Stereo +except ImportError: + pass ost.SetPrefixPath(os.getenv('DNG_ROOT')) def _InitRuleBasedBuilder():