Skip to content

Commit 77982c3

Browse files
authored
Merge pull request #2 from pybind/master
update from pybind11 to my fork
2 parents c7c7705 + e45c211 commit 77982c3

File tree

155 files changed

+21031
-5472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+21031
-5472
lines changed

.appveyor.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
version: 1.0.{build}
2-
os: Visual Studio 2015
2+
image:
3+
- Visual Studio 2017
4+
- Visual Studio 2015
35
test: off
6+
build:
7+
parallel: true
48
platform:
5-
- x86
69
- x64
10+
- x86
711
environment:
812
matrix:
13+
- CONDA: 36
14+
CPP: 14
915
- CONDA: 27
10-
- CONDA: 35
16+
CPP: 14
17+
- CONDA: 36
18+
CPP: latest
19+
matrix:
20+
exclude:
21+
- image: Visual Studio 2015
22+
platform: x86
23+
- image: Visual Studio 2015
24+
CPP: latest
25+
- image: Visual Studio 2017
26+
CPP: latest
27+
platform: x86
1128
install:
1229
- ps: |
1330
if ($env:PLATFORM -eq "x64") { $env:CMAKE_ARCH = "x64" }
31+
if ($env:APPVEYOR_JOB_NAME -like "*Visual Studio 2017*") { $env:CMAKE_GENERATOR = "Visual Studio 15 2017" }
32+
else { $env:CMAKE_GENERATOR = "Visual Studio 14 2015" }
1433
if ($env:PYTHON) {
1534
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
1635
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
@@ -20,14 +39,21 @@ install:
2039
if ($env:CONDA -eq "27") { $env:CONDA = "" }
2140
if ($env:PLATFORM -eq "x64") { $env:CONDA = "$env:CONDA-x64" }
2241
$env:PATH = "C:\Miniconda$env:CONDA\;C:\Miniconda$env:CONDA\Scripts\;$env:PATH"
42+
$env:PYTHONHOME = "C:\Miniconda$env:CONDA"
2343
conda install -y -q pytest numpy scipy
2444
}
2545
- ps: |
26-
Start-FileDownload 'http://bitbucket.org/eigen/eigen/get/3.2.9.zip'
27-
7z x 3.2.9.zip -y > $null
28-
$env:CMAKE_INCLUDE_PATH = "eigen-eigen-dc6cfdf9bcec"
46+
Start-FileDownload 'http://bitbucket.org/eigen/eigen/get/3.3.3.zip'
47+
7z x 3.3.3.zip -y > $null
48+
$env:CMAKE_INCLUDE_PATH = "eigen-eigen-67e894c6cd8f"
2949
build_script:
30-
- cmake -A "%CMAKE_ARCH%" -DPYBIND11_WERROR=ON
50+
- cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%"
51+
-DPYBIND11_CPP_STANDARD=/std:c++%CPP%
52+
-DPYBIND11_WERROR=ON
53+
-DDOWNLOAD_CATCH=ON
54+
-DCMAKE_SUPPRESS_REGENERATION=1
3155
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
32-
- set PYTEST_ADDOPTS="-s" # workaround for pytest capture issue, see #351
3356
- cmake --build . --config Release --target pytest -- /v:m /logger:%MSBuildLogger%
57+
- cmake --build . --config Release --target cpptest -- /v:m /logger:%MSBuildLogger%
58+
- cmake --build . --config Release --target test_cmake_build -- /v:m /logger:%MSBuildLogger%
59+
on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log*

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ MANIFEST
3232
/build
3333
/cmake/
3434
.cache/
35+
sosize-*.txt
36+
pybind11Config*.cmake
37+
pybind11Targets.cmake

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
python:
2+
version: 3
3+
requirements_file: docs/requirements.txt

.travis.yml

