Skip to content

Commit 758f358

Browse files
authored
Doc build resolution for extension package (Azure#7217)
* support for special casing in the doc build * update the docs.yml to take advantage of the new feature
1 parent 26319a8 commit 758f358

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

.azure-pipelines/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
displayName: 'Install All Packages'
2323
inputs:
2424
scriptPath: 'scripts/dev_setup.py'
25-
25+
arguments: '--exceptionlist=azure-eventhubs-checkpointstoreblob-aio'
26+
=
2627
- powershell: |
2728
cd $(Build.SourcesDirectory)/doc/sphinx
2829
pip install -r requirements.txt

scripts/dev_setup.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ def pip_command(command, additional_dir=".", error_ok=False):
3030
if not error_ok:
3131
sys.exit(1)
3232

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
3347

3448
# optional argument in a situation where we want to build a variable subset of packages
3549
parser = argparse.ArgumentParser(
@@ -44,22 +58,32 @@ def pip_command(command, additional_dir=".", error_ok=False):
4458
)
4559
parser.add_argument(
4660
"--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",
5064
help="Add this argument if you would prefer to install the package with a simple `pip install` versus `pip install -e`",
5165
)
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+
)
5375

5476
args = parser.parse_args()
5577

5678
packages = {
5779
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")
5981
}
6082
# [(base_folder, package_name), ...] to {package_name: base_folder, ...}
6183
packages = {package_name: base_folder for (base_folder, package_name) in packages}
6284

85+
exceptions = [p.strip() for p in args.exception_list.split(',')]
86+
6387
# keep targeted packages separate. python2 needs the nspkgs to work properly.
6488
if not args.packageList:
6589
targeted_packages = list(packages.keys())
@@ -118,6 +142,8 @@ def pip_command(command, additional_dir=".", error_ok=False):
118142
for package_name in nspkg_packages:
119143
pip_command("install {}/{}/".format(packages[package_name], package_name))
120144

145+
146+
121147
# install packages
122148
print("Packages to install: {}".format(content_packages))
123149
for package_name in content_packages:
@@ -132,11 +158,9 @@ def pip_command(command, additional_dir=".", error_ok=False):
132158
os.path.join(packages[package_name], package_name),
133159
)
134160

135-
mode_arg = "" if args.develop_mode_disabled else "-e"
136-
137161
pip_command(
138162
"install --ignore-requires-python {} {}".format(
139-
mode_arg,
163+
select_install_type(package_name, args.install_in_develop_mode, exceptions),
140164
os.path.join(packages[package_name], package_name)
141165
)
142166
)

0 commit comments

Comments
 (0)