From e8e39ed343622350e114c84ecd5fcc0c94bfec6b Mon Sep 17 00:00:00 2001 From: Diana Clarke Date: Thu, 29 Dec 2016 14:33:37 -0600 Subject: [PATCH] Blacklist rather than whitelist autodoc modules Autogenerate the nova client python API module list rather than having to remember to add new modules; use exclude to blacklist modules that shouldn't be included in autodoc. Change-Id: I051a7094f3b536f1e9a939af87e3fc89554fb375 --- doc/source/conf.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 935a45f9c..237a363ae 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -70,18 +70,17 @@ def gen_ref(ver, title, names): "signs": "=" * len(name), "pkg": pkg, "name": name}) + +def get_module_names(): + names = os.listdir(os.path.join(ROOT, 'novaclient', 'v2')) + exclude = ['shell.py', '__init__.py'] + for name in names: + if name.endswith('.py') and name not in exclude: + yield name.strip('.py') + + gen_ref(None, "Exceptions", ["exceptions"]) -gen_ref("v2", "Version 1.1, Version 2 API", - ["agents", "aggregates", "assisted_volume_snapshots", - "availability_zones", "cells", "certs", "client", "cloudpipe", - "fixed_ips", "flavor_access", "flavors", "floating_ip_dns", - "floating_ip_pools", "floating_ips", "floating_ips_bulk", "fping", - "hosts", "hypervisors", "images", "instance_action", "keypairs", - "limits", "list_extensions", "migrations", "networks", - "quota_classes", "quotas", "security_group_default_rules", - "security_group_rules", "security_groups", "server_external_events", - "server_groups", "server_migrations", "servers", "services", "usage", - "versions", "virtual_interfaces", "volumes"]) +gen_ref("v2", "Version 2 API", sorted(get_module_names())) # -- General configuration ----------------------------------------------------