Commit 7e0db4ab authored by Jason Madden's avatar Jason Madden

setup.py deals gracefully with spaces in the working directory. Fixes #319....

setup.py deals gracefully with spaces in the working directory. Fixes #319. Also better handle newer compilers on OS X, which enforce the distinction between CFLAGS and CPPFLAGS.
parent aa8fedf8
...@@ -16,3 +16,16 @@ doc/gevent.*.rst ...@@ -16,3 +16,16 @@ doc/gevent.*.rst
!doc/gevent.queue.rst !doc/gevent.queue.rst
!doc/gevent.pool.rst !doc/gevent.pool.rst
!doc/gevent.threadpool.rst !doc/gevent.threadpool.rst
# Artifacts of configuring in place
c-ares/config.log
c-ares/config.status
c-ares/stamp-h1
c-ares/stamp-h2
c-ares/ares_build.h.orig
libev/.deps
libev/Makefile
libev/config.log
libev/config.status
libev/libtool
libev/stamp-h1
...@@ -7,6 +7,7 @@ import re ...@@ -7,6 +7,7 @@ import re
import shutil import shutil
import traceback import traceback
from os.path import join, abspath, basename, dirname from os.path import join, abspath, basename, dirname
from subprocess import check_call
from glob import glob from glob import glob
PYPY = hasattr(sys, 'pypy_version_info') PYPY = hasattr(sys, 'pypy_version_info')
...@@ -28,6 +29,8 @@ with open('gevent/__init__.py') as _: ...@@ -28,6 +29,8 @@ with open('gevent/__init__.py') as _:
__version__ = re.search(r"__version__\s*=\s*'(.*)'", _.read(), re.M).group(1) __version__ = re.search(r"__version__\s*=\s*'(.*)'", _.read(), re.M).group(1)
assert __version__ assert __version__
def _quoted_abspath(p):
return '"' + abspath(p) + '"'
def parse_environ(key): def parse_environ(key):
value = os.environ.get(key) value = os.environ.get(key)
...@@ -55,8 +58,8 @@ CARES_EMBED = get_config_value('CARES_EMBED', 'EMBED', 'c-ares') ...@@ -55,8 +58,8 @@ CARES_EMBED = get_config_value('CARES_EMBED', 'EMBED', 'c-ares')
define_macros = [] define_macros = []
libraries = [] libraries = []
libev_configure_command = ' '.join(["/bin/sh", abspath('libev/configure'), '> configure-output.txt']) libev_configure_command = ' '.join(["(cd ", _quoted_abspath('libev/'), " && /bin/sh ./configure && mv config.h \"$OLDPWD\")", '> configure-output.txt'])
ares_configure_command = ' '.join(["/bin/sh", abspath('c-ares/configure'), 'CONFIG_COMMANDS= CONFIG_FILES= > configure-output.txt']) ares_configure_command = ' '.join(["(cd ", _quoted_abspath('c-ares/'), " && if [ -e ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi && /bin/sh ./configure CONFIG_COMMANDS= CONFIG_FILES= && cp ares_config.h ares_build.h \"$OLDPWD\" && mv ares_build.h.orig ares_build.h)", "> configure-output.txt"])
if sys.platform == 'win32': if sys.platform == 'win32':
...@@ -110,7 +113,7 @@ def make_universal_header(filename, *defines): ...@@ -110,7 +113,7 @@ def make_universal_header(filename, *defines):
def _system(cmd): def _system(cmd):
sys.stdout.write('Running %r in %s\n' % (cmd, os.getcwd())) sys.stdout.write('Running %r in %s\n' % (cmd, os.getcwd()))
return os.system(cmd) return check_call(cmd, shell=True)
def system(cmd): def system(cmd):
...@@ -174,7 +177,7 @@ if LIBEV_EMBED: ...@@ -174,7 +177,7 @@ if LIBEV_EMBED:
("EV_PERIODIC_ENABLE", '0')] ("EV_PERIODIC_ENABLE", '0')]
CORE.configure = configure_libev CORE.configure = configure_libev
if sys.platform == "darwin": if sys.platform == "darwin":
os.environ["CFLAGS"] = ("%s %s" % (os.environ.get("CFLAGS", ""), "-U__llvm__")).lstrip() os.environ["CPPFLAGS"] = ("%s %s" % (os.environ.get("CPPFLAGS", ""), "-U__llvm__")).lstrip()
if os.environ.get('GEVENTSETUP_EV_VERIFY') is not None: if os.environ.get('GEVENTSETUP_EV_VERIFY') is not None:
CORE.define_macros.append(('EV_VERIFY', os.environ['GEVENTSETUP_EV_VERIFY'])) CORE.define_macros.append(('EV_VERIFY', os.environ['GEVENTSETUP_EV_VERIFY']))
else: else:
......
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