From 76614f7122f413f49d1e3171e865a8a24c7e8646 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 21 Oct 2017 12:51:20 -0700 Subject: [PATCH] Clean up ResourceWarning in setup.py Always explicitly close files. Use a context manager to make this easier. Fixes ResourceWarning when Python has warnings enabled. --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 79b7ce12..cfa8ae89 100644 --- a/setup.py +++ b/setup.py @@ -28,12 +28,17 @@ sys.exit() +def readall(path): + with open(path) as fp: + return fp.read() + + setup( name=APP_NAME, version=VERSION, description='OAuthlib authentication support for Requests.', - long_description=open('README.rst').read() + '\n\n' + - open('HISTORY.rst').read(), + long_description=readall('README.rst') + '\n\n' + + readall('HISTORY.rst'), author='Kenneth Reitz', author_email='me@kennethreitz.com', url='https://github.com/requests/requests-oauthlib',