diff --git a/setup.py b/setup.py index d1191271..1fbbf1d1 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,16 @@ import sys from setuptools import setup -README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read() -CONTRIB = open(os.path.join(os.path.dirname(__file__), "CONTRIBUTING.rst")).read() -CHANGES = open(os.path.join(os.path.dirname(__file__), "CHANGES.rst")).read() -version = open(os.path.join(os.path.dirname(__file__), "VERSION.txt")).read().strip() + +def read_file(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as r: + return r.read() + + +README = read_file("README.rst") +CONTRIB = read_file("CONTRIBUTING.rst") +CHANGES = read_file("CHANGES.rst") +version = read_file("VERSION.txt").strip() needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) pytest_runner = ['pytest-runner'] if needs_pytest else [] @@ -32,7 +38,7 @@ packages=["luma.oled"], zip_safe=False, install_requires=["luma.core>=0.2.0"], - setup_requires=[] + pytest_runner, + setup_requires=pytest_runner, tests_require=["mock", "pytest", "pytest-cov", "python-coveralls"], classifiers=[ "License :: OSI Approved :: MIT License",