def run(self): from _setup.util import SafeConfigParser as parser parser = parser() parser.read('package.cfg', **cfgread) strversion = parser.get('package', 'version.number') shortversion = tuple(map(int, strversion.split('.')[:2])) shell.rm_rf(self.dirs['_website']) shell.cp_r(self.dirs['userdoc_source'], _os.path.join(self.dirs['_website'], 'src')) shell.rm_rf(_os.path.join(self.dirs['_website'], 'build')) shell.rm_rf(self.dirs['website']) _os.makedirs(self.dirs['website']) filename = _os.path.join(self.dirs['_website'], 'src', 'website_download.txt') fp = textopen(filename) try: download = fp.read() finally: fp.close() filename = _os.path.join(self.dirs['_website'], 'src', 'index.txt') fp = textopen(filename) try: indexlines = fp.readlines() finally: fp.close() fp = textopen(filename, 'w') try: for line in indexlines: if line.startswith('.. placeholder: Download'): line = download fp.write(line) finally: fp.close() shell.cp_r( self.dirs['apidoc'], _os.path.join(self.dirs['website'], 'doc-%d.%d' % shortversion)) shell.cp_r( self.dirs['apidoc'], _os.path.join(self.dirs['_website'], 'src', 'doc-%d.%d' % shortversion)) fp = textopen(_os.path.join(self.dirs['_website'], 'src', 'conf.py'), 'a') try: fp.write("\nepydoc = dict(rcssmin=%r)\n" % (_os.path.join( shell.native(self.dirs['_website']), "src", "doc-%d.%d" % shortversion, ), )) fp.write("\nexclude_trees.append(%r)\n" % "doc-%d.%d" % shortversion) finally: fp.close() from _setup.dev import userdoc userdoc.sphinx( build=shell.native(_os.path.join(self.dirs['_website'], 'build')), source=shell.native(_os.path.join(self.dirs['_website'], 'src')), target=shell.native(self.dirs['website']), ) shell.rm(_os.path.join(self.dirs['website'], '.buildinfo'))
def run(self): from _setup.util import SafeConfigParser as parser parser = parser() parser.read('package.cfg', **cfgread) strversion = parser.get('package', 'version.number') shortversion = tuple(map(int, strversion.split('.')[:2])) shell.rm_rf(self.dirs['_website']) shell.cp_r( self.dirs['userdoc_source'], _os.path.join(self.dirs['_website'], 'src') ) shell.rm_rf(_os.path.join(self.dirs['_website'], 'build')) shell.rm_rf(self.dirs['website']) _os.makedirs(self.dirs['website']) filename = _os.path.join( self.dirs['_website'], 'src', 'website_download.txt' ) fp = textopen(filename) try: download = fp.read() finally: fp.close() filename = _os.path.join(self.dirs['_website'], 'src', 'index.txt') fp = textopen(filename) try: indexlines = fp.readlines() finally: fp.close() fp = textopen(filename, 'w') try: for line in indexlines: if line.startswith('.. placeholder: Download'): line = download fp.write(line) finally: fp.close() shell.cp_r( self.dirs['apidoc'], _os.path.join(self.dirs['website'], 'doc-%d.%d' % shortversion) ) shell.cp_r( self.dirs['apidoc'], _os.path.join( self.dirs['_website'], 'src', 'doc-%d.%d' % shortversion ) ) fp = textopen(_os.path.join( self.dirs['_website'], 'src', 'conf.py' ), 'a') try: fp.write("\nepydoc = dict(wtf=%r)\n" % ( _os.path.join( shell.native(self.dirs['_website']), "src", "doc-%d.%d" % shortversion, ), )) fp.write("\nexclude_trees.append(%r)\n" % "doc-%d.%d" % shortversion ) finally: fp.close() from _setup.dev import userdoc userdoc.sphinx( build=shell.native(_os.path.join(self.dirs['_website'], 'build')), source=shell.native(_os.path.join(self.dirs['_website'], 'src')), target=shell.native(self.dirs['website']), ) shell.rm(_os.path.join(self.dirs['website'], '.buildinfo'))
def run(self): from _setup.util import SafeConfigParser as parser parser = parser() parser.read("package.cfg", **cfgread) strversion = parser.get("package", "version.number") shortversion = tuple(map(int, strversion.split(".")[:2])) shell.rm_rf(self.dirs["_website"]) shell.cp_r(self.dirs["userdoc_source"], _os.path.join(self.dirs["_website"], "src")) for filename in shell.files(_os.path.join(self.dirs["_website"], "src"), "*.txt"): fp = textopen(filename, "r") try: content = fp.read().replace("../examples/", "examples/") finally: fp.close() fp = textopen(filename, "w") try: fp.write(content) finally: fp.close() shell.cp_r(self.dirs["examples"], _os.path.join(self.dirs["_website"], "src", "examples")) shell.rm_rf(_os.path.join(self.dirs["_website"], "build")) shell.rm_rf(self.dirs["website"]) _os.makedirs(self.dirs["website"]) filename = _os.path.join(self.dirs["_website"], "src", "website_download.txt") fp = textopen(filename) try: download = fp.read() finally: fp.close() filename = _os.path.join(self.dirs["_website"], "src", "index.txt") fp = textopen(filename) try: indexlines = fp.readlines() finally: fp.close() fp = textopen(filename, "w") try: for line in indexlines: if line.startswith(".. placeholder: Download"): line = download fp.write(line) finally: fp.close() shell.cp_r(self.dirs["examples"], _os.path.join(self.dirs["website"], "examples")) for top, dirs, _ in shell.walk(_os.path.join(self.dirs["website"], "examples")): if ".svn" in dirs: dirs.remove(".svn") shell.rm_rf(_os.path.join(top, ".svn")) if ".git" in dirs: dirs.remove(".git") shell.rm_rf(_os.path.join(top, ".git")) shell.cp_r(self.dirs["apidoc"], _os.path.join(self.dirs["website"], "doc-%d.%d" % shortversion)) shell.cp_r(self.dirs["apidoc"], _os.path.join(self.dirs["_website"], "src", "doc-%d.%d" % shortversion)) fp = textopen(_os.path.join(self.dirs["_website"], "src", "conf.py"), "a") try: fp.write( "\nepydoc = dict(tdi=%r)\n" % (_os.path.join(shell.native(self.dirs["_website"]), "src", "doc-%d.%d" % shortversion),) ) fp.write("\nexclude_trees.append(%r)\n" % "doc-%d.%d" % shortversion) fp.write("\nexclude_trees.append('examples')\n") finally: fp.close() from _setup.dev import userdoc userdoc.sphinx( build=shell.native(_os.path.join(self.dirs["_website"], "build")), source=shell.native(_os.path.join(self.dirs["_website"], "src")), target=shell.native(self.dirs["website"]), ) shell.rm(_os.path.join(self.dirs["website"], ".buildinfo")) fp = open(_os.path.join(self.dirs["website"], "examples", ".htaccess"), "wb") try: fp.write("Options -Indexes\n") fp.write("<Files *.py>\n") fp.write("ForceType text/plain\n") fp.write("</Files>\n") fp.write("<Files *.out>\n") fp.write("ForceType text/plain\n") fp.write("</Files>\n") finally: fp.close()