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 · 2php/DeepLearningTutorials Expand file tree/ Copy pathdocgen.pyMore file actions 63 lines (53 loc) · 2.01 KB / Copy pathdocgen.pyFile metadata and controls63 lines (53 loc) · 2.01 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 from __future__ import print_function import sys import os import shutil import getopt from collections import defaultdict if __name__ == '__main__': throot = "/".join(sys.path[0].split("/")[:-2]) options = defaultdict(bool) output_arg = getopt.getopt(sys.argv[1:], 'o:', ['rst', 'help', 'nopdf'])[0] options.update(dict([x, y or True] for x, y in output_arg)) 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 as e: print('OSError:', e) except IOError as e: print('IOError:', e) |
| You are visitor 01402775 — 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. |