From fab881caf43c5cb0cfa88b0d889d8e5ca94719c5 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Sun, 18 Oct 2015 17:04:24 +0200 Subject: [PATCH] appveyor CI script --- .appveyor.yml | 16 ++++++++++++++++ README.md | 3 ++- example/example10.py | 6 +++++- example/example7.py | 7 ++++++- example/run_test.py | 12 +++++++++--- 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..7b309b3d --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,16 @@ +version: 1.0.{build} +os: Visual Studio 2015 +clone_folder: C:\projects\pybind11 +branches: + only: + - master +install: + - cinstall: python +build_script: + - echo Running cmake... + - cd c:\projects\pybind11 + - cmake -G "Visual Studio 14 2015 Win64" -DPYTHON_INCLUDE_DIR:PATH=C:/Python34-x64/include -DPYTHON_LIBRARY:FILEPATH=C:/Python34-x64/libs/python34.lib -DPYTHON_EXECUTABLE:FILEPATH=C:/Python34-x64/python.exe + - set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + - set MSBuildOptions=/v:m /p:Configuration=Release /logger:%MSBuildLogger% + - msbuild %MSBuildOptions% pybind11.sln + - ctest -C "Release" diff --git a/README.md b/README.md index 08986056..46f68c28 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ # pybind11 — Seamless operability between C++11 and Python -[![Build Status](https://travis-ci.org/wjakob/pybind11.svg?branch=master)](https://travis-ci.org/wjakob/pybind11) [![Documentation Status](https://readthedocs.org/projects/pybind11/badge/?version=latest)](http://pybind11.readthedocs.org/en/latest/?badge=latest) +[![Build Status](https://travis-ci.org/wjakob/pybind11.svg?branch=master)](https://travis-ci.org/wjakob/pybind11) +[![Build status](https://ci.appveyor.com/api/projects/status/rfbxqkgxkcrxdu0f?svg=true)](https://ci.appveyor.com/project/wjakob/pybind11) **pybind11** is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. Its diff --git a/example/example10.py b/example/example10.py index 96cf9b07..4b01f81f 100755 --- a/example/example10.py +++ b/example/example10.py @@ -4,7 +4,11 @@ import sys sys.path.append('.') import example -import numpy as np +try: + import numpy as np +except ImportError: + print('NumPy missing') + exit(0) from example import vectorized_func from example import vectorized_func2 diff --git a/example/example7.py b/example/example7.py index 3bfddb03..62d33017 100755 --- a/example/example7.py +++ b/example/example7.py @@ -4,7 +4,12 @@ import sys sys.path.append('.') from example import Matrix -import numpy as np + +try: + import numpy as np +except ImportError: + print('NumPy missing') + exit(0) m = Matrix(5, 5) diff --git a/example/run_test.py b/example/run_test.py index 294d0311..fcfce142 100755 --- a/example/run_test.py +++ b/example/run_test.py @@ -25,7 +25,8 @@ def sanitize(lines): line = line.strip() if sys.platform == 'win32': lower = line.lower() - if 'constructor' in lower or 'destructor' in lower or 'ref' in lower: + if 'constructor' in lower or 'destructor' in lower \ + or 'ref' in lower: line = "" lines[i] = line @@ -40,11 +41,16 @@ if path != '': os.chdir(path) name = sys.argv[1] -output_bytes = subprocess.check_output([sys.executable, name + ".py"]) +output_bytes = subprocess.check_output([sys.executable, name + ".py"], + stderr=subprocess.STDOUT) + output = sanitize(output_bytes.decode('utf-8')) reference = sanitize(open(name + '.ref', 'r').read()) -if output == reference: +if 'NumPy missing' in output: + print('Test "%s" could not be run.' % name) + exit(0) +elif output == reference: print('Test "%s" succeeded.' % name) exit(0) else: