Commit Graph

64 Commits

Author SHA1 Message Date
Yannick Jadoul
c07c0c741c Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS) (#1454)
* Switching deprecated Thread Local Storage (TLS) usage in Python 3.7 to Thread Specific Storage (TSS)

* Changing Python version from 3.6 to 3.7 for Travis CI, to match brew's version of Python 3

* Introducing PYBIND11_ macros to switch between TLS and TSS API
2018-09-11 09:57:55 +02:00
Axel Huebl
0dd69e2ad1 Fix Travis GCC 7 Python 3.6.6 (#1436)
Add missing python3 distutils on Debian "buster".
2018-09-11 09:49:38 +02:00
Jason Rhinelander
fbb2ef7ea1 Miscellaneous travis-ci updates/fixes
- For the debian/buster docker build (GCC 7/C++17) install and use the
  system `catch` package; this also renames "COMPILER_PACKAGES" to
  "EXTRA_PACKAGES" since it now contains a non-compiler package.

- Add a status message indicating the catch version being used for
  compiling the embedded tests

- Simplify some bash code by using VAR+=" foo" to append (rather than
  VAR="${VAR} foo"

- Fix CMAKE_INCLUDE_PATH appending: it was prepending the ':' but not
  the existing $CMAKE_INCLUDE_PATH value and so would end up with
  ":/eigen-path" if CMAKE_INCLUDE_PATH was already set.  (This wasn't
  bug that was actually noticed since currently nothing else sets it).
2018-02-07 10:54:31 +01:00
Dean Moldovan
1caeb8d789 Fix Travis style/docs/pip build
When Travis changes their default Python 3.x, it breaks any hardcoded
version selection. Fix: make pyenv activate everything (2.7, 3.x) and
use whichever Python 3.x is on by default.

[skip appveyor]
2017-09-13 22:32:29 +02:00
Dean Moldovan
cdf38dc6ba Move the style check/barebones config up to the first position on Travis
This runs the most basic tests first and avoids waiting until the very
end for style checks.

[skip appveyor]
2017-09-08 12:13:42 +02:00
Dean Moldovan
b7c98d21e1 Speed up Travis CI build (#1056)
* Update Python 3 osx image to xcode8.3 to speed up brew install. 
  The Python 2 osx image remains xcode7.3.

* Have one osx config run in debug mode to improve coverage.

* Only run CMake build tests on two configs to speed up overall build.

  The CMake tests take ~30 seconds on each configuration, but we really 
  only need to them to run on two: one on Linux and one on macOS. This
  mirrors the recent change on AppVeyor.

* Merge the style/docs/pip tests with the barebones build.

* Merge 32-bit and CMake install configurations.

  This removes clang 3.9 from testing, but there are already 3 other clang 
  versions being tested on Travis and the new xcode8.3 image should be 
  close to clang 3.9.

[skip appveyor]
2017-09-08 10:59:50 +02:00
Dean Moldovan
1913f252d3 Fix setup.py detail headers and add pip install tests to Travis
The default `install_headers` from `distutils` flattens all the headers
into a single directory -- `detail` subdirectory was lost. This commit
fixes this by overriding the setup with a custom header installer.

Tests are added to Travis to make sure `setup.py sdist` and `pip install`
do not miss any headers and that the directory structure is preserved.

[skip appveyor]
2017-08-24 13:55:43 +02:00
Jason Rhinelander
b97510388f Change clang-4 travis-ci build to clang-5
Newer clang produces additional warnings.

[skip appveyor]
2017-08-23 12:05:18 -04:00
Dean Moldovan
8665ee8100 Fix documentation build
* Doxygen needs `RECURSIVE = YES` in order to parse the `detail` subdir.

* The `-W` warnings-as-errors option for sphinx doesn't work with the
  makefile build. Switched to calling sphinx directly.

* Fix "citation [cppimport] is not referenced" warning.
2017-08-17 15:10:51 +02:00
Dean Moldovan
7918bcc95b Add support for boost::variant in C++11 mode
In C++11 mode, `boost::apply_visitor` requires an explicit `result_type`.
This also adds optional tests for `boost::variant` in C++11/14, if boost
is available. In C++17 mode, `std::variant` is tested instead.
2017-08-12 21:27:44 +02:00
Jason Rhinelander
fd47779f40 travis-ci: Switch debian:buster build to python 3.6
buster's python3-numpy and -scipy packages now support Python 3.6.
2017-07-06 13:23:59 -04:00
Jason Rhinelander
44e9a4e6cf travis-ci: switch gcc-7 build to buster, remove from allow_failures
gcc 7 is now in debian testing ("buster"), with a proper stable upstream
release; this updates the associated travis-ci to use "buster" (rather
than "sid"), and removes the build from allow_failures.
2017-06-26 19:38:07 -04:00
Jason Rhinelander
e067c5842b Switch debian docker images to stretch
Debian stretch was just released, so `debian:testing` and
`debian:stetch` are starting to diverge; this commit keeps the travis-ci
docker image on stretch for gcc6 and clang3.9.

Debian has also moved gcc 7 from experimental to unstable, so this
switches the gcc7 build to `sid`.  Once it migrates to `testing` I'll
switch the gcc 7 build docker image to `testing` and take it out of
failure-allowed.
2017-06-20 18:15:23 -04:00
Jason Rhinelander
404bcf259d travis-ci: clang 4.0: install and use ldd-4.0
The clang 4.0/cpp17 build wasn't enabling -flto because the system
linker didn't like the output generated by clang for some reason.  This
switches the build to use llvm's lld instead, which lets -flto work
again (and links considerably faster, too).
2017-06-14 12:05:16 -04:00
Jason Rhinelander
2cc1916eaf Upgrade pypy to 5.8, use pre-built numpy/scipy wheels
numpy 1.13.0 fails with pypy 5.7.1, so this upgrades to 5.8.0.  I've
also uploaded pre-built .whl files to imaginary.ca (checked every 4
hours and rebuilt if needed), and list that as an extra pypi location
under the pypy pip install to avoid the long travis pypy build times for
a new release or branch.
2017-06-12 17:34:59 -03:00
Dean Moldovan
9693a5c78f Add Catch framework for testing embedding support and C++-side features
At this point, there is only a single test for interpreter basics.

Apart from embedding itself, having a C++ test framework will also
benefit the C++-side features by allowing them to be tested directly.
2017-05-28 02:12:24 +02:00
Jason Rhinelander
2761f78f11 travis-ci: Remove clang 4/c++17 from allow_failures
The job is using the released clang and stable-branch libc++, which
wasn't the case when it was added.  Leave the g++7/c++17 in
allow_failures for now as it's still a pre-release compiler (and pulled
from debian experimental).
2017-04-28 13:10:00 -04:00
Dean Moldovan
deb85f46ef Switch to regular breathe package on Travis
Breathe was previously installed from the git master because of a bug
in the released version. The fix has since migrated to PyPI.

[skip appveyor]
2017-04-22 23:30:33 +02:00
Jason Rhinelander
d170731f6f Remove unneeded exports
Various bash variables that are only used in the travis-ci script and
don't need to propagate (e.g. to cmake) are being pointlessly exported;
this removes these `export`s.
2017-04-18 14:21:31 -04:00
Jason Rhinelander
f0c7c00815 Switch clang-4.0 build to trusty; cache libc++
This uses the trusty container rather than docker for the clang 4.0
build.  It also caches the local libc++ installation so that it doesn't
need to be compiled every time, which should speed up the job
considerably.
2017-04-18 14:21:31 -04:00
Jason Rhinelander
3d5005168b travis-ci: switch to trusty; cache pip packages
This applies several changes to the non-docker travis-ci builds:

- Make all builds use trusty rather than precise.  pybind can't really
  build in precise anyway (we install essentially the entire toolchain
  backported from trusty on every build), and so this saves needing to
  install all the backported packages during the build setup.
- Updated the 3.5 build to 3.6 (via deadsnakes, which didn't backport
  3.6 to ubuntu releases earlier than trusty).
- As a result of the switch to trusty, the BAREBONES build now picks up
  the (default installed) python 3.5 installation.
- Invoke pip everywhere via $PYTHON -m pip rather than the pip
  executable, which saves us having to figure out what the pip
  executable is, and ensures that we are using the correct pip.
- Install packages with `pip --user` rather than in a virtualenv.
- Add the local user python package archive to the travis-ci cache
  (rather than the pip cache).  This saves needing to install packages
  during installation (unless there are updates, in which case the
  package and the cache are updated).
- Install numpy and scipy on the pypy build.  This has to build from
  source (and so blas and fortran need to be installed on the build),
  but given the above caching, the build will only be slow for the first
  build after a new numpy/scipy release.  This testing is valuable:
  numpy has various behaviour differences under pypy.
- Added set -e/+e around the before_install/install blocks so that a
  failure here (e.g. a pip install failure or dependency download
  failure) triggers a build failure.
- Update eigen version to latest (3.3.3), mainly to be consistent with
  the appveyor build.
- The travis trusty environment has an upgraded cmake, so this
  downgrades cmake (to the stock trusty version) on the first couple
  jobs so that we're still including some cmake 2.8.12 testing.
2017-04-18 14:21:31 -04:00
Jason Rhinelander
d994db2da0 Remove gcc 6/7 LTO and -Werror workarounds
The gcc versions in Debian stretch (gcc 6) and experimental (gcc 7)
incorporate the upstream gcc fixes.
2017-04-08 10:41:57 -04:00
Jason Rhinelander
ed8a461d9a Change pypy travis-ci PyPy build to 5.7 release
We no longer need a nightly build now that 5.7 is released (and the
current nightly 5.8 is failing).
2017-03-22 17:07:55 -03:00
Jason Rhinelander
28a837a07e Add failure-allowed clang-4.0/libc++-4.0 build
This adds a linux docker clang 4.0 with libc++ and c++1z build.
2017-03-10 13:04:04 -05:00
Jason Rhinelander
303ee29d9f Use trusty for travis-ci pypy build (#716)
Nightlies for pypy no longer run on Ubuntu 12.04; change the pypy build
distribution to the travis-ci trusty (i.e. 14.04) beta container.

The pypy build was also installing numpy and scipy for the *system*
python version, which was pointless; this also adds a guard to the
eigen/numpy/scipy install code with a !PYPY check.
2017-03-10 12:50:50 +01:00
Dean Moldovan
620a808ad0 Test with debug build of Python when DEBUG=1 on Travis 2017-02-28 00:27:26 +01:00
Jason Rhinelander
60d0e0db3e Independent tests (#665)
* Make tests buildable independently

This makes "tests" buildable as a separate project that uses
find_package(pybind11 CONFIG) when invoked independently.

This also moves the WERROR option into tests/CMakeLists.txt, as that's
the only place it is used.

* Use Eigen 3.3.1's cmake target, if available

This changes the eigen finding code to attempt to use Eigen's
system-installed Eigen3Config first.  In Eigen 3.3.1, it exports a cmake
Eigen3::Eigen target to get dependencies from (rather than setting the
include path directly).

If it fails, we fall back to the trying to load allowing modules (i.e.
allowing our tools/FindEigen3.cmake).  If we either fallback, or the
eigen version is older than 3.3.1 (or , we still set the include
directory manually; otherwise, for CONFIG + new Eigen, we get it via
the target.

This is also needed to allow 'tests' to be built independently, when
the find_package(Eigen3) is going to find via the system-installed
Eigen3Config.cmake.

* Add a install-then-build test, using clang on linux

This tests that `make install` to the actual system, followed by a build
of the tests (without the main pybind11 repository available) works as
expected.

To also expand the testing variety a bit, it also builds using
clang-3.9 instead of gcc.

* Don't try loading Eigen3Config in cmake < 3.0

It could FATAL_ERROR as the newer cmake includes a cmake 3.0 required
line.

If doing an independent, out-of-tree "tests" build, the regular
find_package(Eigen3) is likely to fail with the same error, but I think
we can just let that be: if you want a recent Eigen with proper cmake
loading support *and* want to do an independent tests build, you'll
need at least cmake 3.0.
2017-02-24 23:07:53 +01:00
Jason Rhinelander
ada763b9ee Temporary gcc travis-ci build fixes
Recent gcc snapshots (both gcc 7 snapshots and recent gcc 6 stable
branch snapshots) are triggering an upstream gcc bug when -flto is
enabled (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79296).  This has
been hitting the gcc-7 builds for a while now, but is going to start
hitting the debian testing builds in a few days as well.

The issue is triggered by using -flto in combination with structs or
classes declared in a function, as done in test_alias_initialization,
test_isses, test_methods_and_attributes (and possibly more).

I'm subscribed to the upstream bug, and will submit another PR to
reenable LTO once a fixed gcc is available.

The gcc-7 build also generates some warnings; just ignore them for now
(by turning off -Werror).
2017-02-14 10:59:59 +01:00
Jason Rhinelander
102c94fc38 Add i386 build (#612)
Adds a 32-bit (debian) build to travis-ci.
2017-01-31 17:10:31 +01:00
Dean Moldovan
57a9bbc6c7 Automate generation of reference docs with doxygen and breathe (#598)
* Make 'any' the default markup role for Sphinx docs

* Automate generation of reference docs with doxygen and breathe

* Improve reference docs coverage
2017-01-31 16:54:08 +01:00
Jason Rhinelander
11bc16e525 Remove allow-fails (#581)
Both are no longer needed: debian testing has Python 2.7.13 final now,
and wheels of numpy and scipy are available.
2017-01-01 15:53:00 +01:00
Yung-Yu Chen
87f893b766 Temporarily allows osx homebrew Python 3.6 to fail (#572)
* Temporarily allows osx homebrew Python 3.6 to fail.

https://github.com/pybind/pybind11/pull/570#issuecomment-269120613

"Homebrew just got Python 3.6 (brew install python3), but numpy and scipy don't have binary wheels for 3.6 yet so it's trying to compile from source and failing."
2016-12-26 11:24:30 +01:00
Dean Moldovan
b0f3885c95 Make sure add_subdirectory and find_package behave identically
Add a BUILD_INTERFACE and a pybind11::pybind11 alias for the interface
library to match the installed target.

Add new cmake tests for add_subdirectory and consolidates the
.cpp and .py files needed for the cmake build tests:

Before:
tests
|-- test_installed_module
|   |-- CMakeLists.txt
|   |-- main.cpp
|   \-- test.py
\-- test_installed_target
    |-- CMakeLists.txt
    |-- main.cpp
    \-- test.py

After:
tests
\-- test_cmake_build
    |-- installed_module/CMakeLists.txt
    |-- installed_target/CMakeLists.txt
    |-- subdirectory_module/CMakeLists.txt
    |-- subdirectory_target/CMakeLists.txt
    |-- main.cpp
    \-- test.py
2016-12-19 16:34:48 +01:00
Wenzel Jakob
1d1f81b278 WIP: PyPy support (#527)
This commit includes modifications that are needed to get pybind11 to work with PyPy. The full test suite compiles and runs except for a last few functions that are commented out (due to problems in PyPy that were reported on the PyPy bugtracker).

Two somewhat intrusive changes were needed to make it possible: two new tags ``py::buffer_protocol()`` and ``py::metaclass()`` must now be specified to the ``class_`` constructor if the class uses the buffer protocol and/or requires a metaclass (e.g. for static properties).

Note that this is only for the PyPy version based on Python 2.7 for now. When the PyPy 3.x has caught up in terms of cpyext compliance, a PyPy 3.x patch will follow.
2016-12-16 15:00:46 +01:00
Jason Rhinelander
709e648c57 Add temporary allow_failure for python 2.7/gcc 6 (#562)
Current debian testing has Python 2.7.13-RC1, which has a serious
regression (upstream https://bugs.python.org/issue5322) which should be
reverted for RC2 (or the final 2.7.13).  Ignore build failures for this
build test temporarily (with the intention of reverting this commit in a
couple of weeks once it stops failing, i.e. when debian testing picks up
an updated python 2.7 release).
2016-12-15 22:49:09 +01:00
Jason Rhinelander
a3d41d103c Add gcc-7 build from debian experimental
Add a build using g++-7 snapshot from debian experimental.  This build
is set to allow failures without triggering an overall build failure
(since this is an experimental compiler with experimental support for a
future C++ standard).
2016-12-14 20:40:49 +01:00
Lori A. Burns
eb09af5e58 test installed pybind 2016-12-13 21:44:19 +01:00
Wenzel Jakob
f8571ea1bc workaround for sphinx/docutils issue
https://github.com/sphinx-doc/sphinx/issues/3212
2016-12-11 18:51:46 +01:00
Wenzel Jakob
8fadade225 add valarray to documentation, update docutils on travis 2016-12-09 16:08:16 +01:00
Dean Moldovan
bad1740213 Add checks to maintain a consistent Python code style and prevent bugs (#515)
A flake8 configuration is included in setup.cfg and the checks are
executed automatically on Travis:

* Ensures a consistent PEP8 code style
* Does basic linting to prevent possible bugs
2016-11-20 21:21:54 +01:00
Jason Rhinelander
219b10ac99 Update travis and appveyor builds to eigen 3.3.0 (#491) 2016-11-11 16:15:38 +09:00
Jason Rhinelander
5b4968df3a Make the gcc6/python 3.5 build use debug mode 2016-09-12 16:04:31 -04:00
Jason Rhinelander
bf14cea7c7 apt-get tweaks for the debian builds
- Try to update and upgrade twice (with a brief pause between attempts)
  to deal with occassional spurious server failures or repository race
  conditions.  Do the same for the main package install.
- Use dist-upgrade instead of upgrade for updating the image
- Add -q to the upgrade and install commands to make apt less verbose.
2016-09-10 00:04:09 -04:00
Jason Rhinelander
ac4278970c Check for tabs instead of spaces in the doc build
This adds a tool that checks style (currently just for tabs instead of
spaces in files under include/tests/docs) and produces a travis-ci build
failure if any problems are found.
2016-08-28 14:11:23 -04:00
Jason Rhinelander
dd3d56a885 Don't install pytest from cmake, just fail instead
Installing something outside the project directory from a cmake
invocation is overly intrusive; this changes tests/CMakeLists.txt to
just fail with an informative message instead, and changes the
travis-ci builds to install pytest via pip or apt-get.
2016-08-26 17:22:48 -04:00
Dean Moldovan
14bd10d6d6 Fix Travis cache config: remove ccache, add OS X pip cache
ccache on Travis was never configured properly so the setting never
actually did anything. Enabling ccache for real brings other issues:
due to the way the preprocessor is handled, some of the Python header
macros produce bogus compiler warnings (which in turn produce errors
with -Werror). ccache also requires additional configuration on OS X
and docker. It would reduce compile time by ~30 seconds at best, so
it's not worth the trouble.

[skip appveyor]
2016-08-26 11:53:25 +02:00
Dean Moldovan
b62a896f31 Add barebones build to Travis CI
This build makes sure everything still works without optional
dependencies (numpy/scipy/eigen) and also tests the automatic
discovery functions in CMake (Python version, C++ standard).

[skip appveyor]
2016-08-26 11:41:27 +02:00
Dean Moldovan
18319d5598 Automatically install pytest from CMake
Pytest is a development dependency but we can make it painless by
automating the install using CMake.
2016-08-19 13:32:01 +02:00
Dean Moldovan
a0c1ccf0a9 Port tests to pytest
Use simple asserts and pytest's powerful introspection to make testing
simpler. This merges the old .py/.ref file pairs into simple .py files
where the expected values are right next to the code being tested.

This commit does not touch the C++ part of the code and replicates the
Python tests exactly like the old .ref-file-based approach.
2016-08-19 13:19:38 +02:00
Jason Rhinelander
0b952cdf28 pip/venv in before_install; override install for docs build
Rather than adding an `if [ -n "$DOCS" ]` as a separate install
instruction, this simplifies the travis-ci logic to do the pip/venv
setup in the `before_install` hook, leaving the install hook to just
install the needed packages.

This makes the default install script simpler: it doesn't need to check
NATIVE_DEPS or DOCS because both of those now override `install`
anyway, so the top-level `install` is really just the install for the
gcc-4.8 and osx builds; the docker builds and docs build override
install completely.
2016-08-17 14:19:08 -04:00