~osomon/pyexiv2/pyexiv2-0.3

« back to all changes in this revision

Viewing changes to SConstruct

  • Committer: Olivier Tilloy
  • Date: 2010-04-14 11:22:41 UTC
  • mfrom: (301.1.7 run_tests)
  • Revision ID: olivier@tilloy.net-20100414112241-m2mszedhi42appra
Add a "test" scons target to run the unit tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import os
4
4
import sys
5
5
 
 
6
def _fiddle_with_pythonpath():
 
7
    # Fiddle with the pythonpath to allow builders to locate pyexiv2
 
8
    # (see https://bugs.launchpad.net/pyexiv2/+bug/549398).
 
9
    curdir = os.path.abspath(os.curdir)
 
10
    sys.path.insert(0, os.path.join(curdir, 'build'))
 
11
    sys.path.insert(0, os.path.join(curdir, 'src'))
 
12
 
6
13
def build_lib():
7
14
    try:
8
15
        from site import USER_SITE
15
22
    SConscript('src/SConscript', variant_dir='build', duplicate=0)
16
23
 
17
24
def build_doc():
18
 
    # Fiddle with the pythonpath to allow the doc builder to locate pyexiv2
19
 
    # (see https://bugs.launchpad.net/pyexiv2/+bug/549398).
20
 
    curdir = os.path.abspath(os.curdir)
21
 
    sys.path.insert(0, os.path.join(curdir, 'build'))
22
 
    sys.path.insert(0, os.path.join(curdir, 'src'))
 
25
    _fiddle_with_pythonpath()
23
26
    SConscript('doc/SConscript')
24
27
 
 
28
def run_tests():
 
29
    _fiddle_with_pythonpath()
 
30
    SConscript('test/SConscript')
 
31
 
25
32
if not BUILD_TARGETS:
26
33
    # Default target: lib
27
34
    build_lib()
31
38
    if 'doc' in BUILD_TARGETS:
32
39
        # Note: building the doc requires the lib to be built.
33
40
        build_doc()
 
41
    if 'test' in BUILD_TARGETS:
 
42
        # Note: running the unit tests requires the lib to be built.
 
43
        run_tests()
34
44