当前位置: 首页>>代码示例>>Python>>正文


Python debug.DEBUG属性代码示例

本文整理汇总了Python中distutils.debug.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Python debug.DEBUG属性的具体用法?Python debug.DEBUG怎么用?Python debug.DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在distutils.debug的用法示例。


在下文中一共展示了debug.DEBUG属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def debug_print(self, msg):
        """Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        """
        from distutils.debug import DEBUG
        if DEBUG:
            print msg
            sys.stdout.flush()


    # -- Option validation methods -------------------------------------
    # (these are very handy in writing the 'finalize_options()' method)
    #
    # NB. the general philosophy here is to ensure that a particular option
    # value meets certain type and value constraints.  If not, we try to
    # force it into conformance (eg. if we expect a list but have a string,
    # split the string on comma and/or whitespace).  If we can't force the
    # option into conformance, raise DistutilsOptionError.  Thus, command
    # classes need do nothing more than (eg.)
    #   self.ensure_string_list('foo')
    # and they can be guaranteed that thereafter, self.foo will be
    # a list of strings. 
开发者ID:glmcdona,项目名称:meddle,代码行数:24,代码来源:cmd.py

示例2: dump_dirs

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def dump_dirs (self, msg):
        if DEBUG:
            from distutils.fancy_getopt import longopt_xlate
            print msg + ":"
            for opt in self.user_options:
                opt_name = opt[0]
                if opt_name[-1] == "=":
                    opt_name = opt_name[0:-1]
                if opt_name in self.negative_opt:
                    opt_name = string.translate(self.negative_opt[opt_name],
                                                longopt_xlate)
                    val = not getattr(self, opt_name)
                else:
                    opt_name = string.translate(opt_name, longopt_xlate)
                    val = getattr(self, opt_name)
                print "  %s: %s" % (opt_name, val) 
开发者ID:glmcdona,项目名称:meddle,代码行数:18,代码来源:install.py

示例3: test_debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def test_debug_print(self):

        class MyCCompiler(CCompiler):
            executables = {}

        compiler = MyCCompiler()
        with captured_stdout() as stdout:
            compiler.debug_print('xxx')
        stdout.seek(0)
        self.assertEqual(stdout.read(), '')

        debug.DEBUG = True
        try:
            with captured_stdout() as stdout:
                compiler.debug_print('xxx')
            stdout.seek(0)
            self.assertEqual(stdout.read(), 'xxx\n')
        finally:
            debug.DEBUG = False 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:21,代码来源:test_ccompiler.py

示例4: _spawn_os2

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawnv for OS/2 EMX requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError, exc:
            # this seems to happen when the command isn't found
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError, \
                  "command %r failed: %s" % (cmd, exc[-1])
        if rc != 0:
            # and this reflects the command running but failing
            if not DEBUG:
                cmd = executable
            log.debug("command %r failed with exit status %d" % (cmd, rc))
            raise DistutilsExecError, \
                  "command %r failed with exit status %d" % (cmd, rc) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:spawn.py

示例5: get_index_dist

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def get_index_dist(self):
        if not self.download:
            log.warn('Downloading {0!r} disabled.'.format(DIST_NAME))
            return None

        log.warn(
            "Downloading {0!r}; run setup.py with the --offline option to "
            "force offline installation.".format(DIST_NAME))

        try:
            dist = self._do_download()
        except Exception as e:
            if DEBUG:
                raise
            log.warn(
                'Failed to download and/or install {0!r} from {1!r}:\n'
                '{2}'.format(DIST_NAME, self.index_url, str(e)))
            dist = None

        # No need to run auto-upgrade here since we've already presumably
        # gotten the most up-to-date version from the package index
        return dist 
开发者ID:gbrammer,项目名称:grizli,代码行数:24,代码来源:ah_bootstrap.py

