def clean(self, scm, dist): term.green("Removing bytecode files...") for filename in shell.dirs('.', '__pycache__'): shell.rm_rf(filename) for filename in shell.files('.', '*.py[co]'): shell.rm(filename) for filename in shell.files('.', '*$py.class'): shell.rm(filename)
def clean(self, scm, dist): term.green("Removing python byte code...") for name in shell.dirs('.', '__pycache__'): shell.rm_rf(name) for name in shell.files('.', '*.py[co]'): shell.rm(name) term.green("Removing c extensions...") for name in shell.files('.', '*.so'): shell.rm(name) for name in shell.files('.', '*.pyd'): shell.rm(name) shell.rm_rf(self.dirs['build'])
def clean(self, scm, dist): term.green("Removing python byte code...") for name in shell.dirs('.', '__pycache__'): shell.rm_rf(name) for name in shell.files('.', '*.py[co]'): shell.rm(name) for name in shell.files('.', '*$py.class'): shell.rm(name) term.green("Removing c extensions...") for name in shell.files('.', '*.so'): shell.rm(name) for name in shell.files('.', '*.pyd'): shell.rm(name) shell.rm_rf(self.dirs['build'])
def clean(self, scm, dist): term.green("Removing python byte code...") for name in shell.dirs(".", "__pycache__"): shell.rm_rf(name) for name in shell.files(".", "*.py[co]"): shell.rm(name) for name in shell.files(".", "*$py.class"): shell.rm(name) term.green("Removing c extensions...") for name in shell.files(".", "*.so"): shell.rm(name) for name in shell.files(".", "*.pyd"): shell.rm(name) shell.rm_rf(self.dirs["build"])
def clean(self, scm, dist): if scm: term.green("Removing userdocs...") shell.rm_rf(self.dirs['userdoc']) shell.rm_rf(self.dirs['userdoc_build'])
def clean(self, scm, dist): if scm: term.green("Removing apidocs...") shell.rm_rf(self.dirs['apidoc'])
def clean(self, scm, dist): term.green("Removing coverage files...") shell.rm_rf(self.dirs['coverage']) shell.rm('.coverage')
def clean(self, scm, dist): if scm: term.green("Removing website...") shell.rm_rf(self.dirs['website']) shell.rm_rf(self.dirs['_website'])
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 clean(self, scm, dist): _term.green("Removing dist files...") _shell.rm_rf(self._dist)
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()
def clean(self, scm, dist): term.green("Removing coverage files...") shell.rm_rf(self.dirs['coverage']) shell.rm('.coverage') shell.rm_rf('.tox') shell.rm_rf('.cache')
def clean(self, scm, dist): term.green("Removing dist files...") shell.rm_rf(self.dirs["dist"])