Explicit environ flag for importing eventlet.__version__ without ignoring import errors
Allows to read package version without installing dependencies. ``` import eventlet print(eventlet.__version__) # ok eventlet.sleep() # error ```
This commit is contained in:
parent
f52c4d31b6
commit
ca26b02d61
@ -13,7 +13,7 @@ version_next=
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
branch="${1-$(git symbolic-ref --short HEAD)}"
|
branch="${1-$(git symbolic-ref --short HEAD)}"
|
||||||
version="$(python -c 'import eventlet; print(eventlet.__version__)')"
|
version="$(EVENTLET_IMPORT_VERSION_ONLY=1 python -c 'import eventlet; print(eventlet.__version__)')"
|
||||||
printf "\nbranch: %s eventlet.__version__: '%s'\n" $branch $version >&2
|
printf "\nbranch: %s eventlet.__version__: '%s'\n" $branch $version >&2
|
||||||
if [[ "$branch" != "master" ]]; then
|
if [[ "$branch" != "master" ]]; then
|
||||||
echo "Must be on master" >&2
|
echo "Must be on master" >&2
|
||||||
@ -44,7 +44,7 @@ main() {
|
|||||||
confirm "Continue still? [yN] " || exit 1
|
confirm "Continue still? [yN] " || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if confirm "Build documentation (website)? [Yn] " >&2; then
|
if confirm "Build documentation (website)? [Yn] "; then
|
||||||
bin/build-website.bash || exit 1
|
bin/build-website.bash || exit 1
|
||||||
git checkout "$branch"
|
git checkout "$branch"
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
version_info = (0, 20, 0)
|
version_info = (0, 20, 0)
|
||||||
__version__ = '.'.join(map(str, version_info))
|
__version__ = '.'.join(map(str, version_info))
|
||||||
|
# This is to make Debian packaging easier, it ignores import
|
||||||
try:
|
# errors of greenlet so that the packager can still at least
|
||||||
|
# access the version. Also this makes easy_install a little quieter
|
||||||
|
if os.environ.get('EVENTLET_IMPORT_VERSION_ONLY') != '1':
|
||||||
from eventlet import greenthread
|
from eventlet import greenthread
|
||||||
from eventlet import greenpool
|
from eventlet import greenpool
|
||||||
from eventlet import queue
|
from eventlet import queue
|
||||||
@ -39,11 +44,3 @@ try:
|
|||||||
TimeoutError = timeout.Timeout
|
TimeoutError = timeout.Timeout
|
||||||
exc_after = greenthread.exc_after
|
exc_after = greenthread.exc_after
|
||||||
call_after_global = greenthread.call_after_global
|
call_after_global = greenthread.call_after_global
|
||||||
except ImportError as e:
|
|
||||||
# This is to make Debian packaging easier, it ignores import
|
|
||||||
# errors of greenlet so that the packager can still at least
|
|
||||||
# access the version. Also this makes easy_install a little quieter
|
|
||||||
if 'greenlet' not in str(e):
|
|
||||||
# any other exception should be printed
|
|
||||||
import traceback
|
|
||||||
traceback.print_exc()
|
|
||||||
|
29
setup.py
29
setup.py
@ -1,42 +1,47 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from setuptools import find_packages, setup
|
import os
|
||||||
from eventlet import __version__
|
import setuptools
|
||||||
from os import path
|
|
||||||
|
|
||||||
|
|
||||||
setup(
|
os.environ.setdefault('EVENTLET_IMPORT_VERSION_ONLY', '1')
|
||||||
|
import eventlet
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
name='eventlet',
|
name='eventlet',
|
||||||
version=__version__,
|
version=eventlet.__version__,
|
||||||
description='Highly concurrent networking library',
|
description='Highly concurrent networking library',
|
||||||
author='Linden Lab',
|
author='Linden Lab',
|
||||||
author_email='eventletdev@lists.secondlife.com',
|
author_email='eventletdev@lists.secondlife.com',
|
||||||
url='http://eventlet.net',
|
url='http://eventlet.net',
|
||||||
packages=find_packages(exclude=['benchmarks', 'tests', 'tests.*']),
|
packages=setuptools.find_packages(exclude=['benchmarks', 'tests', 'tests.*']),
|
||||||
install_requires=(
|
install_requires=(
|
||||||
'enum-compat',
|
'enum-compat',
|
||||||
'greenlet >= 0.3',
|
'greenlet >= 0.3',
|
||||||
),
|
),
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
long_description=open(
|
long_description=open(
|
||||||
path.join(
|
os.path.join(
|
||||||
path.dirname(__file__),
|
os.path.dirname(__file__),
|
||||||
'README.rst'
|
'README.rst'
|
||||||
)
|
)
|
||||||
).read(),
|
).read(),
|
||||||
test_suite='nose.collector',
|
test_suite='nose.collector',
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Programming Language :: Python",
|
|
||||||
"Operating System :: MacOS :: MacOS X",
|
"Operating System :: MacOS :: MacOS X",
|
||||||
"Operating System :: POSIX",
|
|
||||||
"Operating System :: Microsoft :: Windows",
|
"Operating System :: Microsoft :: Windows",
|
||||||
|
"Operating System :: POSIX",
|
||||||
|
"Programming Language :: Python :: 2",
|
||||||
"Programming Language :: Python :: 2.6",
|
"Programming Language :: Python :: 2.6",
|
||||||
"Programming Language :: Python :: 2.7",
|
"Programming Language :: Python :: 2.7",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.3",
|
"Programming Language :: Python :: 3.3",
|
||||||
"Programming Language :: Python :: 3.4",
|
"Programming Language :: Python :: 3.4",
|
||||||
|
"Programming Language :: Python :: 3.5",
|
||||||
|
"Programming Language :: Python",
|
||||||
"Topic :: Internet",
|
"Topic :: Internet",
|
||||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"Development Status :: 4 - Beta",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user