summaryrefslogtreecommitdiff
path: root/cffi/ffiplatform.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-07-16 09:44:51 +0200
committerArmin Rigo <arigo@tunes.org>2012-07-16 09:44:51 +0200
commitb4c18220aeb739cb4798cd1d8da1e435906d016d (patch)
tree9e8efeccb054d15bac27207be78a0059d18f9a36 /cffi/ffiplatform.py
parent41f4889769926a1a83e036f4ef748c42ad9c5695 (diff)
downloadcffi-b4c18220aeb739cb4798cd1d8da1e435906d016d.tar.gz
Fixes. It's a bit hacking-until-it-works, but well, it seems to work :-/
Diffstat (limited to 'cffi/ffiplatform.py')
-rw-r--r--cffi/ffiplatform.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py
index b158322..9d77ca4 100644
--- a/cffi/ffiplatform.py
+++ b/cffi/ffiplatform.py
@@ -18,6 +18,15 @@ def get_extension(srcfilename, modname, **kwds):
def compile(tmpdir, ext):
"""Compile a C extension module using distutils."""
+ # Turn the 'ext.sources' into absolute paths, because we're going to
+ # do chdir(). In the common case where the path is precisely where
+ # we're going to chdir(), then replace it with a pathless copy.
+ for i, src in enumerate(ext.sources):
+ src = os.path.abspath(src)
+ if os.path.samefile(os.path.dirname(src), tmpdir):
+ src = os.path.basename(src)
+ ext.sources[i] = src
+
saved_environ = os.environ.copy()
saved_path = os.getcwd()
try: