File tree 7 files changed +50
-41
lines changed
7 files changed +50
-41
lines changed Original file line number Diff line number Diff line change 27
27
import click
28
28
29
29
30
+ def cli_command (name ):
31
+ """Click command with correct settings applied."""
32
+ return click .command (name , context_settings = {"allow_interspersed_args" : False })
33
+
34
+
30
35
def conanfile ():
31
36
"""Click argument CONANFILE."""
32
37
return click .argument (
@@ -36,7 +41,7 @@ def conanfile():
36
41
37
42
def args ():
38
43
"""Click argument ARGS."""
39
- return click .argument ("args" , nargs = - 1 )
44
+ return click .argument ("args" , nargs = - 1 , type = click . UNPROCESSED )
40
45
41
46
42
47
def split_args (xargs ) -> Tuple [List [str ], List [str ]]:
Original file line number Diff line number Diff line change 26
26
27
27
from cloe_launch import Configuration
28
28
from cloe_launch .exec import Engine
29
- from . import options
29
+ from . import _options
30
+ from ._options import cli_command
30
31
31
-
32
- @click .command ("activate" )
33
- @options .cache ()
34
- @options .conanfile ()
35
- @options .args ()
32
+ @cli_command ("activate" )
33
+ @_options .cache ()
34
+ @_options .conanfile ()
35
+ @_options .args ()
36
36
@click .pass_obj
37
37
def cli_activate (
38
38
conf : Configuration ,
@@ -71,5 +71,5 @@ def cli_activate(
71
71
command instead of `activate`.
72
72
"""
73
73
engine = Engine (conf , conanfile = conanfile )
74
- engine .conan_args = options .extract_conan_args (args )
74
+ engine .conan_args = _options .extract_conan_args (args )
75
75
engine .activate (use_cache = cache )
Original file line number Diff line number Diff line change 29
29
30
30
from cloe_launch import Configuration
31
31
from cloe_launch .exec import Engine
32
- from . import options
32
+ from . import _options
33
+ from ._options import cli_command
33
34
34
35
35
- @click . command ("clean" )
36
+ @cli_command ("clean" )
36
37
@click .option ("--all" , is_flag = True , help = "Clean all runtime environments." )
37
- @options .conanfile ()
38
+ @_options .conanfile ()
38
39
@click .pass_obj
39
40
def cli_clean (
40
41
conf : Configuration ,
Original file line number Diff line number Diff line change 30
30
31
31
from cloe_launch import Configuration
32
32
from cloe_launch .exec import Engine
33
- from . import options
33
+ from . import _options
34
+ from ._options import cli_command
34
35
35
36
36
- @click . command ("deploy" )
37
+ @cli_command ("deploy" )
37
38
@click .option (
38
39
"-D" ,
39
40
"--dest" ,
53
54
default = True ,
54
55
help = "Set the RPATH of all binaries and libraries." ,
55
56
)
56
- @options .conanfile ()
57
- @options .args ()
57
+ @_options .conanfile ()
58
+ @_options .args ()
58
59
@click .pass_obj
59
60
def cli_deploy (
60
61
conf : Configuration ,
@@ -76,7 +77,7 @@ def cli_deploy(
76
77
cloe-launch deploy -D deploy tests/conanfile.py
77
78
"""
78
79
engine = Engine (conf , conanfile = conanfile )
79
- engine .conan_args = options .extract_conan_args (args )
80
+ engine .conan_args = _options .extract_conan_args (args )
80
81
81
82
try :
82
83
engine .deploy (
Original file line number Diff line number Diff line change 29
29
30
30
from cloe_launch import Configuration
31
31
from cloe_launch .exec import Engine
32
- from . import options
32
+ from . import _options
33
+ from ._options import cli_command
33
34
34
-
35
- @click .command ("exec" )
36
- @options .preserve_env ()
37
- @options .override_env ()
38
- @options .cache ()
35
+ @cli_command ("exec" )
36
+ @_options .preserve_env ()
37
+ @_options .override_env ()
38
+ @_options .cache ()
39
39
@click .option (
40
40
"-d" ,
41
41
"--debug" ,
42
42
is_flag = True ,
43
43
help = "Launch cloe-engine with GDB." ,
44
44
)
45
- @options .conanfile ()
46
- @options .args ()
45
+ @_options .conanfile ()
46
+ @_options .args ()
47
47
@click .pass_obj
48
48
def cli_exec (
49
49
conf : Configuration ,
@@ -69,13 +69,13 @@ def cli_exec(
69
69
cloe-launch exec -c tests/conanfile.py -- -l debug run tests/smoketest.json
70
70
"""
71
71
engine = Engine (conf , conanfile = conanfile )
72
- engine .conan_args = options .extract_conan_args (args )
72
+ engine .conan_args = _options .extract_conan_args (args )
73
73
engine .preserve_env = preserve_env
74
74
75
75
# Run cloe-engine and pass on returncode:
76
76
# If cloe-engine is killed/aborted, subprocess will return 250.
77
- engine_args = options .extract_target_args (args )
78
- overrides = options .process_overrides (override_env )
77
+ engine_args = _options .extract_target_args (args )
78
+ overrides = _options .process_overrides (override_env )
79
79
result = engine .exec (
80
80
engine_args , use_cache = cache , debug = debug , override_env = overrides
81
81
)
Original file line number Diff line number Diff line change 29
29
30
30
from cloe_launch import Configuration
31
31
from cloe_launch .exec import Engine
32
- from . import options
32
+ from . import _options
33
+ from ._options import cli_command
33
34
34
35
35
- @click . command ("prepare" )
36
- @options .conanfile ()
37
- @options .args ()
36
+ @cli_command ("prepare" )
37
+ @_options .conanfile ()
38
+ @_options .args ()
38
39
@click .pass_obj
39
40
def cli_prepare (
40
41
conf : Configuration ,
@@ -60,7 +61,7 @@ def cli_prepare(
60
61
cloe-launch prepare tests/conanfile.py --require-override boost/1.81
61
62
"""
62
63
engine = Engine (conf , conanfile = conanfile )
63
- engine .conan_args = options .extract_conan_args (args )
64
+ engine .conan_args = _options .extract_conan_args (args )
64
65
65
66
try :
66
67
engine .prepare ()
Original file line number Diff line number Diff line change 28
28
29
29
from cloe_launch import Configuration
30
30
from cloe_launch .exec import Engine
31
- from . import options
31
+ from . import _options
32
+ from ._options import cli_command
32
33
33
34
34
- @click . command ("shell" )
35
- @options .preserve_env ()
36
- @options .override_env ()
37
- @options .cache ()
38
- @options .conanfile ()
39
- @options .args ()
35
+ @cli_command ("shell" )
36
+ @_options .preserve_env ()
37
+ @_options .override_env ()
38
+ @_options .cache ()
39
+ @_options .conanfile ()
40
+ @_options .args ()
40
41
@click .pass_obj
41
42
def cli_shell (
42
43
conf : Configuration ,
@@ -66,7 +67,7 @@ def cli_shell(
66
67
"""
67
68
engine = Engine (conf , conanfile = conanfile )
68
69
engine .preserve_env = preserve_env
69
- engine .conan_args = options .extract_conan_args (args )
70
+ engine .conan_args = _options .extract_conan_args (args )
70
71
71
72
# Replace process with shell.
72
- engine .shell (options .extract_target_args (args ), use_cache = cache )
73
+ engine .shell (_options .extract_target_args (args ), use_cache = cache )
You can’t perform that action at this time.
0 commit comments