Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

setup: Fix resource warnings on Python 3 install

  • Loading branch information...
commit 090dca61da471c47a2a9c46e61d6615c917a2e79 1 parent 0404871
@jodal jodal authored
Showing with 10 additions and 4 deletions.
  1. +7 −2 setup.py
  2. +3 −2 spotify/__init__.py
View
9 setup.py
@@ -6,8 +6,13 @@
from setuptools import setup, find_packages
+def read_file(filename):
+ with open(filename) as fh:
+ return fh.read()
+
+
def get_version(filename):
- init_py = open(filename).read()
+ init_py = read_file(filename)
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", init_py))
return metadata['version']
@@ -31,7 +36,7 @@ def finalize_options(self):
author='Stein Magnus Jodal',
author_email='stein.magnus@jodal.no',
description='Python wrapper for libspotify',
- long_description=open('README.rst').read(),
+ long_description=read_file('README.rst'),
packages=find_packages(exclude=['tests', 'tests.*']),
ext_package='spotify',
zip_safe=False,
View
5 spotify/__init__.py
@@ -75,8 +75,9 @@ def _build_ffi():
'pyspotify requires cffi >= 0.7, but found %s' % cffi.__version__)
header_file = os.path.join(os.path.dirname(__file__), 'api.processed.h')
- header = open(header_file).read()
- header += '#define SPOTIFY_API_VERSION ...\n'
+ with open(header_file) as fh:
+ header = fh.read()
+ header += '#define SPOTIFY_API_VERSION ...\n'
ffi = cffi.FFI()
ffi.cdef(header)
Please sign in to comment.
Something went wrong with that request. Please try again.