Skip to content

Commit 5348387

Browse files
authored
Merge pull request #1 from msis/setuppy
Errors are due to python2/3 testing craziness with `nonlocal`
2 parents 300a0b9 + fe1f490 commit 5348387

158 files changed

Lines changed: 24983 additions & 463 deletions

File tree

Some content is hidden

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

.appveyor.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: devel-{build}
2+
3+
os: Visual Studio 2015
4+
5+
platform:
6+
- x64
7+
- x86
8+
9+
environment:
10+
matrix:
11+
- PYTHON: 27
12+
- PYTHON: 36
13+
- CONDA: 27
14+
- CONDA: 35
15+
16+
shallow_clone: true
17+
18+
install:
19+
- ps: |
20+
if ($env:PLATFORM -eq "x64") { $env:CMAKE_ARCH = "x64" }
21+
if ($env:PYTHON) {
22+
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
23+
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
24+
pip install --disable-pip-version-check --user --upgrade pip setuptools
25+
} elseif ($env:CONDA) {
26+
if ($env:CONDA -eq "27") { $env:CONDA = "" }
27+
if ($env:PLATFORM -eq "x64") { $env:CONDA = "$env:CONDA-x64" }
28+
$env:PATH = "C:\Miniconda$env:CONDA\;C:\Miniconda$env:CONDA\Scripts\;$env:PATH"
29+
conda config --set always_yes yes --set changeps1 no
30+
conda config --add channels conda-forge
31+
conda update -q conda
32+
conda install -q conda-build
33+
}
34+
- if "%platform%" == "x64" SET VS_FULL=Visual Studio 14 2015 Win64
35+
- if "%platform%" == "x86" SET VS_FULL=Visual Studio 14 2015
36+
- cd ..
37+
- git clone -b wOnlineCI --depth=1 https://github.com/msis/core-moos
38+
- cd core-moos
39+
- mkdir build
40+
- cd build
41+
- cmake -G "%VS_FULL%" -DENABLE_EXPORT=ON -DUSE_ASYNC_COMMS=ON -DCMAKE_BUILD_TYPE=Release ../
42+
- cmake --build . --config Release
43+
- cmake --build . --config Release --target install
44+
45+
build_script:
46+
- cd %APPVEYOR_BUILD_FOLDER%
47+
- ps: |
48+
if ($env:PYTHON) {
49+
python setup.py sdist
50+
pip install --verbose dist\pymoos-0.0.1.tar.gz
51+
} else {
52+
conda build conda.recipe
53+
conda install --use-local pymoos
54+
}
55+
56+
test_script:
57+
- ps: |
58+
cd tests
59+
python run_close.py
60+
python simple_comms.py
61+
python register.py
62+
python callbacks.py

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/.DS_Store
22
/build
3+
__pycache__
4+
*.pyc
5+
*.egg-info
6+
dist

