GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — DeepLearningTutorials/doc/scripts/docgen.py at master · jaberg/DeepLearningTutorials Expand file tree/ Copy pathdocgen.pyMore file actions 66 lines (52 loc) · 1.95 KB / Copy pathdocgen.pyFile metadata and controls66 lines (52 loc) · 1.95 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 import sys import os import shutil import inspect import getopt from collections import defaultdict if __name__ == '__main__': throot = "/".join(sys.path[0].split("/")[:-2]) options = defaultdict(bool) options.update(dict([x, y or True] for x, y in getopt.getopt(sys.argv[1:], 'o:', ['rst', 'help', 'nopdf'])[0])) if options['--help']: print 'Usage: %s [OPTIONS]' % sys.argv[0] print ' -o <dir>: output the html files in the specified dir' print ' --rst: only compile the doc (requires sphinx)' print ' --nopdf: do not produce a PDF file from the doc, only HTML' print ' --help: this help' sys.exit(0) options['--all'] = not bool(options['--rst']) def mkdir(path): try: os.mkdir(path) except OSError: pass outdir = options['-o'] or (throot + '/html') mkdir(outdir) os.chdir(outdir) mkdir("doc") # Make sure the appropriate 'deeplearning' directory is in the PYTHONPATH pythonpath = os.environ.get('PYTHONPATH', '') pythonpath = throot + ':' + pythonpath os.environ['PYTHONPATH'] = pythonpath if options['--all'] or options['--rst']: import sphinx sys.path[0:0] = [os.path.join(throot, 'doc')] sphinx.main(['', '-E', os.path.join(throot, 'doc'), '.']) if not options['--nopdf']: # Generate latex file in a temp directory import tempfile workdir = tempfile.mkdtemp() sphinx.main(['', '-E', '-b', 'latex', os.path.join(throot, 'doc'), workdir]) # Compile to PDF os.chdir(workdir) os.system('make') try: shutil.copy(os.path.join(workdir, 'deeplearning.pdf'), outdir) os.chdir(outdir) shutil.rmtree(workdir) except OSError, e: print 'OSError:', e except IOError, e: print 'IOError:', e |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |