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


Python distutils.version方法代码示例

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


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

示例1: sanity_check_dependencies

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def sanity_check_dependencies():
    import numpy
    import requests
    import six

    if distutils.version.LooseVersion(numpy.__version__) < distutils.version.LooseVersion('1.10.4'):
        logger.warn("You have 'numpy' version %s installed, but 'gym' requires at least 1.10.4. HINT: upgrade via 'pip install -U numpy'.", numpy.__version__)

    if distutils.version.LooseVersion(requests.__version__) < distutils.version.LooseVersion('2.0'):
        logger.warn("You have 'requests' version %s installed, but 'gym' requires at least 2.0. HINT: upgrade via 'pip install -U requests'.", requests.__version__)

# We automatically configure a logger with a simple stderr handler. If
# you'd rather customize logging yourself, run undo_logger_setup.
#
# (Note: this needs to happen before importing the rest of gym, since
# we may print a warning at load time.) 
开发者ID:ppaquette,项目名称:gym-pull,代码行数:18,代码来源:__init__.py

示例2: split_provision

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def split_provision(value):
    """Return the name and optional version number of a provision.

    The version number, if given, will be returned as a `StrictVersion`
    instance, otherwise it will be `None`.

    >>> split_provision('mypkg')
    ('mypkg', None)
    >>> split_provision(' mypkg( 1.2 ) ')
    ('mypkg', StrictVersion ('1.2'))
    """
    global _provision_rx
    if _provision_rx is None:
        _provision_rx = re.compile(
            "([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$")
    value = value.strip()
    m = _provision_rx.match(value)
    if not m:
        raise ValueError("illegal provides specification: %r" % value)
    ver = m.group(2) or None
    if ver:
        ver = distutils.version.StrictVersion(ver)
    return m.group(1), ver 
开发者ID:glmcdona,项目名称:meddle,代码行数:25,代码来源:versionpredicate.py

示例3: get_traces

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def get_traces(self, channel_ids=None, start_frame=None, end_frame=None):
        with NWBHDF5IO(self._path, 'r') as io:
            nwbfile = io.read()
            es = nwbfile.acquisition[self._electrical_series_name]
            es_channel_ids = np.array(es.electrodes.table.id[:])[es.electrodes.data[:]].tolist()
            table_ids = [es_channel_ids.index(id) for id in channel_ids]
            if np.array(channel_ids).size > 1 and np.any(np.diff(channel_ids) < 0):
                sorted_idx = np.argsort(table_ids)
                recordings = es.data[start_frame:end_frame, np.sort(table_ids)].T
                traces = recordings[sorted_idx, :]
            else:
                traces = es.data[start_frame:end_frame, table_ids].T
            # This DatasetView and lazy operations will only work within context
            # We're keeping the non-lazy version for now
            # es_view = DatasetView(es.data)  # es is an instantiated h5py dataset
            # traces = es_view.lazy_slice[start_frame:end_frame, channel_ids].lazy_transpose()
        return traces 
开发者ID:SpikeInterface,项目名称:spikeextractors,代码行数:19,代码来源:nwbextractors.py

