From 21b0124ed55537a9640dc21fbedfb644cd269ab5 Mon Sep 17 00:00:00 2001 From: Olivier Tilloy Date: Wed, 14 Apr 2010 11:59:12 +0200 Subject: Isolate the PYTHONPATH fiddling in a separate function, and do it when running the unit tests too. --- SConstruct | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index ec57e67..f3e9702 100644 --- a/SConstruct +++ b/SConstruct @@ -3,6 +3,13 @@ import os import sys +def _fiddle_with_pythonpath(): + # Fiddle with the pythonpath to allow builders to locate pyexiv2 + # (see https://bugs.launchpad.net/pyexiv2/+bug/549398). + curdir = os.path.abspath(os.curdir) + sys.path.insert(0, os.path.join(curdir, 'build')) + sys.path.insert(0, os.path.join(curdir, 'src')) + def build_lib(): try: from site import USER_SITE @@ -15,15 +22,15 @@ def build_lib(): SConscript('src/SConscript', variant_dir='build', duplicate=0) def build_doc(): - # Fiddle with the pythonpath to allow the doc builder to locate pyexiv2 - # (see https://bugs.launchpad.net/pyexiv2/+bug/549398). - curdir = os.path.abspath(os.curdir) - sys.path.insert(0, os.path.join(curdir, 'build')) - sys.path.insert(0, os.path.join(curdir, 'src')) + _fiddle_with_pythonpath() SConscript('doc/SConscript') def run_tests(): + _fiddle_with_pythonpath() from test.TestsRunner import run_unit_tests + # FIXME: this is not really well integrated as scons is not informed + # whether the unit tests passed or failed. + # http://www.scons.org/wiki/UnitTests may be of use. run_unit_tests() if not BUILD_TARGETS: -- cgit