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:
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
logging.info("uvloop is being used")
logging.info("uvloop is in use")
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
try:

View File

@ -1,4 +1,5 @@
from setuptools import find_packages, setup, Extension
import sys
def read_file(path):
@ -6,7 +7,17 @@ def read_file(path):
return file.read()
setup(
def run_setup():
install_requirements = [
"appdirs >= 1.4.3",
"bencoder.pyx >= 1.1.3",
"humanfriendly"
]
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.",
@ -21,11 +32,7 @@ setup(
"console_scripts": ["magneticod=magneticod.__main__:main"]
},
install_requires=[
"appdirs >= 1.4.3",
"bencoder.pyx >= 1.1.3",
"humanfriendly"
],
install_requires=install_requirements,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
@ -43,5 +50,8 @@ setup(
"magneticod.bencoder._fast",
sources=["magneticod/bencoder/_fast.c"],
),
]
)
],
)
run_setup()