示例4: checkdep_ghostscript

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def checkdep_ghostscript():
    if sys.platform == 'win32':
        gs_execs = ['gswin32c', 'gswin64c', 'gs']
    else:
        gs_execs = ['gs']
    for gs_exec in gs_execs:
        try:
            s = subprocess.Popen(
                [gs_exec, '--version'], stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            if s.returncode == 0:
                v = byte2str(stdout[:-1])
                return gs_exec, v
        except (IndexError, ValueError, OSError):
            pass
    return None, None 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:__init__.py

示例5: _check_tridesclous_version

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def _check_tridesclous_version(self):
        folder_version= self.info.get('tridesclous_version', 'unknown')
        
        if folder_version is 'unknown':
            w = True
        else:
            v1 = distutils.version.LooseVersion(tridesclous_version).version
            v2 = distutils.version.LooseVersion(self.info['tridesclous_version']).version
            if (v1[0] == v2[0]) and (v1[1] == v2[1]):
                w = False
            else:
                w = True

        if w:
            txt = 'This folder was created with an old tridesclous version ({})\n'\
                    'The actual version is {}\n'\
                    'You may have bug in internal structure.'
            print(txt.format(folder_version, tridesclous_version)) 
开发者ID:tridesclous,项目名称:tridesclous,代码行数:20,代码来源:dataio.py

示例6: checkdep_ghostscript

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def checkdep_ghostscript():
    if sys.platform == 'win32':
        gs_execs = ['gswin32c', 'gswin64c', 'gs']
    else:
        gs_execs = ['gs']
    for gs_exec in gs_execs:
        try:
            s = subprocess.Popen(
                [gs_exec, '--version'], stdout=subprocess.PIPE,
                stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            if s.returncode == 0:
                v = stdout[:-1].decode('ascii')
                return gs_exec, v
        except (IndexError, ValueError, OSError):
            pass
    return None, None 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:__init__.py

示例7: dvipng_hack_alpha

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def dvipng_hack_alpha():
    try:
        p = Popen(['dvipng', '-version'], stdin=PIPE, stdout=PIPE,
                  stderr=STDOUT, close_fds=(sys.platform != 'win32'))
        stdout, stderr = p.communicate()
    except OSError:
        mpl.verbose.report('No dvipng was found', 'helpful')
        return False
    lines = stdout.decode('ascii').split('\n')
    for line in lines:
        if line.startswith('dvipng '):
            version = line.split()[-1]
            mpl.verbose.report('Found dvipng version %s' % version,
                               'helpful')
            version = distutils.version.LooseVersion(version)
            return version < distutils.version.LooseVersion('1.6')
    mpl.verbose.report('Unexpected response from dvipng -version', 'helpful')
    return False 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:20,代码来源:texmanager.py

示例8: compare_versions

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def compare_versions(a, b):
    "return True if a is greater than or equal to b"
    if isinstance(a, bytes):
        cbook.warn_deprecated(
            "3.0", "compare_version arguments should be strs.")
        a = a.decode('ascii')
    if isinstance(b, bytes):
        cbook.warn_deprecated(
            "3.0", "compare_version arguments should be strs.")
        b = b.decode('ascii')
    if a:
        a = distutils.version.LooseVersion(a)
        b = distutils.version.LooseVersion(b)
        return a >= b
    else:
        return False 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:__init__.py

示例9: checkdep_ghostscript

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def checkdep_ghostscript():
    if checkdep_ghostscript.executable is None:
        if sys.platform == 'win32':
            # mgs is the name in miktex
            gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs']
        else:
            gs_execs = ['gs']
        for gs_exec in gs_execs:
            try:
                s = subprocess.Popen(
                    [gs_exec, '--version'], stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE)
                stdout, stderr = s.communicate()
                if s.returncode == 0:
                    v = stdout[:-1].decode('ascii')
                    checkdep_ghostscript.executable = gs_exec
                    checkdep_ghostscript.version = v
            except (IndexError, ValueError, OSError):
                pass
    return checkdep_ghostscript.executable, checkdep_ghostscript.version 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:22,代码来源:__init__.py

示例10: checkdep_inkscape

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def checkdep_inkscape():
    if checkdep_inkscape.version is None:
        try:
            s = subprocess.Popen(['inkscape', '-V'],
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
            stdout, stderr = s.communicate()
            lines = stdout.decode('ascii').split('\n')
            for line in lines:
                if 'Inkscape' in line:
                    v = line.split()[1]
                    break
            checkdep_inkscape.version = v
        except (IndexError, ValueError, UnboundLocalError, OSError):
            pass
    return checkdep_inkscape.version 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:__init__.py

示例11: __getitem__

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def __getitem__(self, key):
        if key in _deprecated_map:
            version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
            cbook.warn_deprecated(
                version, key, obj_type="rcparam", alternative=alt_key)
            return inverse_alt(dict.__getitem__(self, alt_key))

        elif key in _deprecated_ignore_map:
            version, alt_key = _deprecated_ignore_map[key]
            cbook.warn_deprecated(
                version, key, obj_type="rcparam", alternative=alt_key)
            return dict.__getitem__(self, alt_key) if alt_key else None

        elif key == 'examples.directory':
            cbook.warn_deprecated(
                "3.0", "{} is deprecated; in the future, examples will be "
                "found relative to the 'datapath' directory.".format(key))

        elif key == "backend":
            val = dict.__getitem__(self, key)
            if val is rcsetup._auto_backend_sentinel:
                from matplotlib import pyplot as plt
                plt.switch_backend(rcsetup._auto_backend_sentinel)

        return dict.__getitem__(self, key) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:27,代码来源:__init__.py

示例12: setUp

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def setUp(self):
        freetype = distutils.version.StrictVersion(ImageFont.core.freetype2_version)

        self.metrics = self.METRICS['Default']
        for conditions, metrics in self.METRICS.items():
            if not isinstance(conditions, tuple):
                continue

            for condition in conditions:
                version = re.sub('[<=>]', '', condition)
                if (condition.startswith('>=') and freetype >= version) or \
                   (condition.startswith('<') and freetype < version):
                    # Condition was met
                    continue

                # Condition failed
                break
            else:
                # All conditions were met
                self.metrics = metrics 
开发者ID:holzschu,项目名称:python3_ios,代码行数:22,代码来源:test_imagefont.py

示例13: GetJavaVersion

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def GetJavaVersion():
  """Returns the string for the current version of Java installed."""
  proc = subprocess.Popen(['java', '-version'], stderr=subprocess.PIPE)
  proc.wait()
  version_line = proc.stderr.read().splitlines()[0]
  return version_regex.search(version_line).group() 
开发者ID:elsigh,项目名称:browserscope,代码行数:8,代码来源:calcdeps.py

示例14: _GetJavaVersion

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def _GetJavaVersion():
  """Returns the string for the current version of Java installed."""
  proc = subprocess.Popen(['java', '-version'], stderr=subprocess.PIPE)
  unused_stdoutdata, stderrdata = proc.communicate()
  version_line = stderrdata.splitlines()[0]
  return _VERSION_REGEX.search(version_line).group(1) 
开发者ID:elsigh,项目名称:browserscope,代码行数:8,代码来源:jscompiler.py

示例15: Compile

# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import version [as 别名]
def Compile(compiler_jar_path, source_paths, flags=None):
  """Prepares command-line call to Closure Compiler.

  Args:
    compiler_jar_path: Path to the Closure compiler .jar file.
    source_paths: Source paths to build, in order.
    flags: A list of additional flags to pass on to Closure Compiler.

  Returns:
    The compiled source, as a string, or None if compilation failed.
  """

  # User friendly version check.
  if not (distutils.version.LooseVersion(_GetJavaVersion()) >=
          distutils.version.LooseVersion('1.6')):
    logging.error('Closure Compiler requires Java 1.6 or higher. '
                  'Please visit http://www.java.com/getjava')
    return

  args = ['java', '-jar', compiler_jar_path]
  for path in source_paths:
    args += ['--js', path]

  if flags:
    args += flags

  logging.info('Compiling with the following command: %s', ' '.join(args))

  proc = subprocess.Popen(args, stdout=subprocess.PIPE)
  stdoutdata, unused_stderrdata = proc.communicate()

  if proc.returncode != 0:
    return

  return stdoutdata 
开发者ID:elsigh,项目名称:browserscope,代码行数:37,代码来源:jscompiler.py


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