/
wscript
59 lines (40 loc) · 1.56 KB
/
wscript
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
59
#! /usr/bin/env python
# encoding: utf-8
import os
APPNAME = "bitter"
VERSION = "7.0.0"
def options(opt):
opt.add_option(
"--test_filter",
default=None,
action="store",
help="Compiles all tests that include the substring specified."
"Wildcards allowed. (Used with --run_tests)",
)
def build(bld):
bld.env.append_unique(
"DEFINES_STEINWURF_VERSION", 'STEINWURF_BITTER_VERSION="{}"'.format(VERSION)
)
bld(name="bitter_includes", includes="./src", export_includes="./src")
if bld.is_toplevel():
# Only build tests when executed from the top-level wscript,
# i.e. not when included as a dependency
bld.recurse("test")
bld.recurse("examples/simple_writer")
bld.recurse("examples/simple_reader")
def docs(ctx):
"""Build the documentation in a virtualenv"""
with ctx.create_virtualenv() as venv:
# To update the requirements.txt just delete it - a fresh one
# will be generated from test/requirements.in
if not os.path.isfile("docs/requirements.txt"):
venv.run("python -m pip install pip-tools")
venv.run("pip-compile docs/requirements.in")
venv.run("python -m pip install -r docs/requirements.txt")
build_path = os.path.join(ctx.path.abspath(), "build", "site", "docs")
venv.run(
"giit clean . --build_path {}".format(build_path), cwd=ctx.path.abspath()
)
venv.run(
"giit sphinx . --build_path {}".format(build_path), cwd=ctx.path.abspath()
)