Skip to content

Commit

Permalink
fix: Backport build fixes to 0.7, test compilation on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
riddell-stan committed Oct 17, 2019
1 parent 9173c48 commit 80fcfc0
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 26 deletions.
40 changes: 40 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
os: Visual Studio 2015
platform: x64
environment:
global:
MINICONDA: "C:\\Miniconda36-x64"
matrix:
- PYTHON_VERSION: 3.7

install:
- set PATH=%MINICONDA%;%MINICONDA%\Scripts;%PATH%
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -q -n test-env python=%PYTHON_VERSION%
- activate test-env
- conda install numpy cython scipy matplotlib pandas setuptools libpython m2w64-toolchain -c msys2 -q
- gcc --version
- mingw32-make --version
# Install the build dependencies of the project.
- pip install -q -r requirements.txt
- pip install -q -r test-requirements.txt

- ECHO "Starting to build the wheel"
# generate required cpp files
- mingw32-make
# build the wheel and install it
- python setup.py --quiet bdist_wheel
- ps: "ls dist"

- ECHO "Install generated wheel to test it"
# Install the generated wheel package to test it
- pip install -q --pre --no-index --find-links dist/ httpstan

# Not a .NET project, we build pystan in the install step instead
build: false

test_script:
- mkdir empty_folder
- cd empty_folder
- python -c "import httpstan"
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dist: xenial
dist: bionic
language: python
python: 3.6
# NOTE: when `language: python` is set, using `compiler: clang` or
# `compiler: gcc` does nothing. These only work when `language: cpp`.
matrix:
include:
- python: 3.6
Expand All @@ -13,13 +14,10 @@ matrix:
- env: TOXENV=coverage
before_install:
- python --version
- if [[ -n $CC ]]; then $CC --version; fi
install:
- pip install cython
- pip install tox
- pip install coveralls
before_script:
- pip install grpcio-tools
- make cython protos
- pip install cython tox coveralls grpcio-tools
- make # generate required C++ files
script:
- travis_wait 60 tox
after_success:
Expand Down
15 changes: 8 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
PYTHON ?= python
CYTHON ?= cython
PROTOBUF_FILES := httpstan/callbacks_writer_pb2.py
CPP_FILES := httpstan/stan.cpp httpstan/compile.cpp

default: protos cython
default: $(PROTOBUF_FILES) $(CPP_FILES)

%.cpp: %.pyx
$(CYTHON) -3 --cplus $<

cython: httpstan/stan.cpp httpstan/compile.cpp

openapi: doc/source/openapi.json
httpstan/%_pb2.py: protos/%.proto
$(PYTHON) -m grpc_tools.protoc -Iprotos --python_out=httpstan $<

protos: httpstan/callbacks_writer_pb2.py
httpstan/%_pb.hpp: protos/%.proto
$(PYTHON) -m grpc_tools.protoc -Iprotos --cpp_out=httpstan $<

httpstan/%_pb2.py: protos/%.proto
python3 -m grpc_tools.protoc -Iprotos --python_out=httpstan $<
openapi: doc/source/openapi.json

doc/source/openapi.json: httpstan/routes.py httpstan/views.py
@echo writing OpenAPI spec to $@
Expand Down
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ A working copy of ``protoc`` is needed to build from source. One way to get this

::

$ make cython # generate C++ code from Cython .pyx files
$ make protos # generate Python modules for protocol buffer schemas
$ make # generate required C++ code
$ python3 setup.py install

Usage
Expand Down
3 changes: 1 addition & 2 deletions doc/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ A working copy of ``protoc`` is needed to build from source. An easy way to inst

::

$ make cython # generate C++ code from Cython .pyx files
$ make protos # generate Python modules for protocol buffer schemas
$ make # generate required C++ code
$ python3 setup.py install
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.

pbr<5,>=4.0 # Apache-2.0
pbr<6,>=5 # Apache-2.0
aiohttp<4,>=3.2.1
appdirs<2,>=1.4.3
webargs<6,>=5
Expand Down
10 changes: 6 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ include_dirs =
language = c++
extra_compile_args =
-O3
-std=c++11
-std=c++1y
# MinGW fix, https://github.com/python/cpython/pull/11283
-D_hypot=hypot

[extension=httpstan.compile]
sources =
Expand All @@ -50,9 +52,7 @@ sources =
httpstan/lib/stan/src/stan/lang/grammars/whitespace_grammar_inst.cpp
define_macros =
BOOST_DISABLE_ASSERTS
BOOST_NO_DECLTYPE
BOOST_PHOENIX_NO_VARIADIC_EXPRESSION
BOOST_RESULT_OF_USE_TR1
include_dirs =
httpstan
httpstan/lib/stan/src
Expand All @@ -63,7 +63,9 @@ include_dirs =
language = c++
extra_compile_args =
-O3
-std=c++11
-std=c++1y
# MinGW fix, https://github.com/python/cpython/pull/11283
-D_hypot=hypot

[build_sphinx]
all-files = 1
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
flake8<4,>=3.3
flake8-bugbear<19,>=18.2.0

pytest<4,>=3.0.7
pytest-cov<3,>=2.6
pytest<6,>=5
pytest-cov<3,>=2.7
sphinx<2,>=1.7 # BSD

# type checking
Expand Down

0 comments on commit 80fcfc0

Please sign in to comment.