Skip to content

Commit a041553

Browse files
author
y-p
committed
BLD/DOC: Add argparse to doc make.py to control building
1 parent e5500c9 commit a041553

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

doc/make.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,31 @@ def generate_index(api=True, single=False, **kwds):
295295
with open("source/index.rst","wb") as f:
296296
f.write(t.render(api=api,single=single,**kwds))
297297

298+
import argparse
299+
argparser = argparse.ArgumentParser(description="Pandas documentation builder",
300+
epilog="Targets : %s" % funcd.keys())
301+
302+
argparser.add_argument('--no-api',
303+
default=False,
304+
help='Ommit api and autosummary',
305+
action='store_true')
306+
argparser.add_argument('--single',
307+
metavar='FILENAME',
308+
type=str,
309+
default=False,
310+
help='filename of section to compile, e.g. "indexing"')
311+
298312
def main():
299-
generate_index(api=False, single='indexing')
313+
args, unknown = argparser.parse_known_args()
314+
sys.argv = [sys.argv[0]] + unknown
315+
if args.single:
316+
args.single = os.path.basename(args.single).split(".rst")[0]
317+
318+
if 'clean' in unknown:
319+
args.single=False
320+
321+
generate_index(api=not args.no_api and not args.single, single=args.single)
322+
300323
if len(sys.argv) > 2:
301324
ftype = sys.argv[1]
302325
ver = sys.argv[2]

0 commit comments

Comments
 (0)