def run(self): import setup _old_argv = _sys.argv try: _sys.argv = ['setup.py', '-q', 'build'] if not self.HIDDEN: _sys.argv.remove('-q') setup.setup() if 'java' not in _sys.platform.lower(): _sys.argv = [ 'setup.py', '-q', 'install_lib', '--install-dir', shell.native(self.dirs['lib']), '--optimize', '2', ] if not self.HIDDEN: _sys.argv.remove('-q') setup.setup() finally: _sys.argv = _old_argv for name in shell.files("%s/wtf" % self.dirs['lib'], '*.py'): self.compile(name) term.write("%(ERASE)s") term.green("All files successfully compiled.")
def run(self): import setup _old_argv = _sys.argv try: _sys.argv = ['setup.py', '-q', 'build'] if not self.HIDDEN: _sys.argv.remove('-q') setup.setup() if 'java' not in _sys.platform.lower(): _sys.argv = [ 'setup.py', '-q', 'install_lib', '--install-dir', shell.native(self.dirs['lib']), '--optimize', '2', ] if not self.HIDDEN: _sys.argv.remove('-q') setup.setup() finally: _sys.argv = _old_argv self.compile('rcssmin.py') term.write("%(ERASE)s") term.green("All files successfully compiled.")
def run(self): import setup _old_argv = _sys.argv try: _sys.argv = ["setup.py", "-q", "build"] if not self.HIDDEN: _sys.argv.remove("-q") setup.setup() if "java" not in _sys.platform.lower(): _sys.argv = [ "setup.py", "-q", "install_lib", "--install-dir", shell.native(self.dirs["lib"]), "--optimize", "2", ] if not self.HIDDEN: _sys.argv.remove("-q") setup.setup() finally: _sys.argv = _old_argv for name in shell.files("%s/tdi" % self.dirs["lib"], "*.py"): self.compile(name) term.write("%(ERASE)s") term.green("All files successfully compiled.")
def run_test(example, output_file): """ Run it """ try: fp = open(example, 'r') except IOError: return else: try: input = fp.read() finally: fp.close() def load_output(filename): try: fp = open(filename, 'r') except IOError: return None else: try: output = fp.read() finally: fp.close() output = output.strip() if _re.search(r'(?<!\\)(?:\\\\)*\\[0-9a-zA-Z]{1,6}$', output): output += ' ' return output output = load_output(output_file) output_b = load_output(output_file + '.b') def do_test(cssmin, output, **options): try: genout = cssmin(input, **options) except (KeyboardInterrupt, SystemExit): raise except: return 1, "%(RED)s exc%(NORMAL)s " else: if output is None: return 1, "%(RED)smiss%(NORMAL)s " elif genout == output or genout == output.rstrip(): return 0, "%(GREEN)sOK%(NORMAL)s " else: return 1, "%(RED)sfail%(NORMAL)s " erred, out = do_test(py_cssmin, output) erred, c_out = do_test(c_cssmin, output) erred, out_b = do_test(py_cssmin, output_b, keep_bang_comments=True) erred, c_out_b = do_test(c_cssmin, output_b, keep_bang_comments=True) term.write( "%(out)s %(out_b)s | %(c_out)s %(c_out_b)s - %%(example)s\n" % locals(), example=_os.path.basename(example), ) return erred
def compile(self, name): path = shell.native(name) term.write("%(ERASE)s%(BOLD)s>>> Compiling %(name)s...%(NORMAL)s", name=name) from distutils import util try: from distutils import log except ImportError: util.byte_compile([path], verbose=0, force=True) else: log.set_verbosity(0) util.byte_compile([path], force=True)
out += "%%(RED)s%s%%(NORMAL)s " % (e.signalstr,) erred = 1 except shell.ExitError, e: out += "%%(RED)s %02d%%(NORMAL)s " % e.code erred = 1 else: if genout != output: genout = sort_attr(genout) output = sort_attr(output) if genout == output: out += "%(GREEN)sOK%(NORMAL)s " else: out += "%(RED)sfail%(NORMAL)s " erred = 1 out += "- %(script)s\n" term.write(out, script=_os.path.basename(script)) return erred # end # begin main test code erred = 0 basedir = shell.native(basedir) strip = len(basedir) - len(_os.path.basename(basedir)) for dirname, dirs, files in shell.walk(basedir): dirs[:] = [item for item in dirs if item not in ('.svn', '.git', 'out') ] dirs.sort() files = [item for item in files if item.endswith('.py')] if not files: