Skip to content

Commit

Permalink
converge management documentation generation to the same methodology … (
Browse files Browse the repository at this point in the history
#16369)

* converge management documentation generation to the same methodology in preperation for deleting generate_doc.py
  • Loading branch information
scbedd authored Feb 17, 2021
1 parent 108c8ef commit 5d1bba9
Showing 1 changed file with 1 addition and 33 deletions.
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))

0 comments on commit 5d1bba9

Please sign in to comment.