Commit 4a75ad7d authored by Jason Madden's avatar Jason Madden

Try to compile libuv as CFFI on PyPy/Windows.

parent fc34e2ff
......@@ -10,12 +10,11 @@ environment:
# Pre-installed Python versions, which Appveyor may upgrade to
# a later point release.
# XXX: Sadly, PyPy won't link CFFI on Win32
# - PYTHON: "C:\\pypy-4.0.1-win32"
# PYTHON_ID: "pypy"
# PYTHON_EXE: pypy
# PYTHON_VERSION: "2.7.x"
# PYTHON_ARCH: "32"
- PYTHON: "C:\\pypy2-v5.9.0-win32"
PYTHON_ID: "pypy"
PYTHON_EXE: pypy
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6.x" # currently 3.6.0
......@@ -91,14 +90,11 @@ install:
New-Item -ItemType directory -Path "$env:PYTMP" | Out-Null;
}
if ("${env:PYTHON_ID}" -eq "pypy") {
if (!(Test-Path "${env:PYTMP}\pypy-4.0.1-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy-4.0.1-win32.zip', "${env:PYTMP}\pypy-4.0.1-win32.zip");
}
7z x -y "${env:PYTMP}\pypy-4.0.1-win32.zip" -oC:\ | Out-Null;
if (!(Test-Path "${env:PYTMP}\get-pip.py")) {
(New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "${env:PYTMP}\get-pip.py");
if (!(Test-Path "${env:PYTMP}\pypy2-v5.9.0-win32.zip")) {
(New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2-5.9.0-win32.zip', "${env:PYTMP}\pypy2-v5.9.0-win32.zip");
}
& "${env:PYTHON}\pypy.exe" "${env:PYTMP}\get-pip.py";
7z x -y "${env:PYTMP}\pypy2-v5.9.0-win32.zip" -oC:\ | Out-Null;
& "${env:PYTHON}\pypy.exe" "-mensurepip";
}
elseif (-not(Test-Path($env:PYTHON))) {
......@@ -123,8 +119,7 @@ install:
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
# NOTE: psutil won't install under PyPy.
- "%CMD_IN_ENV% pip install -U wheel cython greenlet psutil"
- "%CMD_IN_ENV% pip install -U wheel cython greenlet psutil cffi"
- ps: "if(Test-Path(\"${env:PYTHON}\\bin\")) {ls ${env:PYTHON}\\bin;}"
- ps: "if(Test-Path(\"${env:PYTHON}\\Scripts\")) {ls ${env:PYTHON}\\Scripts;}"
......
......@@ -7,7 +7,7 @@ import os
from _setuputils import read
from _setuputils import read_version
from _setuputils import system
from _setuputils import PYPY, WIN, CFFI_WIN_BUILD_ANYWAY
from _setuputils import PYPY, WIN
from _setuputils import IGNORE_CFFI
from _setuputils import ConfiguringBuildExt
from _setuputils import MakeSdist
......@@ -19,15 +19,6 @@ from _setuputils import BuildFailed
from setuptools import Extension, setup
from setuptools import find_packages
if PYPY and WIN and not CFFI_WIN_BUILD_ANYWAY:
# We can't properly handle (hah!) file-descriptors and
# handle mapping on Windows/CFFI, because the file needed,
# libev_vfd.h, can't be included, linked, and used: it uses
# Python API functions, and you're not supposed to do that from
# CFFI code. Plus I could never get the libraries= line to ffi.compile()
# correct to make linking work.
raise Exception("Unable to install on PyPy/Windows")
if WIN:
# Make sure the env vars that make.cmd needs are set
if not os.environ.get('PYTHON_EXE'):
......@@ -68,12 +59,23 @@ EXT_MODULES = [
LOCAL,
]
cffi_modules = [
'src/gevent/libev/_corecffi_build.py:ffi',
]
cffi_modules = []
if not WIN:
# We can't properly handle (hah!) file-descriptors and
# handle mapping on Windows/CFFI with libev, because the file needed,
# libev_vfd.h, can't be included, linked, and used: it uses
# Python API functions, and you're not supposed to do that from
# CFFI code. Plus I could never get the libraries= line to ffi.compile()
# correct to make linking work.
cffi_modules.append(
'src/gevent/libev/_corecffi_build.py:ffi'
)
if not WIN:
EXT_MODULES.append(LIBUV)
if not WIN or PYPY:
cffi_modules.append('src/gevent/libuv/_corecffi_build.py:ffi')
if PYPY:
......
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