Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converge management documentation generation to the same methodology … #16369

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions eng/tox/run_sphinx_apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
logging.getLogger().setLevel(logging.INFO)

root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
generate_mgmt_script = os.path.join(root_dir, "doc/sphinx/generate_doc.py")

def is_mgmt_package(package_dir):
return "mgmt" in pkg_name or "cognitiveservices" in pkg_name

def copy_existing_docs(source, target):
for file in os.listdir(source):
Expand Down Expand Up @@ -65,31 +61,6 @@ def sphinx_apidoc(working_directory):
)
exit(1)

def mgmt_apidoc(working_directory, namespace):
command_array = [
sys.executable,
generate_mgmt_script,
"-p",
namespace,
"-o",
working_directory,
"--verbose"
]

try:
logging.info("Command to generate management sphinx sources: {}".format(command_array))

check_call(
command_array
)
except CalledProcessError as e:
logging.error(
"script failed for path {} exited with error {}".format(
args.working_directory, e.returncode
)
)
exit(1)

if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Run sphinx-apidoc against target folder. Handles management generation if necessary."
Expand Down Expand Up @@ -120,9 +91,6 @@ def mgmt_apidoc(working_directory, namespace):
pkg_name, namespace, pkg_version = get_package_details(os.path.join(package_dir, 'setup.py'))

if should_build_docs(pkg_name):
if is_mgmt_package(pkg_name):
mgmt_apidoc(output_directory, namespace)
else:
sphinx_apidoc(args.working_directory)
sphinx_apidoc(args.working_directory)
else:
logging.info("Skipping sphinx source generation for {}".format(pkg_name))