@@ -30,6 +30,20 @@ def pip_command(command, additional_dir=".", error_ok=False):
30
30
if not error_ok :
31
31
sys .exit (1 )
32
32
33
+ def select_install_type (pkg , run_develop , exceptions ):
34
+ # the default for disable_develop will be false, which means `run_develop` will be true
35
+ argument = ""
36
+ if run_develop :
37
+ argument = "-e"
38
+
39
+ if pkg in exceptions :
40
+ # opposite of whatever our decision was
41
+ if argument == "" :
42
+ argument = "-e"
43
+ elif argument == "-e" :
44
+ argument = ""
45
+
46
+ return argument
33
47
34
48
# optional argument in a situation where we want to build a variable subset of packages
35
49
parser = argparse .ArgumentParser (
@@ -44,22 +58,32 @@ def pip_command(command, additional_dir=".", error_ok=False):
44
58
)
45
59
parser .add_argument (
46
60
"--disabledevelop" ,
47
- dest = "develop_mode_disabled " ,
48
- default = False ,
49
- action = "store_true " ,
61
+ dest = "install_in_develop_mode " ,
62
+ default = True ,
63
+ action = "store_false " ,
50
64
help = "Add this argument if you would prefer to install the package with a simple `pip install` versus `pip install -e`" ,
51
65
)
52
-
66
+ # this is a hack to support generating docs for the single package that doesn't support develop mode. It will be removed when we
67
+ # migrate to generating docs on a per-package cadence.
68
+ parser .add_argument (
69
+ "--exceptionlist" ,
70
+ "-e" ,
71
+ dest = "exception_list" ,
72
+ default = "" ,
73
+ help = "Comma separated list of packages that we want to take the 'opposite' installation method for." ,
74
+ )
53
75
54
76
args = parser .parse_args ()
55
77
56
78
packages = {
57
79
tuple (os .path .dirname (f ).rsplit (os .sep , 1 ))
58
- for f in glob .glob ("sdk/*/azure*/setup.py" ) + glob .glob ("tools/azure*/setup.py" )
80
+ for f in glob .glob ("sdk/*/azure- */setup.py" ) + glob .glob ("tools/azure- */setup.py" )
59
81
}
60
82
# [(base_folder, package_name), ...] to {package_name: base_folder, ...}
61
83
packages = {package_name : base_folder for (base_folder , package_name ) in packages }
62
84
85
+ exceptions = [p .strip () for p in args .exception_list .split (',' )]
86
+
63
87
# keep targeted packages separate. python2 needs the nspkgs to work properly.
64
88
if not args .packageList :
65
89
targeted_packages = list (packages .keys ())
@@ -118,6 +142,8 @@ def pip_command(command, additional_dir=".", error_ok=False):
118
142
for package_name in nspkg_packages :
119
143
pip_command ("install {}/{}/" .format (packages [package_name ], package_name ))
120
144
145
+
146
+
121
147
# install packages
122
148
print ("Packages to install: {}" .format (content_packages ))
123
149
for package_name in content_packages :
@@ -132,11 +158,9 @@ def pip_command(command, additional_dir=".", error_ok=False):
132
158
os .path .join (packages [package_name ], package_name ),
133
159
)
134
160
135
- mode_arg = "" if args .develop_mode_disabled else "-e"
136
-
137
161
pip_command (
138
162
"install --ignore-requires-python {} {}" .format (
139
- mode_arg ,
163
+ select_install_type ( package_name , args . install_in_develop_mode , exceptions ) ,
140
164
os .path .join (packages [package_name ], package_name )
141
165
)
142
166
)
0 commit comments