1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Michael DeHaan 2012-10-10 18:46:51 -04:00
commit 110244d7b4
3 changed files with 70 additions and 53 deletions

View file

@ -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

View file

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