autohelp.py: update the paramters handling
- generate the tables in the doc/common/tables dir by default - make the -i switch optional, and assume that git git repositories are in a ./sources/ dir - use elif's instead of multiple return statements in the subcommand test Change-Id: If96ac9df247cea5061c056328307ec88ab74a4f3
This commit is contained in:
@@ -106,6 +106,10 @@ Release notes
|
|||||||
-v output.
|
-v output.
|
||||||
* New command ``openstack-jsoncheck`` to check for niceness of JSON
|
* New command ``openstack-jsoncheck`` to check for niceness of JSON
|
||||||
files and reformat them.
|
files and reformat them.
|
||||||
|
* ``openstack-autohelp``: Update the default parameters. The tables
|
||||||
|
are generated in the doc/common/tables/ dir by default, and the git
|
||||||
|
repository for the project being worked on is looked at in a sources/
|
||||||
|
dir by default.
|
||||||
|
|
||||||
0.13
|
0.13
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -140,9 +140,11 @@ start. This can be done by sourcing the `venv/bin/activate` file.
|
|||||||
Now, download and install the projects. Installation is necessary to satisfy
|
Now, download and install the projects. Installation is necessary to satisfy
|
||||||
dependencies between projects. This will also install required dependencies.
|
dependencies between projects. This will also install required dependencies.
|
||||||
|
|
||||||
|
$ mkdir -p sources && cd sources
|
||||||
$ PROJECTS="ceilometer cinder glance heat neutron nova trove"
|
$ PROJECTS="ceilometer cinder glance heat neutron nova trove"
|
||||||
$ for p in $PROJECTS; do git clone git://git.openstack.org/openstack/$p.git; done
|
$ for p in $PROJECTS; do git clone git://git.openstack.org/openstack/$p.git; done
|
||||||
$ for p in $PROJECTS; do cd $p && python setup.py install && cd ..; done
|
$ for p in $PROJECTS; do cd $p && python setup.py install && cd ..; done
|
||||||
|
$ cd ..
|
||||||
|
|
||||||
Install some missing requirements:
|
Install some missing requirements:
|
||||||
|
|
||||||
@@ -156,7 +158,7 @@ discovered.
|
|||||||
Update the flag names:
|
Update the flag names:
|
||||||
|
|
||||||
$ for p in $PROJECTS; do
|
$ for p in $PROJECTS; do
|
||||||
> ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv update $project -i $project
|
> ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv update $project
|
||||||
> done
|
> done
|
||||||
|
|
||||||
At this point, search through the `*.flagmappings.new` files for anything
|
At this point, search through the `*.flagmappings.new` files for anything
|
||||||
@@ -165,7 +167,7 @@ files and run `autohelp.py` with the `docbook` subcommand:
|
|||||||
|
|
||||||
$ for p in $PROJECTS; do
|
$ for p in $PROJECTS; do
|
||||||
> mv $p.flagmappings.new $p.flagmappings
|
> mv $p.flagmappings.new $p.flagmappings
|
||||||
> ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv docbook $project -i $project
|
> ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv docbook $project
|
||||||
> done
|
> done
|
||||||
|
|
||||||
to generate the XML files and move those into the appropriate part of
|
to generate the XML files and move those into the appropriate part of
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ def git_check(repo_path):
|
|||||||
package_name = os.path.basename(repo.remotes.origin.url)
|
package_name = os.path.basename(repo.remotes.origin.url)
|
||||||
package_name = package_name.replace('.git', '')
|
package_name = package_name.replace('.git', '')
|
||||||
except Exception:
|
except Exception:
|
||||||
print("\nThere is a problem verifying that the directory passed in")
|
print("\n%s doesn't seem to be a valid git repository." % repo_path)
|
||||||
print("is a valid git repository. Please try again.\n")
|
print("Use the -i flag to specify the repository path.\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return package_name
|
return package_name
|
||||||
|
|
||||||
@@ -462,10 +462,10 @@ def main():
|
|||||||
description='Manage flag files, to aid in updating documentation.',
|
description='Manage flag files, to aid in updating documentation.',
|
||||||
usage='%(prog)s <cmd> <package> [options]')
|
usage='%(prog)s <cmd> <package> [options]')
|
||||||
parser.add_argument('subcommand',
|
parser.add_argument('subcommand',
|
||||||
help='action (create, update, verify) [REQUIRED]',
|
help='Action (create, update, verify).',
|
||||||
choices=['create', 'update', 'docbook'])
|
choices=['create', 'update', 'docbook'])
|
||||||
parser.add_argument('package',
|
parser.add_argument('package',
|
||||||
help='name of the top-level package')
|
help='Name of the top-level package.')
|
||||||
parser.add_argument('-v', '--verbose',
|
parser.add_argument('-v', '--verbose',
|
||||||
action='count',
|
action='count',
|
||||||
default=0,
|
default=0,
|
||||||
@@ -473,17 +473,20 @@ def main():
|
|||||||
required=False,)
|
required=False,)
|
||||||
parser.add_argument('-i', '--input',
|
parser.add_argument('-i', '--input',
|
||||||
dest='repo',
|
dest='repo',
|
||||||
help='path to valid git repository [REQUIRED]',
|
help='Path to a valid git repository.',
|
||||||
required=True,
|
required=False,
|
||||||
type=str,)
|
type=str,)
|
||||||
parser.add_argument('-o', '--output',
|
parser.add_argument('-o', '--output',
|
||||||
dest='target',
|
dest='target',
|
||||||
help='directory in which xml files are generated',
|
help='Directory in which xml files are generated.',
|
||||||
required=False,
|
required=False,
|
||||||
default='./',
|
default='../../doc/common/tables/',
|
||||||
type=str,)
|
type=str,)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.repo is None:
|
||||||
|
args.repo = './sources/%s' % args.package
|
||||||
|
|
||||||
package_name = git_check(args.repo)
|
package_name = git_check(args.repo)
|
||||||
|
|
||||||
sys.path.insert(0, args.repo)
|
sys.path.insert(0, args.repo)
|
||||||
@@ -504,19 +507,16 @@ def main():
|
|||||||
|
|
||||||
if args.subcommand == 'create':
|
if args.subcommand == 'create':
|
||||||
create_flagmappings(package_name, options, verbose=args.verbose)
|
create_flagmappings(package_name, options, verbose=args.verbose)
|
||||||
return
|
|
||||||
|
|
||||||
if args.subcommand == 'update':
|
elif args.subcommand == 'update':
|
||||||
update_flagmappings(package_name, options, verbose=args.verbose)
|
update_flagmappings(package_name, options, verbose=args.verbose)
|
||||||
return
|
|
||||||
|
|
||||||
if args.subcommand == 'docbook':
|
elif args.subcommand == 'docbook':
|
||||||
write_docbook(package_name, options, verbose=args.verbose,
|
write_docbook(package_name, options, verbose=args.verbose,
|
||||||
target=args.target)
|
target=args.target)
|
||||||
write_docbook_rootwrap(package_name, args.repo,
|
write_docbook_rootwrap(package_name, args.repo,
|
||||||
verbose=args.verbose,
|
verbose=args.verbose,
|
||||||
target=args.target)
|
target=args.target)
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user