Merge branch 'remove-argparse' of git://github.com/dagwieers/ansible into devel

Conflicts:
	hacking/module_formatter.py

Don't run webdocs build when building packages
pull/1261/merge
Michael DeHaan 12 years ago
commit 110244d7b4

@ -62,7 +62,7 @@ tests:
PYTHONPATH=./lib nosetests -d -v PYTHONPATH=./lib nosetests -d -v
# To force a rebuild of the docs run 'touch VERSION && make docs' # To force a rebuild of the docs run 'touch VERSION && make docs'
docs: $(MANPAGES) modulepages webdocs docs: $(MANPAGES) modulepages
# Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more # Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
# recently than %.1.asciidoc. # recently than %.1.asciidoc.
@ -116,7 +116,7 @@ python:
install: install:
python setup.py install python setup.py install
sdist: clean sdist: clean docs
python setup.py sdist -t MANIFEST.in python setup.py sdist -t MANIFEST.in
rpmcommon: sdist rpmcommon: sdist
@ -175,5 +175,8 @@ modulejs:
make modulejson make modulejson
hacking/module_formatter.py -A $(VERSION) -t js -o docs/js --module-dir=docs/json --template-dir=hacking/templates hacking/module_formatter.py -A $(VERSION) -t js -o docs/js --module-dir=docs/json --template-dir=hacking/templates
# because this requires Sphinx it is not run as part of every build, those building the RPM and so on can ignore this
webdocs: webdocs:
(cd docsite; make docs) (cd docsite; make docs)

File diff suppressed because one or more lines are too long

@ -25,7 +25,7 @@ import json
import ast import ast
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
import re import re
import argparse import getopt
import time import time
import datetime import datetime
import subprocess import subprocess
@ -174,58 +174,72 @@ def return_data(text, args, outputname, module):
def main(): def main():
class Object(object):
pass
type_choices = ['html', 'latex', 'man', 'rst', 'json']
args = Object()
args.ansible_version = 'unknown'
args.module_dir = MODULEDIR
args.template_dir = 'hacking/templates'
args.type = 'latex'
args.module_list = []
args.verbose = False
args.output_dir = None
args.includes_file = None
args.do_boilerplate = False
p = argparse.ArgumentParser(description="Convert Ansible module DOCUMENTATION strings to other formats") try:
opts, arguments = getopt.getopt(sys.argv[1:], 'A:M:T:t:m:vo:I:GVh',
p.add_argument("-A", "--ansible-version", [ 'ansible-version=', 'module-dir=', 'template-dir=', 'type=',
action="store", 'module=', 'verbose', 'output-dir=', 'includes-file=',
dest="ansible_version", 'generate', 'version', 'help', ])
default="unknown", except getopt.error, e:
help="Ansible version number") print >>sys.stderr, 'ERROR: %s'% str(e)
p.add_argument("-M", "--module-dir", sys.exit(1)
action="store",
dest="module_dir", for opt, arg in opts:
default=MODULEDIR, if opt in ('-A', '--ansible-version'):
help="Ansible modules/ directory") args.ansible_version = arg
p.add_argument("-T", "--template-dir", elif opt in ('-M', '--module-dir'):
action="store", args.module_dir = arg
dest="template_dir", elif opt in ('-T', '--template-dir'):
default="hacking/templates", args.template_dir = arg
help="directory containing Jinja2 templates") elif opt in ('-t', '--type'):
p.add_argument("-t", "--type", args.type = arg
action='store', if args.type not in type_choices:
dest='type', print >>sys.stderr, 'ERROR: Type %s not in possible types %s.' % (args.type, type_choices)
choices=['html', 'latex', 'man', 'rst', 'json', 'js'], sys.exit(1)
default='latex', elif opt in ('-m', '--module'):
help="Output type") args.module_list.append(arg)
p.add_argument("-m", "--module", elif opt in ('-v', '--verbose'):
action='append', args.verbose = True
default=[], elif opt in ('-o', '--output-dir'):
dest='module_list', args.output_dir = arg
help="Add modules to process in module_dir") elif opt in ('-I', '--includes-file'):
p.add_argument("-v", "--verbose", args.includes_file = arg
action='store_true', elif opt in ('-G', '--generate'):
default=False, args.do_boilerplate = True
help="Verbose") elif opt in ('-V', '--version'):
p.add_argument("-o", "--output-dir", print >>sys.stderr, '%(prog)s 1.0'
action="store", elif opt in ('-h', '--help'):
dest="output_dir", print >>sys.stderr, '''Convert Ansible module DOCUMENTATION strings to other formats
default=None,
help="Output directory for module files") -A, --ansible-version= Ansible version number
p.add_argument("-I", "--includes-file", -M, --module-dir= Ansible modules/ directory
action="store", -T, --template-dir= Directory containing Jinja2 templates
dest="includes_file", -t, --type= Output type
default=None, -m, --module= Add modules to process in module_dir
help="Create a file containing list of processed modules") -v, --verbose Verbose
p.add_argument("-G", "--generate", -o, --output-dir= Output directory for module files
action="store_true", -I, --includes-file= Create a file containing list of processed modules
dest="do_boilerplate", -G, --generate Generate boilerplate DOCUMENTATION to stdout
default=False, '''
help="generate boilerplate DOCUMENTATION to stdout") sys.exit(0)
p.add_argument('-V', '--version', action='version', version='%(prog)s 1.0') else:
print >>sys.stderr, 'ERROR: Option %s unknown to getopt' % opt
module_dir = None sys.exit(1)
args = p.parse_args()
# print "M: %s" % args.module_dir # print "M: %s" % args.module_dir
# print "t: %s" % args.type # print "t: %s" % args.type

Loading…
Cancel
Save