improved uvloop support on different platforms (minor update)

This commit is contained in:
Bora M. Alper 2017-06-06 15:33:10 +03:00
parent c96cb7de0e
commit 7fb2f19d2a
2 changed files with 48 additions and 37 deletions

View File

@ -41,9 +41,10 @@ def create_tasks():
try: try:
import uvloop import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
logging.info("uvloop is being used") logging.info("uvloop is in use")
except ImportError: except ImportError:
logging.exception("uvloop could not be imported, using the default asyncio implementation") if sys.platform not in ["linux", "darwin"]:
logging.warning("uvloop could not be imported, using the default asyncio implementation")
# noinspection PyBroadException # noinspection PyBroadException
try: try:

View File

@ -1,4 +1,5 @@
from setuptools import find_packages, setup, Extension from setuptools import find_packages, setup, Extension
import sys
def read_file(path): def read_file(path):
@ -6,42 +7,51 @@ def read_file(path):
return file.read() return file.read()
setup( def run_setup():
name="magneticod", install_requirements = [
version="0.4.0",
description="Autonomous BitTorrent DHT crawler and metadata fetcher.",
long_description=read_file("README.rst"),
url="http://magnetico.org",
author="Mert Bora ALPER",
author_email="bora@boramalper.org",
license="GNU Affero General Public License v3 or later (AGPLv3+)",
packages=find_packages(),
zip_safe=False,
entry_points={
"console_scripts": ["magneticod=magneticod.__main__:main"]
},
install_requires=[
"appdirs >= 1.4.3", "appdirs >= 1.4.3",
"bencoder.pyx >= 1.1.3", "bencoder.pyx >= 1.1.3",
"humanfriendly" "humanfriendly"
],
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
],
ext_modules=[
Extension(
"magneticod.bencoder._fast",
sources=["magneticod/bencoder/_fast.c"],
),
] ]
)
if sys.platform in ["linux", "darwin"]:
install_requirements.append("uvloop >= 0.8.0")
setup(
name="magneticod",
version="0.4.0",
description="Autonomous BitTorrent DHT crawler and metadata fetcher.",
long_description=read_file("README.rst"),
url="http://magnetico.org",
author="Mert Bora ALPER",
author_email="bora@boramalper.org",
license="GNU Affero General Public License v3 or later (AGPLv3+)",
packages=find_packages(),
zip_safe=False,
entry_points={
"console_scripts": ["magneticod=magneticod.__main__:main"]
},
install_requires=install_requirements,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Natural Language :: English",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
],
ext_modules=[
Extension(
"magneticod.bencoder._fast",
sources=["magneticod/bencoder/_fast.c"],
),
],
)
run_setup()