示例6: debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def debug_print(self, msg):
        """Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        """
        from distutils.debug import DEBUG
        if DEBUG:
            print(msg)
            sys.stdout.flush()


    # -- Option validation methods -------------------------------------
    # (these are very handy in writing the 'finalize_options()' method)
    #
    # NB. the general philosophy here is to ensure that a particular option
    # value meets certain type and value constraints.  If not, we try to
    # force it into conformance (eg. if we expect a list but have a string,
    # split the string on comma and/or whitespace).  If we can't force the
    # option into conformance, raise DistutilsOptionError.  Thus, command
    # classes need do nothing more than (eg.)
    #   self.ensure_string_list('foo')
    # and they can be guaranteed that thereafter, self.foo will be
    # a list of strings. 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:cmd.py

示例7: _spawn_nt

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0):
    executable = cmd[0]
    cmd = _nt_quote_args(cmd)
    if search_path:
        # either we find one or it stays the same
        executable = find_executable(executable) or executable
    log.info(' '.join([executable] + cmd[1:]))
    if not dry_run:
        # spawn for NT requires a full path to the .exe
        try:
            rc = os.spawnv(os.P_WAIT, executable, cmd)
        except OSError as exc:
            # this seems to happen when the command isn't found
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError(
                  "command %r failed: %s" % (cmd, exc.args[-1]))
        if rc != 0:
            # and this reflects the command running but failing
            if not DEBUG:
                cmd = executable
            raise DistutilsExecError(
                  "command %r failed with exit status %d" % (cmd, rc)) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:25,代码来源:spawn.py

示例8: dump_dirs

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def dump_dirs(self, msg):
        """Dumps the list of user options."""
        if not DEBUG:
            return
        from distutils.fancy_getopt import longopt_xlate
        log.debug(msg + ":")
        for opt in self.user_options:
            opt_name = opt[0]
            if opt_name[-1] == "=":
                opt_name = opt_name[0:-1]
            if opt_name in self.negative_opt:
                opt_name = self.negative_opt[opt_name]
                opt_name = opt_name.translate(longopt_xlate)
                val = not getattr(self, opt_name)
            else:
                opt_name = opt_name.translate(longopt_xlate)
                val = getattr(self, opt_name)
            log.debug("  %s: %s" % (opt_name, val)) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:install.py

示例9: debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def debug_print(self, msg):
        from distutils.debug import DEBUG
        if DEBUG:
            print msg 
开发者ID:glmcdona,项目名称:meddle,代码行数:6,代码来源:ccompiler.py

示例10: debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def debug_print(self, msg):
        """Print 'msg' to stdout if the global DEBUG (taken from the
        DISTUTILS_DEBUG environment variable) flag is true.
        """
        from distutils.debug import DEBUG
        if DEBUG:
            print msg

    # -- List-like methods --------------------------------------------- 
开发者ID:glmcdona,项目名称:meddle,代码行数:11,代码来源:filelist.py

示例11: test_debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def test_debug_print(self):
        file_list = FileList()
        with captured_stdout() as stdout:
            file_list.debug_print('xxx')
        self.assertEqual(stdout.getvalue(), '')

        debug.DEBUG = True
        try:
            with captured_stdout() as stdout:
                file_list.debug_print('xxx')
            self.assertEqual(stdout.getvalue(), 'xxx\n')
        finally:
            debug.DEBUG = False 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:15,代码来源:test_filelist.py

示例12: test_debug_print

# 需要导入模块: from distutils import debug [as 别名]
# 或者: from distutils.debug import DEBUG [as 别名]
def test_debug_print(self):
        cmd = self.cmd
        with captured_stdout() as stdout:
            cmd.debug_print('xxx')
        stdout.seek(0)
        self.assertEqual(stdout.read(), '')

        debug.DEBUG = True
        try:
            with captured_stdout() as stdout:
                cmd.debug_print('xxx')
            stdout.seek(0)
            self.assertEqual(stdout.read(), 'xxx\n')
        finally:
            debug.DEBUG = False 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:test_cmd.py


注:本文中的distutils.debug.DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。