def docs_clean(options): '''Clean docs''' for d in ["html", "doctrees"]: path("%s/%s" % (DOC_BUILD_D, d)).rmtree() try: from paver.doctools import uncog uncog() except ImportError: pass
def release(options): from paver.doctools import uncog testing = options.release.test # Ensure we're on stable branch sh("test $(hg branch) = 'stable'") if not prompt("Is version *%s* correct?" % VERSION): print("Fix VERSION") return if not prompt("Is docs/changelog.rst up to date?"): print("Update changlelog") return print("Checking for clean working copy") if not testing: sh('test -z "$(hg status --modified --added --removed --deleted)"') sh("hg incoming | grep 'no changes found'") changelog() if prompt("Commit ChangeLog?") and not testing: sh("hg commit -m 'prep for release' ChangeLog") test() # FIXME: tox fails when version is, for example, 0.7.5 or 0.7.5-final. # Values like -alpha, -beta, -rc1, etc. work but that is not # what I want in release. #tox() sdist() docdist() uncog() test_dist() # Undo this lame update sh("hg revert paver-minilib.zip") if prompt("Tag release 'v%s'?" % VERSION) and not testing: sh("hg tag v%s" % VERSION) # non-zero returned for success, it appears, ignore. but why not above? sh("hg commit -m 'tagged release'", ignore_error=True) if prompt("Push for release?") and not testing: sh("hg push --rev .") # Github sh("hg book -f -r tip master") sh("hg push --rev . github")
def clean(): '''Cleans mostly everything''' path("build").rmtree() for p in path(".").glob("*.pyc"): p.remove() for d in [path("./src"), path("./examples")]: for f in d.walk(pattern="*.pyc"): f.remove() try: from paver.doctools import uncog uncog() except ImportError: pass
def test_cogging(): env = tasks.Environment(doctools) tasks.environment = env opt = env.options opt.cog = options.Bunch() basedir = path(__file__).dirname() opt.cog.basedir = basedir opt.cog.pattern = "*.rst" opt.cog.includedir = basedir / "data" env.options = opt doctools.cog() textfile = basedir / "data/textfile.rst" data = open(textfile).read() print data assert "print sys.path" in data doctools.uncog() data = open(textfile).read() assert "print sys.path" not in data
def release(options): from paver.doctools import uncog testing = options.release.test # Ensure we're on default branch if not testing: sh("test $(hg branch) = 'default'") if not _prompt("Is version *%s* correct?" % VERSION): print("Fix VERSION") return if not _prompt("Is docs/changelog.rst up to date?"): print("Update changlelog") return print("Checking for clean working copy") if not testing: sh('test -z "$(hg status --modified --added --removed --deleted)"') sh("hg incoming | grep 'no changes found'") changelog() if _prompt("Commit ChangeLog?") and not testing: sh("hg commit -m 'prep for release' ChangeLog") tox() dist() docdist() uncog() test_dist() if _prompt("Tag release 'v%s'?" % VERSION) and not testing: sh("hg tag v%s" % VERSION) # non-zero returned for success, it appears, ignore. but why not above? sh("hg commit -m 'tagged release'", ignore_error=True) if _prompt("Push for release?") and not testing: sh("hg push --rev .") # Github sh("hg book -f -r tip master") sh("hg push --rev . github")
def release(options): from paver.doctools import uncog testing = options.release.test # Ensure we're on stable branch sh("test $(hg branch) = 'stable'") if not prompt("Is version *%s* correct?" % VERSION): print("Fix VERSION") return if not prompt("Is docs/changelog.rst up to date?"): print("Update changlelog") return print("Checking for clean working copy") if not testing: sh('test -z "$(hg status --modified --added --removed --deleted)"') sh("hg outgoing | grep 'no changes found'") sh("hg incoming | grep 'no changes found'") changelog() if prompt("Commit ChangeLog?") and not testing: sh("hg commit -m 'prep for release'") test() distclean() sdist() docdist() uncog() test_dist() if prompt("Tag release 'v%s'?" % VERSION) and not testing: sh("hg tag v%s" % VERSION) # non-zero returned for success, it appears, ignore. but why not above? sh("hg commit -m 'tagged release'", ignore_error=True) if prompt("Push for release?") and not testing: sh("hg push --rev .") checklist()
def test_cogging(): if not paver.doctools.has_cog: raise SkipTest("Cog must be installed for this test") env = tasks.Environment(doctools) tasks.environment = env opt = env.options opt.cog = options.Bunch() basedir = path(__file__).dirname() opt.cog.basedir = basedir opt.cog.pattern = "*.rst" opt.cog.includedir = basedir / "data" env.options = opt doctools.cog() textfile = basedir / "data/textfile.rst" with open(textfile) as f: data = f.read() print_(data) assert "print sys.path" in data doctools.uncog() with open(textfile) as f: data = f.read() assert "print sys.path" not in data