def byte_compile(self, files): for f in files: if f.endswith('.py'): # Create temp file fh, abs_path = mkstemp() new_file = open(abs_path, 'wb') old_file = open(f, 'rUb') for line in old_file: if line[0:11] == '__version__': new_file.write("__version__ = '" + version_nr + "'" + '\n') elif line[0:12] == '__revision__': new_file.write("__revision__ = '" + revision_nr + "'" + '\n') elif line[0:8] == '__date__': new_file.write("__date__ = '" + date + "'" + '\n') else: new_file.write(line) # Close temp file new_file.close() close(fh) old_file.close() # Remove original file remove(f) # Move new file move(abs_path, f) chmod(f, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) build_py.byte_compile(self, files)
def byte_compile(self, files): for f in files: if f.endswith('.py'): # Create temp file fh, abs_path = mkstemp() new_file = open(abs_path, 'wb') old_file = open(f, 'rb') # was 'rUb' for line in old_file: if line[0:11] == b'__version__': new_file.write("__version__ = '{0}'\n".format( version_nr).encode("utf-8")) elif line[0:12] == b'__revision__': new_file.write("__revision__ = '{0}'\n".format( revision_nr).encode("utf-8")) elif line[0:8] == b'__date__': new_file.write( "__date__ = '{0}'\n".format(date).encode("utf-8")) else: new_file.write(line) # Close temp file new_file.close() close(fh) old_file.close() # Remove original file remove(f) # Move new file move(abs_path, f) chmod( f, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) build_py.byte_compile(self, files)
def byte_compile(self, files): for f in files: if f.endswith('.py'): # Create temp file fh, abs_path = mkstemp() new_file = open(abs_path, 'wb') old_file = open(f, 'rUb') for line in old_file: if line[0:11] == '__version__': new_file.write("__version__ = '" + version_nr + "'" + '\n') elif line[0:12] == '__revision__': new_file.write("__revision__ = '" + revision_nr + "'" + '\n') elif line[0:8] == '__date__': new_file.write("__date__ = '" + date + "'" + '\n') else: new_file.write(line) # Close temp file new_file.close() close(fh) old_file.close() # Remove original file remove(f) # Move new file move(abs_path, f) chmod( f, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH) build_py.byte_compile(self, files)
def byte_compile(self, files): """Byte-compile all Python modules and all Kid templates.""" build_py.byte_compile(self, files) kid_files = [f for f in files if f.endswith('.kid')] if not kid_files: return from distutils import log try: from kid.compiler import compile_file except ImportError: log.warn("Kid templates cannot be compiled," " because Kid is not installed.") return if self.dry_run: return for kid_file in kid_files: if compile_file(kid_file, force=self.force): log.info("byte-compiling %s", kid_file) else: log.debug("skipping byte-compilation of %s", kid_file)
def byte_compile(self, files): """Byte-compile all Python modules and all Kid templates.""" build_py.byte_compile(self, files) kid_files = [f for f in files if f.endswith('.kid')] if not kid_files: return from distutils import log try: from kid.compiler import compile_file except ImportError: log.warn("Kid templates cannot be compiled," " because Kid is not installed.") return if self.dry_run: return for kid_file in kid_files: if compile_file(kid_file, force=self.force): log.info("byte-compiling %s", kid_file) else: log.debug("skipping byte-compilation of %s", kid_file)
def byte_compile(self, *arg, **kwarg): self.generate_modules() _build_py.byte_compile(self, *arg, **kwarg)
def byte_compile(self, *arg, **kwarg): self.generate_modules() _build_py.byte_compile(self, *arg, **kwarg)