diff --git a/magneticod/magneticod/__main__.py b/magneticod/magneticod/__main__.py index fc8c05b..e9d758d 100644 --- a/magneticod/magneticod/__main__.py +++ b/magneticod/magneticod/__main__.py @@ -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: diff --git a/magneticod/setup.py b/magneticod/setup.py index 4c90787..4fbb055 100644 --- a/magneticod/setup.py +++ b/magneticod/setup.py @@ -1,4 +1,5 @@ from setuptools import find_packages, setup, Extension +import sys def read_file(path): @@ -6,42 +7,51 @@ def read_file(path): return file.read() -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=[ +def run_setup(): + install_requirements = [ "appdirs >= 1.4.3", "bencoder.pyx >= 1.1.3", "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()