.travis.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
language: cpp
2+
3+
matrix:
4+
include:
5+
- os: linux
6+
env: PYTHON=2.7
7+
- os: linux
8+
env: PYTHON=3.5
9+
- os: linux
10+
env: CONDA=2.7
11+
- os: linux
12+
env: CONDA=3.6
13+
- os: osx
14+
env: PYTHON=2.7
15+
- os: osx
16+
env: PYTHON=3.6
17+
- os: osx
18+
env: CONDA=2.7
19+
- os: osx
20+
env: CONDA=3.6
21+
22+
dist: trusty
23+
24+
addons:
25+
apt:
26+
sources:
27+
- ubuntu-toolchain-r-test
28+
- deadsnakes
29+
- kubuntu-backports
30+
packages:
31+
- g++-4.8
32+
- python3.5
33+
- python3.5-dev
34+
- cmake
35+
36+
before_install:
37+
- if [ "`uname`" != "Darwin" ] ; then export MOOS_CXX_FLAGS="-fPIC -Wno-long-long"; fi
38+
- if [ "`uname`" != "Darwin" ] ; then export CXX="g++-4.8"; fi
39+
- cd ..
40+
- git clone -b wOnlineCI --depth=1 https://github.com/msis/core-moos
41+
- cd core-moos
42+
- mkdir build
43+
- cd build
44+
- cmake -DENABLE_EXPORT=ON -DUSE_ASYNC_COMMS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=$MOOS_CXX_FLAGS ..
45+
- cmake --build . --config Release --config -j4
46+
- sudo cmake --build . --config Release --target install
47+
- cd $TRAVIS_BUILD_DIR
48+
- |
49+
if [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX=g++-4.8 CC=gcc-4.8; fi
50+
if [ -n "$PYTHON" ]; then
51+
if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "${PYTHON:0:1}" = "3" ]; then
52+
brew update; brew install python3;
53+
fi
54+
pip install --user --upgrade pip virtualenv
55+
virtualenv -p python$PYTHON venv
56+
source venv/bin/activate
57+
elif [ -n "$CONDA" ]; then
58+
if [ "$TRAVIS_OS_NAME" = "linux" ]; then OS=Linux-x86_64; else OS=MacOSX-x86_64; fi
59+
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda${CONDA:0:1}-latest-$OS.sh
60+
bash miniconda.sh -b -p $HOME/miniconda
61+
export PATH="$HOME/miniconda/bin:$PATH"
62+
conda config --set always_yes yes --set changeps1 no
63+
conda config --add channels conda-forge
64+
conda update -q conda
65+
conda install -q conda-build
66+
conda create -q -n test-environment python=$CONDA
67+
source activate test-environment
68+
fi
69+
70+
install:
71+
- |
72+
if [ -n "$PYTHON" ]; then
73+
python setup.py sdist
74+
pip install --verbose dist/*.tar.gz
75+
elif [ -n "$CONDA" ]; then
76+
conda build conda.recipe
77+
conda install --use-local pymoos
78+
fi
79+
80+
script:
81+
- python tests/test.py

CMakeLists.txt

Lines changed: 6 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,9 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 2.8.12)
22
project (python-moos)
3-
find_package(MOOS 10 REQUIRED)
4-
5-
find_package(PythonLibs)
6-
if(PYTHONLIBS_FOUND)
7-
include_directories("${PYTHON_INCLUDE_DIRS}")
8-
else()
9-
message(FATAL_ERROR "Unable to find PythonLibs.")
10-
endif()
11-
12-
find_package(Boost REQUIRED python)
13-
set(Boost_USE_STATIC_LIBS ON)
14-
set(Boost_USE_MULTITHREADED ON)
15-
set(Boost_USE_STATIC_RUNTIME ON)
16-
17-
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
18-
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
19-
endif()
20-
21-
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
22-
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
23-
endif()
24-
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
25-
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
26-
endif()
27-
28-
29-
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${Boost_INCLUDE_DIRS} ${MOOS_INCLUDE_DIRS})
30-
31-
set(src
32-
pyMOOS.cpp
33-
)
34-
35-
add_library(pymoos SHARED ${src})
36-
37-
set_target_properties( pymoos
38-
PROPERTIES
39-
SUFFIX ".so"
40-
)
41-
42-
set_target_properties(pymoos
43-
PROPERTIES
44-
PREFIX "")
45-
46-
47-
file(GLOB ExampleFiles ${CMAKE_SOURCE_DIR}/Documentation/examples/*.py)
48-
add_custom_target(copy)
49-
get_target_property(pymoosLocation pymoos LOCATION)
50-
get_filename_component(pymoosDir ${pymoosLocation} PATH)
51-
foreach(ExampleFile ${ExampleFiles})
52-
add_custom_command(TARGET copy PRE_BUILD
53-
COMMAND ${CMAKE_COMMAND} -E
54-
copy ${ExampleFile} ${pymoosDir})
55-
endforeach()
56-
add_dependencies(pymoos copy)
573

4+
find_package(MOOS 10 REQUIRED)
585

59-
TARGET_LINK_LIBRARIES(pymoos ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${MOOS_LIBRARIES})
6+
add_subdirectory(pybind11)
7+
pybind11_add_module(pymoos src/pyMOOS.cpp)
8+
include_directories(${MOOS_INCLUDE_DIRS})
9+
target_link_libraries(pymoos PRIVATE ${MOOS_LIBRARIES})

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.md LICENSE
2+
global-include CMakeLists.txt *.cmake
3+
recursive-include src *
4+
recursive-include pybind11/include *.h

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
python-moos
22
===========
3+
python bindings for [MOOS](https://github.com/themoos/core-moos)
34

4-
python bindings for MOOS
5+
# Build Statuses
6+
|OS |Build Status|
7+
|:--------|-----------:|
8+
|Linux/OSX|[![Build Status](https://travis-ci.org/msis/python-moos.svg)](https://travis-ci.org/msis/python-moos)|
9+
|Windows |[![Build status](https://ci.appveyor.com/api/projects/status/ad0jwpij0xhikh5f?svg=true)](https://ci.appveyor.com/project/msis/python-moos)|
10+
11+
# Build Instructions
12+
(TODO, for now please refer to the `.travis.yml` file for Linux/OSX and `appveyor.yml` file for Windows.)

conda.recipe/bld.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"%PYTHON%" setup.py install
2+
if errorlevel 1 exit 1

conda.recipe/build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
unset MACOSX_DEPLOYMENT_TARGET
3+
${PYTHON} setup.py install;

conda.recipe/meta.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package:
2+
name: pymoos
3+
version: {{ environ.get('GIT_DESCRIBE_TAG', 'dev') }}
4+
5+
build:
6+
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
7+
{% if environ.get('GIT_DESCRIBE_NUMBER', '0') == '0' %}string: py{{ environ.get('PY_VER').replace('.', '') }}_0
8+
{% else %}string: py{{ environ.get('PY_VER').replace('.', '') }}_{{ environ.get('GIT_BUILD_STR', 'GIT_STUB') }}{% endif %}
9+
script_env:
10+
- CC
11+
- CXX
12+
13+
source:
14+
git_url: ../
15+
16+
requirements:
17+
build:
18+
- python
19+
- setuptools
20+
- pybind11
21+
- cmake
22+
23+
run:
24+
- python
25+
- vs2015_runtime # [win]
26+
27+
test:
28+
imports:
29+
- pymoos
30+
31+
about:
32+
summary: An example project built with pybind11.
33+
license_file: LICENSE

0 commit comments

Comments
 (0)