Commit e4cc75c 1 parent f2eea1b commit e4cc75c Copy full SHA for e4cc75c
File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
- import click
2
1
import importlib
2
+ import sys
3
+
4
+ import click
3
5
4
6
5
7
@click .group (help = "Manage project based on custom Docker image" )
@@ -18,6 +20,9 @@ def cli():
18
20
"check" ,
19
21
]
20
22
23
+ if len (sys .argv ) > 2 and sys .argv [2 ] in module_deps :
24
+ module_deps = [sys .argv [2 ]]
25
+
21
26
for command in module_deps :
22
27
module_path = "shub.image." + command
23
28
command_module = importlib .import_module (module_path )
Original file line number Diff line number Diff line change 1
1
from __future__ import absolute_import
2
2
import importlib
3
+ import sys
3
4
4
5
import click
5
6
@@ -51,6 +52,12 @@ def cli():
51
52
"image" ,
52
53
]
53
54
55
+ # Some imports, particularly requests and pip, are very slow. To avoid
56
+ # importing these modules when running a command that doesn't need them, we
57
+ # import that command module only.
58
+ if len (sys .argv ) > 1 and sys .argv [1 ] in commands :
59
+ commands = [sys .argv [1 ]]
60
+
54
61
for command in commands :
55
62
module_path = "shub." + command
56
63
command_module = importlib .import_module (module_path )
You can’t perform that action at this time.
0 commit comments