當前位置: 首頁>>代碼示例>>Python>>正文


Python util.byte_compile方法代碼示例

本文整理匯總了Python中distutils.util.byte_compile方法的典型用法代碼示例。如果您正苦於以下問題:Python util.byte_compile方法的具體用法?Python util.byte_compile怎麽用?Python util.byte_compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在distutils.util的用法示例。


在下文中一共展示了util.byte_compile方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: unpack_and_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def unpack_and_compile(self, egg_path, destination):
        to_compile = []
        to_chmod = []

        def pf(src, dst):
            if dst.endswith('.py') and not src.startswith('EGG-INFO/'):
                to_compile.append(dst)
            elif dst.endswith('.dll') or dst.endswith('.so'):
                to_chmod.append(dst)
            self.unpack_progress(src, dst)
            return not self.dry_run and dst or None

        unpack_archive(egg_path, destination, pf)
        self.byte_compile(to_compile)
        if not self.dry_run:
            for f in to_chmod:
                mode = ((os.stat(f)[stat.ST_MODE]) | 0o555) & 0o7755
                chmod(f, mode) 
開發者ID:jpush,項目名稱:jbox,代碼行數:20,代碼來源:easy_install.py

示例2: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, to_compile):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile

        try:
            # try to make the byte compile messages quieter
            log.set_verbosity(self.verbose - 1)

            byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run)
            if self.optimize:
                byte_compile(
                    to_compile, optimize=self.optimize, force=1,
                    dry_run=self.dry_run
                )
        finally:
            log.set_verbosity(self.verbose)  # restore original verbosity 
開發者ID:jpush,項目名稱:jbox,代碼行數:21,代碼來源:easy_install.py

示例3: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, to_compile):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile

        try:
            # try to make the byte compile messages quieter
            log.set_verbosity(self.verbose - 1)

            byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run)
            if self.optimize:
                byte_compile(
                    to_compile, optimize=self.optimize, force=1,
                    dry_run=self.dry_run,
                )
        finally:
            log.set_verbosity(self.verbose)  # restore original verbosity 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:21,代碼來源:easy_install.py

示例4: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, files):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile
        prefix = self.build_lib
        if prefix[-1] != os.sep:
            prefix = prefix + os.sep

        # XXX this code is essentially the same as the 'byte_compile()
        # method of the "install_lib" command, except for the determination
        # of the 'prefix' string.  Hmmm.

        if self.compile:
            byte_compile(files, optimize=0,
                         force=self.force, prefix=prefix, dry_run=self.dry_run)
        if self.optimize > 0:
            byte_compile(files, optimize=self.optimize,
                         force=self.force, prefix=prefix, dry_run=self.dry_run) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:22,代碼來源:build_py.py

示例5: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, files):
        if sys.dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile

        # Get the "--root" directory supplied to the "install" command,
        # and use it as a prefix to strip off the purported filename
        # encoded in bytecode files.  This is far from complete, but it
        # should at least generate usable bytecode in RPM distributions.
        install_root = self.get_finalized_command('install').root

        if self.compile:
            byte_compile(files, optimize=0,
                         force=self.force, prefix=install_root,
                         dry_run=self.dry_run)
        if self.optimize > 0:
            byte_compile(files, optimize=self.optimize,
                         force=self.force, prefix=install_root,
                         verbose=self.verbose, dry_run=self.dry_run)


    # -- Utility methods ----------------------------------------------- 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:26,代碼來源:install_lib.py

示例6: unpack_and_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def unpack_and_compile(self, egg_path, destination):
        to_compile = []
        to_chmod = []

        def pf(src, dst):
            if dst.endswith('.py') and not src.startswith('EGG-INFO/'):
                to_compile.append(dst)
            elif dst.endswith('.dll') or dst.endswith('.so'):
                to_chmod.append(dst)
            self.unpack_progress(src,dst)
            return not self.dry_run and dst or None

        unpack_archive(egg_path, destination, pf)
        self.byte_compile(to_compile)
        if not self.dry_run:
            for f in to_chmod:
                mode = ((os.stat(f)[stat.ST_MODE]) | 0o555) & 0o7755
                chmod(f, mode) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:20,代碼來源:easy_install.py

示例7: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, to_compile):
        if _dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile
        try:
            # try to make the byte compile messages quieter
            log.set_verbosity(self.verbose - 1)

            byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run)
            if self.optimize:
                byte_compile(
                    to_compile, optimize=self.optimize, force=1,
                    dry_run=self.dry_run
                )
        finally:
            log.set_verbosity(self.verbose)     # restore original verbosity 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:20,代碼來源:easy_install.py

示例8: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, to_compile):
        if sys.dont_write_bytecode:
            return

        from distutils.util import byte_compile

        try:
            # try to make the byte compile messages quieter
            log.set_verbosity(self.verbose - 1)

            byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run)
            if self.optimize:
                byte_compile(
                    to_compile, optimize=self.optimize, force=1,
                    dry_run=self.dry_run,
                )
        finally:
            log.set_verbosity(self.verbose)  # restore original verbosity 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:20,代碼來源:easy_install.py

示例9: byte_compile

# 需要導入模塊: from distutils import util [as 別名]
# 或者: from distutils.util import byte_compile [as 別名]
def byte_compile(self, to_compile):
        if _dont_write_bytecode:
            self.warn('byte-compiling is disabled, skipping.')
            return

        from distutils.util import byte_compile

        try:
            # try to make the byte compile messages quieter
            log.set_verbosity(self.verbose - 1)

            byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run)
            if self.optimize:
                byte_compile(
                    to_compile, optimize=self.optimize, force=1,
                    dry_run=self.dry_run
                )
        finally:
            log.set_verbosity(self.verbose)  # restore original verbosity 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:21,代碼來源:easy_install.py


注:本文中的distutils.util.byte_compile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。