本文整理汇总了Python中setuptools.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python setuptools.__version__方法的具体用法?Python setuptools.__version__怎么用?Python setuptools.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools
的用法示例。
在下文中一共展示了setuptools.__version__方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: has_environment_marker_range_operators_support
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def has_environment_marker_range_operators_support():
"""Code extracted from 'pytest/setup.py'
https://github.com/pytest-dev/pytest/blob/7538680c/setup.py#L31
The first known release to support environment marker with range operators
it is 17.1, see: https://setuptools.readthedocs.io/en/latest/history.html#id113
"""
return parse_version(setuptools_version) >= parse_version('17.1')
示例2: dependencies
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def dependencies():
"""Generate the list of dependencies we care about."""
return [{'dependency': 'setuptools', 'version': setuptools.__version__}]
示例3: has_environment_marker_range_operators_support
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def has_environment_marker_range_operators_support():
"""Code extracted from 'pytest/setup.py'
https://github.com/pytest-dev/pytest/blob/7538680c/setup.py#L31
The first known release to support environment marker with range operators
it is 17.1, see: https://setuptools.readthedocs.io/en/latest/history.html#id113
"""
return parse_version(setuptools_version) >= parse_version('17.1')
示例4: main
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_install import main
return main(list(argv)+[egg]) # we're done here
finally:
if egg and os.path.exists(egg):
os.unlink(egg)
else:
if setuptools.__version__ == '0.0.1':
print((
"You have an obsolete version of setuptools installed. Please\n"
"remove it from your system entirely before rerunning this script."
), file=sys.stderr)
sys.exit(2)
req = "setuptools>="+version
import pkg_resources
try:
pkg_resources.require(req)
except pkg_resources.VersionConflict:
try:
from setuptools.command.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
else:
if argv:
from setuptools.command.easy_install import main
main(argv)
else:
print("Setuptools version",version,"or greater has been installed.")
print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')
示例5: have_environment_marker_support
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def have_environment_marker_support():
"""
Check whether setuptools has support for PEP-426 environment markers.
Based on the ``setup.py`` script of the ``pytest`` package:
https://bitbucket.org/pytest-dev/pytest/src/default/setup.py
"""
try:
from pkg_resources import parse_version
from setuptools import __version__
return parse_version(__version__) >= parse_version('0.7.2')
except Exception:
return False
示例6: main
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_install import main
return main(list(argv)+[egg]) # we're done here
finally:
if egg and os.path.exists(egg):
os.unlink(egg)
else:
if setuptools.__version__ == '0.0.1':
print >>sys.stderr, (
"You have an obsolete version of setuptools installed. Please\n"
"remove it from your system entirely before rerunning this script."
)
sys.exit(2)
req = "setuptools>="+version
import pkg_resources
try:
pkg_resources.require(req)
except pkg_resources.VersionConflict:
try:
from setuptools.command.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
else:
if argv:
from setuptools.command.easy_install import main
main(argv)
else:
print "Setuptools version",version,"or greater has been installed."
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
示例7: main
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def main():
try:
import pip
except ImportError:
raise EnvironmentError("pip installation is required")
try:
import wheel
except ImportError:
raise EnvironmentError("wheel installation is required")
try:
import packaging
except ImportError:
packaging_version = None
else:
packaging_version = packaging.__version__
try:
import setuptools
except ImportError:
setuptools_version = None
else:
setuptools_version = setuptools.__version__
env = default_environment()
env["python_executable"] = sys.executable
env["pip_version"] = pip.__version__
env["wheel_version"] = wheel.__version__
env["packaging_version"] = packaging_version
env["setuptools_version"] = setuptools_version
env = sorted(env.items())
result = json.dumps(env, indent=2)
print(result)
示例8: use_setuptools
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15
):
"""Automatically find/download setuptools and make it available on sys.path
`version` should be a valid setuptools version number that is available
as an egg for download under the `download_base` URL (which should end with
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
it is not already available. If `download_delay` is specified, it should
be the number of seconds that will be paused before initiating a download,
should one be required. If an older version of setuptools is installed,
this routine will print a message to ``sys.stderr`` and raise SystemExit in
an attempt to abort the calling script.
"""
try:
import setuptools
if setuptools.__version__ == '0.0.1':
print >>sys.stderr, (
"You have an obsolete version of setuptools installed. Please\n"
"remove it from your system entirely before rerunning this script."
)
sys.exit(2)
except ImportError:
egg = download_setuptools(version, download_base, to_dir, download_delay)
sys.path.insert(0, egg)
import setuptools; setuptools.bootstrap_install_from = egg
import pkg_resources
try:
pkg_resources.require("setuptools>="+version)
except pkg_resources.VersionConflict, e:
# XXX could we install in a subprocess here?
print >>sys.stderr, (
"The required version of setuptools (>=%s) is not available, and\n"
"can't be installed while this script is running. Please install\n"
" a more recent version first.\n\n(Currently using %r)"
) % (version, e.args[0])
sys.exit(2)
示例9: main
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_install import main
return main(list(argv)+[egg]) # we're done here
finally:
if egg and os.path.exists(egg):
os.unlink(egg)
else:
if setuptools.__version__ == '0.0.1':
# tell the user to uninstall obsolete version
use_setuptools(version)
req = "setuptools>="+version
import pkg_resources
try:
pkg_resources.require(req)
except pkg_resources.VersionConflict:
try:
from setuptools.command.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
else:
if argv:
from setuptools.command.easy_install import main
main(argv)
else:
print("Setuptools version",version,"or greater has been installed.")
print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')
示例10: have_environment_marker_support
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def have_environment_marker_support():
"""
Check whether setuptools has support for PEP-426 environment marker support.
Based on the ``setup.py`` script of the ``pytest`` package:
https://bitbucket.org/pytest-dev/pytest/src/default/setup.py
"""
try:
from pkg_resources import parse_version
from setuptools import __version__
return parse_version(__version__) >= parse_version('0.7.2')
except Exception:
return False
示例11: check_setuptools_version
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def check_setuptools_version(version):
print('Checking setuptools==%s' % version, file=sys.stderr)
if setuptools.__version__ != version:
print('Failed! setuptools==%s' % setuptools.__version__,
file=sys.stderr)
return 2
pip_list = subprocess.check_output(['pip', 'list', '--format=legacy'])
pip_list = pip_list.decode('utf8')
if 'setuptools (%s)' % version not in pip_list:
print('Failed! pip list reports wrong setuptools:\n%s' % pip_list,
file=sys.stderr)
return 3
示例12: main
# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import __version__ [as 别名]
def main(argv, version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
try:
import setuptools
except ImportError:
egg = None
try:
egg = download_setuptools(version, delay=0)
sys.path.insert(0,egg)
from setuptools.command.easy_install import main
return main(list(argv)+[egg]) # we're done here
finally:
if egg and os.path.exists(egg):
os.unlink(egg)
else:
if setuptools.__version__ == '0.0.1':
print >>sys.stderr, (
"You have an obsolete version of setuptools installed. Please\n"
"remove it from your system entirely before rerunning this script."
)
sys.exit(2)
req = "setuptools>="+version
import pkg_resources
try:
pkg_resources.require(req)
except pkg_resources.VersionConflict:
try:
from setuptools.command.easy_install import main
except ImportError:
from easy_install import main
main(list(argv)+[download_setuptools(delay=0)])
sys.exit(0) # try to force an exit
else:
if argv:
from setuptools.command.easy_install import main
main(argv)
else:
print "Setuptools version",version,"or greater has been installed."
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'