# HG changeset patch # User Jeff Hammel # Date 1312261530 25200 # Node ID 5a4c1339b2f95f15e00af1a0249b841d8aa7082e # Parent 3464eda1af8068c1606e896709be1b0366b4f423 more stubbing diff -r 3464eda1af80 -r 5a4c1339b2f9 document_it.py --- a/document_it.py Mon Aug 01 21:54:31 2011 -0700 +++ b/document_it.py Mon Aug 01 22:05:30 2011 -0700 @@ -41,10 +41,11 @@ def parse_manifest(filename, directory=None): """ reads a documentation manifest; returns a list of two-tuples: - [ + [(filename, destination)] """ - assert os.path.exists(filename) and os.path.isfile(filename) + assert os.path.exists(filename) and os.path.isfile(filename), "%s not found" % filename + if directory is None: directory = os.path.dirname(os.path.abspath(filename)) lines = [line.strip() for line in file(filename).readlines()] @@ -80,28 +81,38 @@ parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) parser.add_option('-d', '--directory', dest='directory', - help='render the documentation to this directory') + help='render the documentation from this directory') parser.add_option('--dest', dest='dest', default=DEST, - help='base URL of destination') + help='base directory or URL of destination') parser.add_option('-u', '--user', dest='user', help='user name') - parser.add_option('--list', dest='list', action='store_true', - help="list packages") + parser.add_option('--list', dest='list', action='store_true', default=False, + help="list files") options, manifests = parser.parse_args(args) + # print help if no manifests given if not args: parser.print_help() parser.exit() - # run setup_development.py in this directory - # to ensure documentation is up to date - # TODO; as yet unneeded + # read the manifests + files = [] + for manifest in manifests: + for item in parse_manifest(manifest): + if item not in files: + files.append(item) + if options.list: + for item in files: + print '%s -> %s' % (item[0], item[1]) + # render and upload READMEs - # TODO - - + if options.directory: + pass + else: + # TODO check credentials + raise NotImplementedError if __name__ == '__main__': main()