Skip to content

Commit

Permalink
setup.py deals gracefully with spaces in the working directory. Fixes g…
Browse files Browse the repository at this point in the history
…event#319. Also better handle newer compilers on OS X, which enforce the distinction between CFLAGS and CPPFLAGS.
  • Loading branch information
jamadden committed Jul 9, 2015
1 parent aa8fedf commit 7e0db4a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ doc/gevent.*.rst
!doc/gevent.queue.rst
!doc/gevent.pool.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
11 changes: 7 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shutil
import traceback
from os.path import join, abspath, basename, dirname
from subprocess import check_call
from glob import glob

PYPY = hasattr(sys, 'pypy_version_info')
Expand All @@ -28,6 +29,8 @@
__version__ = re.search(r"__version__\s*=\s*'(.*)'", _.read(), re.M).group(1)
assert __version__

def _quoted_abspath(p):
return '"' + abspath(p) + '"'

def parse_environ(key):
value = os.environ.get(key)
Expand Down Expand Up @@ -55,8 +58,8 @@ def get_config_value(key, defkey, path):

define_macros = []
libraries = []
libev_configure_command = ' '.join(["/bin/sh", abspath('libev/configure'), '> configure-output.txt'])
ares_configure_command = ' '.join(["/bin/sh", abspath('c-ares/configure'), 'CONFIG_COMMANDS= CONFIG_FILES= > 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(["(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':
Expand Down Expand Up @@ -110,7 +113,7 @@ def make_universal_header(filename, *defines):

def _system(cmd):
sys.stdout.write('Running %r in %s\n' % (cmd, os.getcwd()))
return os.system(cmd)
return check_call(cmd, shell=True)


def system(cmd):
Expand Down Expand Up @@ -174,7 +177,7 @@ def configure_ares(bext, ext):
("EV_PERIODIC_ENABLE", '0')]
CORE.configure = configure_libev
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:
CORE.define_macros.append(('EV_VERIFY', os.environ['GEVENTSETUP_EV_VERIFY']))
else:
Expand Down

0 comments on commit 7e0db4a

Please sign in to comment.