def build(options): sh('cp %s/index.rst %s' % (options.build.confdir,options.build.sourcedir)) if 'all' in options.build: options['force_all'] = True options['freshenv'] = True bi = sh('git describe --long',capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options, 'build') if updateProgressTables: print 'Creating Chapter Information' populateChapterInfo(project_name, "%s/index.rst" % options.build.confdir)
def thinkcspy(options): sh('cp %s/index.rst %s' % (options.thinkcspy.confdir,options.thinkcspy.sourcedir)) if 'all' in options.thinkcspy: options['force_all'] = True options['freshenv'] = True paverutils.run_sphinx(options,'thinkcspy')
def everyday(options): if 'all' in options.everyday: options['force_all'] = True options['freshenv'] = True paverutils.run_sphinx(options,'everyday')
def pythonds(options): sh('cp %s/index.rst %s' % (options.pythonds.confdir,options.pythonds.sourcedir)) if 'all' in options.pythonds: options['force_all'] = True options['freshenv'] = True paverutils.run_sphinx(options,'pythonds')
def build(options): sh('cp %s/index.rst %s' % (options.build.confdir,options.build.sourcedir)) if 'all' in options.build: options['force_all'] = True options['freshenv'] = True bi = sh('git describe --long',capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options,'build') if updateProgressTables: print 'Creating Chapter Information' populateChapterInfo(project_name, "%s/toc.rst" % options.build.sourcedir)
def build(options): sh("cp %s/index.rst %s" % (options.build.confdir, options.build.sourcedir)) if "all" in options.build: options["force_all"] = True options["freshenv"] = True bi = sh("git describe --long", capture=True)[:-1] bi = bi.split("-")[0] options.build.template_args["build_info"] = bi if "outputdir" in options.build: options.build.outdir = options.build.outputdir if "masterurl" in options.build: options.build.template_args["course_url"] = options.build.masterurl if "masterapp" in options.build: options.build.template_args["appname"] = options.build.masterapp print "Building into ", options.build.outdir paverutils.run_sphinx(options, "build") if updateProgressTables: print "Creating Chapter Information" populateChapterInfo(project_name, "%s/toc.rst" % options.build.sourcedir)
def text(options): "Generate text files from rst input." if paverutils is None: raise RuntimeError( 'Could not find sphinxcontrib.paverutils, will not be able to build text output.' ) paverutils.run_sphinx(options, 'text') return
def devcourse(options): sh('cp %s/index.rst %s' % (options.devcourse.confdir,options.devcourse.sourcedir)) if 'all' in options.devcourse: options['force_all'] = True options['freshenv'] = True paverutils.run_sphinx(options,'devcourse')
def webhtml(options): """Generate HTML files for website. """ set_templates(options.website.templates) if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build HTML output.') paverutils.run_sphinx(options, 'website') sitemap_gen() return
def webhtml(options): """Generate HTML files for website. """ set_templates(options.website.templates) if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build HTML output.') paverutils.run_sphinx(options, 'website') sh('rsync --archive --verbose "%s" "%s"' % (options.website.css_source, options.website.css_dest)) sh('rsync --archive --verbose "%s" "%s"' % (options.website.images_source, options.website.images_dest)) return
def webhtml(options): """Generate HTML files for website. """ set_templates(options.website.templates) if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build HTML output.') paverutils.run_sphinx(options, 'website') #sh('rsync --archive --verbose "%s" "%s"' % (options.website.css_source, options.website.css_dest)) #sh('rsync --archive --verbose "%s" "%s"' % (options.website.images_source, options.website.images_dest)) return
def webhtml(options): """Generate HTML files for website. """ set_templates(options.website.templates) if paverutils is None: raise RuntimeError( 'Could not find sphinxcontrib.paverutils, will not be able to build HTML output.' ) paverutils.run_sphinx(options, 'website') sitemap_gen() return
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True bi = sh('git describe --long', capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi if 'outputdir' in options.build: options.build.outdir = options.build.outputdir print 'Building into ', options.build.outdir paverutils.run_sphinx(options, 'build')
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True bi = sh('git describe --long',capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi if 'outputdir' in options.build: options.build.outdir = options.build.outputdir print 'Building into ', options.build.outdir paverutils.run_sphinx(options,'build')
def gettext(options): "Collect all translatable strings from rst input." # Clean and recreate output directory remake_directories(options.gettext.outdir) set_templates(options.gettext.templates) if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build text output.') # Extract messages (POT) paverutils.run_sphinx(options, "gettext") # Update translations PO: TODO: read conf["locale_dirs"][0] & language (es) sh('sphinx-intl update -p "%s" --locale-dir locale -l es' % (options.gettext.build_dir, )) # Remember to build the MO files once translated: sh('sphinx-intl build -p "%s" --locale-dir locale' % (options.gettext.build_dir, )) return
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options,'build')
def build(options): if "all" in options.build: options["force_all"] = True options["freshenv"] = True try: bi = sh("git describe --long", capture=True)[:-1] bnum = bi.split("-")[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = "unknown" with open("build_info", "w") as bif: bif.write(bi) bif.write("\n") if "outputdir" in options.build: options.build.outdir = options.build.outputdir if "masterurl" in options.build: options.build.template_args["course_url"] = options.build.masterurl if "masterapp" in options.build: options.build.template_args["appname"] = options.build.masterapp print("Building into ", options.build.outdir) rc = paverutils.run_sphinx(options, "build") if rc == 0 or rc is None: print("Done, build successful") else: print("Error in building code {}".format(rc)) return rc
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True try: bi = sh('git describe --long',capture=True)[:-1] bnum = bi.split('-')[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = 'unknown' with open('build_info','w') as bif: bif.write(bi) bif.write("\n") if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print('Building into ', options.build.outdir) rc = paverutils.run_sphinx(options,'build') if rc == 0 or rc is None: print("Done, build successful") else: print("Error in building code {}".format(rc)) return rc
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True try: bi = sh('git describe --long', capture=True)[:-1] bnum = bi.split('-')[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = 'unknown' with open('build_info', 'w') as bif: bif.write(bi) bif.write("\n") if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print('Building into ', options.build.outdir) rc = paverutils.run_sphinx(options, 'build') if rc == 0: print("Done, {} build successful".format(options.build.project_name)) else: print("Error in building {}".format(options.build.project_name))
def blog(options): """Generate the blog post version of the HTML for the current module. The default behavior generates the post for the current module using its index.html file as input. To use a different file within the module directory, use the --in-file or -b option:: paver blog -b communication.html To run against a directory other than a module, use the -s or --sourcedir option:: paver blog -s PyMOTW/articles -b text_processing.html """ # Clean and recreate output directory remake_directories(options.blog.outdir) # Generate html from sphinx if paverutils is None: raise RuntimeError( 'Could not find sphinxcontrib.paverutils, will not be able to build HTML output.' ) paverutils.run_sphinx(options, 'blog') blog_file = path(options.blog.outdir) / options.blog.out_file dry( "Write blog post body to %s" % blog_file, gen_blog_post, outdir=options.blog.outdir, input_base=options.blog.in_file, blog_base=options.blog.out_file, url_base=options.blog.sourcedir, ) title = get_post_title(path(options.blog.outdir) / options.blog.in_file) if not options.no_edit: if os.path.exists('bin/SendToMarsEdit.applescript'): sh('osascript bin/SendToMarsEdit.applescript "%s" "%s"' % (blog_file, "PyMOTW: %s" % title)) elif 'EDITOR' in os.environ: sh('$EDITOR %s' % blog_file) return
def gettext(options): "Collect all translatable strings from rst input." # Create output directory & separate doctree directory for dir in (options.gettext.outdir, os.path.dirname(options.gettext.doctrees)): if not os.path.exists(dir): os.makedirs(dir) # Extract messages (POT) options.order('gettext', 'sphinx', add_rest=True) from sphinxcontrib import paverutils paverutils.run_sphinx(options, "gettext") # Update translations PO: TODO: read conf["locale_dirs"][0] & language (es) sh('sphinx-intl update -p "%s" --locale-dir locale -l es' % (options.gettext.outdir, )) # Remember to build the MO files once translated: sh('sphinx-intl build --locale-dir locale') return
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True options.build.template_args["build_info"] = sh('git describe --long',capture=True)[:-1] if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options,'build')
def gettext(options): "Collect all translatable strings from rst input." # Clean and recreate output directory remake_directories(options.gettext.outdir) set_templates(options.gettext.templates) if paverutils is None: raise RuntimeError( 'Could not find sphinxcontrib.paverutils, will not be able to build text output.' ) # Extract messages (POT) paverutils.run_sphinx(options, "gettext") # Update translations PO: TODO: read conf["locale_dirs"][0] & language (es) sh('sphinx-intl update -p "%s" --locale-dir locale -l es' % (options.gettext.build_dir, )) # Remember to build the MO files once translated: sh('sphinx-intl build -p "%s" --locale-dir locale' % (options.gettext.build_dir, )) return
def blog(options): """Generate the blog post version of the HTML for the current module. The default behavior generates the post for the current module using its index.html file as input. To use a different file within the module directory, use the --in-file or -b option:: paver blog -b communication.html To run against a directory other than a module, use the -s or --sourcedir option:: paver blog -s PyMOTW/articles -b text_processing.html """ # Clean and recreate output directory remake_directories(options.blog.outdir) # Generate html from sphinx if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build HTML output.') paverutils.run_sphinx(options, 'blog') blog_file = path(options.blog.outdir) / options.blog.out_file dry("Write blog post body to %s" % blog_file, gen_blog_post, outdir=options.blog.outdir, input_base=options.blog.in_file, blog_base=options.blog.out_file, url_base=options.blog.sourcedir, ) title = get_post_title(path(options.blog.outdir) / options.blog.in_file) if not options.no_edit: if os.path.exists('bin/SendToMarsEdit.applescript'): sh('osascript bin/SendToMarsEdit.applescript "%s" "%s"' % (blog_file, "PyMOTW: %s" % title) ) elif 'EDITOR' in os.environ: sh('$EDITOR %s' % blog_file) return
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options,'build') if updateProgressTables: print 'Creating Chapter Information' populateChapterInfo(project_name, "%s/index.rst" % options.build.sourcedir)
def build(options): sh('cp %s/index.rst %s' % (options.build.confdir, options.build.sourcedir)) if 'all' in options.build: options['force_all'] = True options['freshenv'] = True bi = sh('git describe --long', capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print 'Building into ', options.build.outdir paverutils.run_sphinx(options, 'build')
def gettext(options): "Collect all translatable strings from rst input." # Clean and recreate output directory remake_directories(options.gettext.outdir) # Choosing another doctree directory remake_directories(os.path.dirname(options.gettext.doctrees)) # Set templates environment variable, used by sphinx/conf.py ##os.environ['TEMPLATES'] = options.gettext.templates if paverutils is None: raise RuntimeError( 'Could not find sphinxcontrib.paverutils, will not be able to build text output.' ) # Extract messages (POT) ##import dbg; dbg.set_trace() options.order('gettext', 'sphinx', add_rest=True) paverutils.run_sphinx(options, "gettext") # Update translations PO: TODO: read conf["locale_dirs"][0] & language (es) sh('sphinx-intl update -p "%s" --locale-dir locale -l es' % (options.gettext.outdir, )) # Remember to build the MO files once translated: sh('sphinx-intl build --locale-dir locale') return
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True try: bi = sh('git describe --long',capture=True)[:-1] bnum = bi.split('-')[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = 'unknown' with open('build_info','w') as bif: bif.write(bi) bif.write("\n") if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print('Building into ', options.build.outdir) rc = paverutils.run_sphinx(options,'build') try: sys.path.insert(0,os.path.join('..','..','modules')) if os.path.exists(os.path.join(options.build.sourcedir,'toc.rst')): idxfile = os.path.join(options.build.sourcedir,'toc.rst') else: idxfile = os.path.join(options.build.sourcedir,'index.rst') from chapternames import populateChapterInfo populateChapterInfo(options.build.project_name, idxfile) print('Creating Chapter Information') except ImportError as e: print('Chapter information database population skipped, This is OK for a standalone build.',e) except Exception as e: print('Chapter Information Creation Failed with', e) if rc == 0: print("Done, {} build successful".format(options.build.project_name)) else: print("Error in building {}".format(options.build.project_name) )
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True try: bi = sh('git describe --long', capture=True)[:-1] bnum = bi.split('-')[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = 'unknown' with open('build_info', 'w') as bif: bif.write(bi) bif.write("\n") if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print('Building into ', options.build.outdir) rc = paverutils.run_sphinx(options, 'build') try: if os.path.exists(os.path.join(options.build.sourcedir, 'toc.rst')): idxfile = os.path.join(options.build.sourcedir, 'toc.rst') else: idxfile = os.path.join(options.build.sourcedir, 'index.rst') populateChapterInfo(options.build.project_name, idxfile) print('Creating Chapter Information') except ImportError as e: print( 'Chapter information database population skipped, This is OK for a standalone build.', e) except Exception as e: print('Chapter Information Creation Failed with', e) if rc == 0: print("Done, {} build successful".format(options.build.project_name)) else: print("Error in building {}".format(options.build.project_name))
def build(options): if "all" in options.build: options["force_all"] = True options["freshenv"] = True try: bi = sh("git describe --long", capture=True)[:-1] bnum = bi.split("-")[0] options.build.template_args["build_info"] = bnum except: bi = "unknown-0-0" options.build.template_args["build_info"] = "unknown" with open("build_info", "w") as bif: bif.write(bi) bif.write("\n") if "outputdir" in options.build: options.build.outdir = options.build.outputdir if "masterurl" in options.build: options.build.template_args["course_url"] = options.build.masterurl if "masterapp" in options.build: options.build.template_args["appname"] = options.build.masterapp print("Building into ", options.build.outdir) rc = paverutils.run_sphinx(options, "build") try: if os.path.exists(os.path.join(options.build.sourcedir, "toc.rst")): idxfile = os.path.join(options.build.sourcedir, "toc.rst") else: idxfile = os.path.join(options.build.sourcedir, "index.rst") populateChapterInfo(options.build.project_name, idxfile) print("Creating Chapter Information for {}".format(idxfile)) except ImportError as e: print("Chapter information database population skipped, This is OK for a standalone build.", e) except Exception as e: print("Chapter Information Creation Failed with", e) if rc == 0: print("Done, {} build successful".format(options.build.project_name)) else: print("Error in building {}".format(options.build.project_name))
def build(options): if 'all' in options.build: options['force_all'] = True options['freshenv'] = True try: bi = sh('git describe --long',capture=True)[:-1] bi = bi.split('-')[0] options.build.template_args["build_info"] = bi except: options.build.template_args["build_info"] = 'unknown' if 'outputdir' in options.build: options.build.outdir = options.build.outputdir if 'masterurl' in options.build: options.build.template_args['course_url'] = options.build.masterurl if 'masterapp' in options.build: options.build.template_args['appname'] = options.build.masterapp print('Building into ', options.build.outdir) rc = paverutils.run_sphinx(options,'build') try: from chapternames import populateChapterInfo populateChapterInfo(options.build.project_name, "%s/index.rst" % options.build.sourcedir) print('Creating Chapter Information') except ImportError: print('Chapter information database population skipped, This is OK for a standalone build.') if rc == 0: print("Done, {} build successful".format(options.build.project_name)) else: print("Error in building {}".format(options.build.project_name) )
def overview(options): if 'all' in options.overview: options['force_all'] = True options['freshenv'] = True paverutils.run_sphinx(options,'overview')
def text(options): "Generate text files from rst input." if paverutils is None: raise RuntimeError('Could not find sphinxcontrib.paverutils, will not be able to build text output.') paverutils.run_sphinx(options, 'text') return
def overview(options): paverutils.run_sphinx(options,'overview')
def devcourse(options): sh('cp %s/index.rst %s' % (options.devcourse.confdir,options.devcourse.sourcedir)) paverutils.run_sphinx(options,'devcourse')
def everyday(options): paverutils.run_sphinx(options,'everyday')
def thinkcspy(options): sh('cp %s/index.rst %s' % (options.thinkcspy.confdir,options.thinkcspy.sourcedir)) paverutils.run_sphinx(options,'thinkcspy')
def pythonds(options): sh('cp %s/index.rst %s' % (options.pythonds.confdir,options.pythonds.sourcedir)) paverutils.run_sphinx(options,'pythonds')
def spelling(options): "Check spelling." rc = paverutils.run_sphinx(options, 'spelling') if rc: raise ValueError('Found spelling mistake')
def linkcheck(): """Check outgoing links """ options.order('linkcheck', 'sphinx', add_rest=True) paverutils.run_sphinx(options, 'linkcheck') return