File: param.py

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (61 lines) | stat: -rw-r--r-- 1,659 bytes parent folder | download | duplicates (8)
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
60
61
#!/usr/bin/env python3

# Copyright 2018 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)

import BoostBuild

t = BoostBuild.Tester(pass_toolset=0)

t.write("Jamroot.jam", """\
import param ;
import assert ;
import errors : try catch ;
rule test1 ( )
{
    param.handle-named-params ;
}
test1 ;
rule test2 ( sources * )
{
    param.handle-named-params sources ;
    return $(sources) ;
}
assert.result : test2 ;
assert.result test1.cpp test2.cpp : test2 test1.cpp test2.cpp ;
assert.result test1.cpp test2.cpp : test2 sources test1.cpp test2.cpp ;
rule test3 ( sources * : requirements * )
{
    param.handle-named-params sources requirements ;
    return $(sources) -- $(requirements) ;
}
assert.result -- : test3 ;
assert.result -- <link>shared : test3 : <link>shared ;
assert.result test1.cpp -- <link>shared : test3 test1.cpp : <link>shared ;
assert.result test1.cpp -- <link>shared
  : test3 test1.cpp : requirements <link>shared ;
assert.result test1.cpp -- <link>shared
  : test3 sources test1.cpp : requirements <link>shared ;
assert.result test1.cpp -- <link>shared
  : test3 requirements <link>shared : sources test1.cpp ;
assert.result -- : test3 sources ;
assert.result -- : test3 requirements ;
assert.result -- <link>shared : test3 requirements <link>shared ;
try ;
{
    test3 sources test1.cpp : sources test2.cpp ;
}
catch Parameter 'sources' passed more than once. ;
try ;
{
    test3 sources test1.cpp : <link>shared ;
}
catch "Positional arguments must appear first." ;
EXIT : 0 ;
""")

t.run_build_system()

t.cleanup()