Lines changed: 139 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,201 @@
11
language: cpp
2+
dist: trusty
23
sudo: false
34
matrix:
45
include:
56
- os: linux
67
env: PYTHON=2.7 CPP=11 GCC=4.8
78
addons:
89
apt:
9-
sources: [ubuntu-toolchain-r-test, kubuntu-backports]
10-
packages: [g++-4.8, cmake]
10+
packages: [cmake=2.\*, cmake-data=2.\*]
1111
- os: linux
12-
env: PYTHON=3.5 CPP=11 GCC=4.8
12+
env: PYTHON=3.6 CPP=11 GCC=4.8
1313
addons:
1414
apt:
15-
sources: [ubuntu-toolchain-r-test, kubuntu-backports, deadsnakes]
16-
packages: [g++-4.8, cmake, python3.5-dev]
15+
sources: [deadsnakes]
16+
packages: [python3.6-dev python3.6-venv, cmake=2.\*, cmake-data=2.\*]
1717
- sudo: true
1818
services: docker
1919
env: PYTHON=2.7 CPP=14 GCC=6
2020
- sudo: true
2121
services: docker
22-
env: PYTHON=3.5 CPP=14 GCC=6
22+
env: PYTHON=3.5 CPP=14 GCC=6 DEBUG=1
23+
- sudo: true
24+
services: docker
25+
env: PYTHON=3.5 CPP=17 GCC=7
26+
- os: linux
27+
env: PYTHON=3.6 CPP=17 CLANG=4.0
28+
addons:
29+
apt:
30+
sources: [deadsnakes, llvm-toolchain-trusty-4.0]
31+
packages: [python3.6-dev python3.6-venv clang-4.0 llvm-4.0-dev]
2332
- os: osx
2433
osx_image: xcode7.3
2534
env: PYTHON=2.7 CPP=14 CLANG
2635
- os: osx
2736
osx_image: xcode7.3
28-
env: PYTHON=3.5 CPP=14 CLANG
29-
# A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen)
30-
# and also tests the automatic discovery functions in CMake (Python version, C++ standard).
37+
env: PYTHON=3.6 CPP=14 CLANG
38+
# Test a PyPy 2.7 build
3139
- os: linux
32-
env: BAREBONES
40+
env: PYPY=5.7 PYTHON=2.7 CPP=11 GCC=4.8
3341
addons:
3442
apt:
35-
sources: [ubuntu-toolchain-r-test, kubuntu-backports]
36-
packages: [g++-4.8, cmake]
37-
install: false
43+
packages: [libblas-dev, liblapack-dev, gfortran]
44+
- sudo: true
45+
services: docker
46+
env: ARCH=i386 PYTHON=3.5 CPP=14 GCC=6
47+
# This next one does a make install *before* testing, then builds the tests against the installed version:
48+
- sudo: true
49+
services: docker
50+
env: PYTHON=3.5 CPP=14 CLANG=3.9 INSTALL=1
51+
script:
52+
- |
53+
$SCRIPT_RUN_PREFIX sh -c "set -e
54+
cmake ${CMAKE_EXTRA_ARGS} -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0
55+
make install
56+
cp -a tests /pybind11-tests
57+
mkdir /build-tests && cd /build-tests
58+
cmake ../pybind11-tests ${CMAKE_EXTRA_ARGS} -DPYBIND11_WERROR=ON
59+
make pytest -j 2"
60+
# A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen)
61+
# and also tests the automatic discovery functions in CMake (Python version, C++ standard).
62+
- os: linux
63+
env: BAREBONES PYTHON=3.5
64+
install: $PY_CMD -m pip install --user --upgrade pytest
3865
# Documentation build:
3966
- os: linux
4067
language: docs
41-
env: DOCS
42-
install: pip install sphinx sphinx_rtd_theme
43-
script: make -C docs html SPHINX_OPTIONS=-W
68+
env: DOCS STYLE LINT
69+
install:
70+
- export PATH="~/.local/bin:$PATH"
71+
- $PY_CMD -m pip install --user --upgrade sphinx sphinx_rtd_theme breathe flake8 pep8-naming
72+
- |
73+
curl -fsSL ftp://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.12.linux.bin.tar.gz | tar xz
74+
export PATH="$PWD/doxygen-1.8.12/bin:$PATH"
75+
script:
76+
- make -C docs html SPHINX_OPTIONS=-W
77+
- tools/check-style.sh
78+
- flake8
79+
allow_failures:
80+
- env: PYTHON=3.5 CPP=17 GCC=7
4481
cache:
4582
directories:
46-
- $HOME/.cache/pip
47-
- $HOME/Library/Caches/pip
83+
- $HOME/.local/bin
84+
- $HOME/.local/lib
85+
- $HOME/.local/include
86+
- $HOME/Library/Python
4887
before_install:
4988
- |
5089
# Configure build variables
5190
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
52-
if [ -z "$GCC" ]; then export GCC=4.8; fi
53-
export CXX=g++-$GCC CC=gcc-$GCC;
54-
if [ "$GCC" = "6" ]; then export DOCKER=debian:testing CXX=g++ CC=gcc; fi
91+
if [ -n "$CLANG" ]; then
92+
export CXX=clang++-$CLANG CC=clang-$CLANG
93+
COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev"
94+
else
95+
if [ -z "$GCC" ]; then GCC=4.8
96+
else COMPILER_PACKAGES=g++-$GCC
97+
fi
98+
export CXX=g++-$GCC CC=gcc-$GCC
99+
fi
100+
if [ "$GCC" = "6" ] || [ "$CLANG" = "3.9" ]; then DOCKER=${ARCH:+$ARCH/}debian:testing
101+
elif [ "$GCC" = "7" ]; then DOCKER=debian:experimental APT_GET_EXTRA="-t experimental"
102+
fi
55103
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
56104
export CXX=clang++ CC=clang;
57105
fi
58-
if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi
59-
if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
106+
if [ -n "$CPP" ]; then CPP=-std=c++$CPP; fi
107+
if [ "${PYTHON:0:1}" = "3" ]; then PY=3; fi
108+
if [ -n "$DEBUG" ]; then CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_BUILD_TYPE=Debug"; fi
60109
- |
61-
# Initialize enviornment
110+
# Initialize environment
111+
set -e
62112
if [ -n "$DOCKER" ]; then
63113
docker pull $DOCKER
64-
export containerid=$(docker run --detach --tty \
114+
115+
containerid=$(docker run --detach --tty \
65116
--volume="$PWD":/pybind11 --workdir=/pybind11 \
66117
--env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
67118
--env=GCC_COLORS=\ \
68119
$DOCKER)
69-
docker exec --tty "$containerid" apt-get update
70-
docker exec --tty "$containerid" apt-get -y upgrade
71-
export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
120+
SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
121+
$SCRIPT_RUN_PREFIX sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done'
72122
else
73-
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
74-
pip install --user --upgrade pip virtualenv
75-
virtualenv -p python$PYTHON venv
76-
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
77-
if [ "$PY" = "3" ]; then
78-
brew update; brew install python$PY;
79-
else
80-
curl -fsSL -O https://bootstrap.pypa.io/get-pip.py
81-
sudo -H python get-pip.py
123+
if [ "$PYPY" = "5.7" ]; then
124+
curl -fSL https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.7.1-linux64.tar.bz2 | tar xj
125+
PY_CMD=$(echo `pwd`/pypy2-v5.7.1-linux64/bin/pypy)
126+
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE:FILEPATH=$PY_CMD"
127+
else
128+
PY_CMD=python$PYTHON
129+
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
130+
if [ "$PY" = "3" ]; then
131+
brew update; brew install python$PY;
132+
else
133+
curl -fsSL https://bootstrap.pypa.io/get-pip.py | $PY_CMD - --user
134+
fi
82135
fi
83-
pip$PY install --user --upgrade pip virtualenv
84-
python$PY -m virtualenv venv
85136
fi
86-
source venv/bin/activate
137+
if [ "$PY" = 3 ] || [ -n "$PYPY" ]; then
138+
$PY_CMD -m ensurepip --user
139+
fi
140+
$PY_CMD -m pip install --user --upgrade pip wheel
87141
fi
142+
set +e
88143
install:
89144
- |
90145
# Install dependencies
146+
set -e
91147
if [ -n "$DOCKER" ]; then
92-
docker exec --tty "$containerid" apt-get -y --no-install-recommends install \
93-
python$PYTHON-dev python$PY-pip python$PY-setuptools python$PY-scipy \
94-
libeigen3-dev cmake make g++
148+
if [ -n "$DEBUG" ]; then
149+
PY_DEBUG="python$PY-dbg python$PY-scipy-dbg"
150+
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYTHON_EXECUTABLE=/usr/bin/python${PYTHON}dm"
151+
fi
152+
$SCRIPT_RUN_PREFIX sh -c "for s in 0 15; do sleep \$s; \
153+
apt-get -qy --no-install-recommends $APT_GET_EXTRA install \
154+
$PY_DEBUG python$PY-dev python$PY-pytest python$PY-scipy \
155+
libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done"
95156
else
96-
pip install numpy scipy
97157
98-
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.2.9.tar.gz
158+
if [ "$CLANG" = "4.0" ]; then
159+
if ! [ -d ~/.local/include/c++/v1 ]; then
160+
# Neither debian nor llvm provide a libc++ 4.0 deb; luckily it's fairly quick
161+
# to build, install (and cache), so do it ourselves:
162+
git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source
163+
git clone https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx -b release_40
164+
git clone https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi -b release_40
165+
mkdir llvm-build && cd llvm-build
166+
# Building llvm requires a newer cmake than is provided by the trusty container:
167+
CMAKE=cmake-3.8.0-Linux-x86_64
168+
curl https://cmake.org/files/v3.8/$CMAKE.tar.gz | tar xz
169+
./$CMAKE/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/.local ../llvm-source
170+
make -j2 install-cxxabi install-cxx
171+
cp -a include/c++/v1/*cxxabi*.h ~/.local/include/c++/v1
172+
cd ..
173+
fi
174+
export CXXFLAGS="-isystem $HOME/.local/include/c++/v1 -stdlib=libc++"
175+
export LDFLAGS="-L$HOME/.local/lib"
176+
export LD_LIBRARY_PATH="$HOME/.local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
177+
if [ "$CPP" = "-std=c++17" ]; then CPP="-std=c++1z"; fi
178+
fi
179+
180+
export NPY_NUM_BUILD_JOBS=2
181+
echo "Installing pytest, numpy, scipy..."
182+
${PYPY:+travis_wait 30} $PY_CMD -m pip install --user --upgrade --quiet pytest numpy scipy
183+
echo "done."
184+
185+
wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz
99186
tar xzf eigen.tar.gz
100-
export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-dc6cfdf9bcec"
187+
export CMAKE_INCLUDE_PATH="${CMAKE_INCLUDE_PATH:+:}$PWD/eigen-eigen-67e894c6cd8f"
101188
fi
189+
set +e
102190
script:
103191
- $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
104192
-DPYBIND11_PYTHON_VERSION=$PYTHON
105193
-DPYBIND11_CPP_STANDARD=$CPP
106-
-DPYBIND11_WERROR=ON
194+
-DPYBIND11_WERROR=${WERROR:-ON}
195+
-DDOWNLOAD_CATCH=ON
107196
- $SCRIPT_RUN_PREFIX make pytest -j 2
197+
- $SCRIPT_RUN_PREFIX make cpptest -j 2
198+
- $SCRIPT_RUN_PREFIX make test_cmake_build
199+
after_failure: cat tests/test_cmake_build/*.log*
108200
after_script:
109201
- if [ -n "$DOCKER" ]; then docker stop "$containerid"; docker rm "$containerid"; fi

0 commit comments

Comments
 (0)