Commit 5f540971 authored by Jason Madden's avatar Jason Madden

Note that Python 2.5 support has been dropped. Add version and implementation...

Note that Python 2.5 support has been dropped. Add version and implementation classifiers to setup.py; make setup.py PyPy/Py3 friendly and not leak open files. [skip ci]
parent 833f8d13
......@@ -9,6 +9,8 @@ Unreleased
- Add support for Python 3.3 and 3.4.
- Add support for PyPy.
- Drop support for Python 2.5. Python 2.5 users can continue to use
gevent 1.0.x.
- Fix gevent.greenlet.joinall to not ignore ``count`` when
``raise_error`` is False. PR #512 by Ivan Diao.
- Fix subprocess.Popen to not ignore the ``bufsize`` argument. Note
......
......@@ -24,7 +24,8 @@ from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatfo
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError)
__version__ = re.search("__version__\s*=\s*'(.*)'", open('gevent/__init__.py').read(), re.M).group(1)
with open('gevent/__init__.py') as _:
__version__ = re.search(r"__version__\s*=\s*'(.*)'", _.read(), re.M).group(1)
assert __version__
......@@ -90,21 +91,21 @@ ARES.optional = True
def make_universal_header(filename, *defines):
defines = [('#define %s ' % define, define) for define in defines]
lines = open(filename, 'r').read().split('\n')
with open(filename, 'r') as f:
lines = f.read().split('\n')
ifdef = 0
f = open(filename, 'w')
for line in lines:
if line.startswith('#ifdef'):
ifdef += 1
elif line.startswith('#endif'):
ifdef -= 1
elif not ifdef:
for prefix, define in defines:
if line.startswith(prefix):
line = '#ifdef __LP64__\n#define %s 8\n#else\n#define %s 4\n#endif' % (define, define)
break
print(line, file=f)
f.close()
with open(filename, 'w') as f:
for line in lines:
if line.startswith('#ifdef'):
ifdef += 1
elif line.startswith('#endif'):
ifdef -= 1
elif not ifdef:
for prefix, define in defines:
if line.startswith(prefix):
line = '#ifdef __LP64__\n#define %s 8\n#else\n#define %s 4\n#endif' % (define, define)
break
print(line, file=f)
def _system(cmd):
......@@ -280,7 +281,8 @@ class BuildFailed(Exception):
def read(name, *args):
try:
return open(join(dirname(__file__), name)).read(*args)
with open(join(dirname(__file__), name)) as f:
return f.read(*args)
except OSError:
return ''
......@@ -336,6 +338,10 @@ def run_setup(ext_modules, run_make):
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment