File: wscript

package info (click to toggle)
autorevision 1.22-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 200 kB
  • sloc: sh: 1,171; makefile: 86; python: 29; ansic: 18
file content (58 lines) | stat: -rw-r--r-- 1,693 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
# encoding: utf-8

APPNAME = 'projectname'
VERSION = '1.0' # This will be overwritten later.


def configure(bld):
    # This makes sure that autorevision exists before we call it.
    bld.find_program('autorevision', var='AUTOREVISION')


def options(bld):
    pass


def arv(bld):
    # The cache file build is in its own function so it can be easily
    # included everywhere it needs to be.
    from waflib import ConfigSet
    # Get the path to autorevision found in configuration.
    try:
        env = ConfigSet.ConfigSet('build/c4che/_cache.py')
    except (OSError, IOError):
        bld.fatal('Project is not configured')

    # This is where the cache file is made and VERSION is rewritten.
    global VERSION
    VERSION = bld.cmd_and_log("%s -s VCS_TAG -o %s/autorevision.cache " % (env.get_flat('AUTOREVISION'), bld.path.abspath()), cwd=bld.path.abspath()).strip()


def dist(bld):
    # Make sure that the cache file is in the tarball.
    arv(bld)


def build(bld):
    # Make sure that the cache file is built first.
    arv(bld)
    # Here we let waf know about the autorevision.cache file.
    autorevision_cache_node = bld.path.find_or_declare('autorevision.cache')

    # This is where the autorevision.json file is made.
    bld(
        rule='${AUTOREVISION} -f -t json -o ${SRC[0].abspath()} > ${TGT}',
        source=autorevision_cache_node,
        target='autorevision.json')

    # This is where the autorevision.h file is made.
    bld(
        rule='${AUTOREVISION} -f -t h -o ${SRC[0].abspath()} > ${TGT}',
        source=autorevision_cache_node,
        target='autorevision.h')


def test(bld):
    # A simple sanity check.
    arv(bld)