Skip to content

Commit

Permalink
Merge pull request #19 from Mindwerks/pybindings
Browse files Browse the repository at this point in the history
Pybindings
  • Loading branch information
ftomassetti committed May 6, 2015
2 parents e9eb95e + 8d15449 commit 6ce7e02
Show file tree
Hide file tree
Showing 38 changed files with 4,883 additions and 46 deletions.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,43 @@ Makefile
cmake_install.cmake

*.swp
venv

*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

MANIFEST
10 changes: 10 additions & 0 deletions .pypirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[distutils] # this tells distutils what package indexes you can push to
index-servers =
pypi
pypitest

[pypi] # authentication details for live PyPI
repository: https://pypi.python.org/pypi

[pypitest] # authentication details for test PyPI
repository: https://testpypi.python.org/pypi
36 changes: 17 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@ language: cpp
compiler:
- gcc
- clang
env:
- TARGET=cpp
- PYVERSION=2.6.9
- PYVERSION=2.7.8
- PYVERSION=3.2.6
- PYVERSION=3.3.6
- PYVERSION=3.4.3

before_install:
- echo "yes" | sudo add-apt-repository ppa:kalakris/cmake
# contains mostly new versions of gcc
- echo "yes" | sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
# this one contains python 2.6.9
- if [ "$PYVERSION" = "2.6.9" ]; then sudo add-apt-repository ppa:fkrull/deadsnakes -y ; fi
- sudo apt-get update -qq
- sudo apt-get install -qq
- sudo apt-get install cmake
# g++4.8.1
- if [ "$CXX" == "g++" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi

# clang 3.4
- if [ "$CXX" == "clang++" ]; then sudo add-apt-repository -y ppa:h-rayflood/llvm; fi

- sudo apt-get update -qq

install:
# g++4.8.1
- if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90; fi
- if [ "$CXX" = "g++" ]; then sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90; fi
- if [ "$CXX" = "g++" ]; then sudo apt-get install libstdc++-4.8-dev; fi
- echo "== Install step =="

# clang 3.4
- if [ "$CXX" == "clang++" ]; then sudo apt-get install --allow-unauthenticated -qq clang-3.4; fi
- if [ "$CXX" == "clang++" ]; then export CXX="clang++-3.4"; fi
script:
- if [ "$TARGET" = "cpp" ]; then sh travis/build_cpp.sh ; fi
- if [ ! "$TARGET" = "cpp" ]; then cd pybindings ; fi
- if [ ! "$TARGET" = "cpp" ] && [ "$PYVERSION" = "2.6.9" ]; then source ../travis/prepare_py26.sh ; fi
- if [ ! "$TARGET" = "cpp" ] && [ ! "$PYVERSION" = "2.6.9" ]; then source ../travis/prepare_py.sh ; fi
- if [ ! "$TARGET" = "cpp" ]; then sh ../travis/build_python.sh ; fi

script: $CXX --version && cmake . -G 'Unix Makefiles' && make && cd test && make && ./PlateTectonicsTests
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GNU LESSER GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Expand Down Expand Up @@ -163,4 +164,3 @@ whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include LICENSE README.md
recursive-include platec_src *
recursive-include plate-tectonics/src *
72 changes: 49 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plate-tectonics
Plate-tectonics
===============
Travis
[![Build Status](https://travis-ci.org/Mindwerks/plate-tectonics.svg?branch=master)](https://travis-ci.org/Mindweks/plate-tectonics)
Expand All @@ -7,6 +7,7 @@ AppVeyor


This is a library to simulate plate tectonics.
It is written in C++ and it has Python bindings (as part of this project), as well as Haskell bindings ([hplatec](http://github.com/ftomassetti/hplatec))

How it looks like
=================
Expand All @@ -19,8 +20,8 @@ The library offers an API to generate heightmaps and some other data about the w

You can see a video of simulation based on an old version of this library: http://www.youtube.com/watch?v=bi4b45tMEPE#t=0

How to build plate-tectonics
============================
How to build plate-tectonics (C++)
==================================

We use [CMake](http://www.cmake.org/). Install it and then run the folowing commands

Expand Down Expand Up @@ -74,8 +75,8 @@ To compile on other platforms please run:
cmake --help
```

Running the examples
====================
Running the examples (C++)
==========================

To run also the examples you need to install the library libpng.

Expand All @@ -88,8 +89,8 @@ cd examples
./simulation_rect
```

How to run tests
================
How to run tests (C++)
======================

To run tests you need to install DevIL

Expand All @@ -103,33 +104,58 @@ make

Currently the test coverage is still poor (but improving!_, tests are present only for new code and tiny portion of the old code that were refactored.

Original project
Python bindings
===============

Supported versions:
* Python 2.6 (currently not supported on AppVeyor)
* Python 2.7
* Python 3.2 (currently not supported on AppVeyor)
* Python 3.3
* Python 3.4

Compile (Python)
================

A fork of platec http://sourceforge.net/projects/platec/ .
That project is part of a Bachelor of Engineering thesis in Metropolia University of Applied Sciences, Helsinki, Finland. The thesis is freely downloadable from http://urn.fi/URN:NBN:fi:amk-201204023993 .
```
python setup.py build
```

Kudos to the original author: Lauri Viitanen!
Usage (Python)
==============

License
=======
The library is quite simple:

This work is (as the original work) released under the GNU LGPL.
p = platec.create(seed=3)
while platec.is_finished(p)==0:
platec.step(p)
hm = platec.get_heightmap(p)
platec.destroy(p)

Goals
=====

* Improve the quality of the code and add some tests
* Support Google protocol buffer
Or if you want more control:

Bindings
========
p = platec.create(seed=3, width=1000, height=800,
sea_level=0.65,erosion_period=60,
folding_ratio=0.02,aggr_overlap_abs=1000000,
aggr_overlap_rel=0.33,cycle_count=2,num_plates=10)

We are working on these bindings:
* Python [pyplatec](http://github.com/Mindwerks/pyplatec)
* Haskell [hplatec](http://github.com/ftomassetti/hplatec)
Plans for the future
====================

* Improve the quality of the code and add some tests
* Support Google protocol buffer

Projects using plate-tectonics
==============================

[WorldEngine](http://github.com/Mindwerks/worldengine), a world generator

Original project
================

A fork of platec http://sourceforge.net/projects/platec/ .
That project is part of a Bachelor of Engineering thesis in Metropolia University of Applied Sciences, Helsinki, Finland. The thesis is freely downloadable from http://urn.fi/URN:NBN:fi:amk-201204023993 .

Kudos to the original author: Lauri Viitanen!

91 changes: 88 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,101 @@
# Taken from: https://packaging.python.org/en/latest/appveyor.html
# and from: https://bitbucket.org/pygame/pygame/pull-request/45/create-python-wheel-builds-using-appveyor/diff
# For now considering only Python 2.7, looking to support soon Python 2.6
# and Python 3 in the future

environment:

USER:
secure: "yIZtG6whEjp28VvgoZPYNQ=="
PASS:
secure: "jcpXn6j1XHh/N2v0Y5geLQ=="

global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
WITH_COMPILER_FROM_PY: "cmd /E:ON /V:ON /C ..\\appveyor\\run_with_compiler.cmd"

matrix:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "32"
DISTRIBUTIONS: "sdist bdist_wheel"

- PYTHON: "C:\\Python33"
PYTHON_VERSION: "3.3.5"
PYTHON_ARCH: "32"
DISTRIBUTIONS: "bdist_wheel"

- PYTHON: "C:\\Python34"
PYTHON_VERSION: "3.4.1"
PYTHON_ARCH: "32"
DISTRIBUTIONS: "bdist_wheel"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.8"
PYTHON_ARCH: "64"
WINDOWS_SDK_VERSION: "v7.0"
DISTRIBUTIONS: "sdist bdist_wheel"

- PYTHON: "C:\\Python33-x64"
PYTHON_VERSION: "3.3.5"
PYTHON_ARCH: "64"
WINDOWS_SDK_VERSION: "v7.1"
DISTRIBUTIONS: "bdist_wheel"

- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.1"
PYTHON_ARCH: "64"
WINDOWS_SDK_VERSION: "v7.1"
DISTRIBUTIONS: "bdist_wheel"

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"

install:
# Python
- "powershell appveyor\\install.ps1"
- "set HOME=%APPVEYOR_BUILD_FOLDER%"
- "%WITH_COMPILER% %PYTHON%/python -m pip install -r pybindings/dev-requirements.txt"
# C++
- ps: wget https://s3.amazonaws.com/biibinaries/thirdparty/cmake-3.0.2-win32-x86.zip -OutFile cmake.zip
- cmd: echo "Unzipping cmake..."
- cmd: 7z x cmake.zip -o"C:\Program Files (x86)\" -y > nul
- cmd: set PATH="CMake 2.8\bin";%PATH%;"C:\Program Files (x86)\cmake-3.0.2-win32-x86\bin"
- cmd: 7z x cmake.zip -o"%CD%" -y > nul
- cmd: SET PATH=%CD%\bin;%PATH%

build: off
build: off

test_script:
# C++
- cmd: cmake .
- cmd: cmake --build .
- cmd: cd test
- cmd: dir
- cmd: cd Debug
- cmd: dir
- cmd: "PlateTectonicsTests.exe"
- cmd: "PlateTectonicsTests.exe"
- cmd: cd ../../pybindings
- cmd: dir
- cmd: echo %PYTHON%/python
# Python
- cmd: echo "WC= " %WITH_COMPILER_FROM_PY%
- cmd: SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
- cmd: echo "PATH" %PATH%
- dir
- dir %PYTHON%
- dir ..\\appveyor\\run_with_compiler.cmd
- "%WITH_COMPILER_FROM_PY% %PYTHON%/python.exe setup.py test"

after_test:
- "%WITH_COMPILER_FROM_PY% %PYTHON%/python.exe setup.py %DISTRIBUTIONS%"

artifacts:
- path: pybindings\dist\*

#on_success:
# - "%WITH_COMPILER% %PYTHON%/python -m pip install twine"
# - "%PYTHON%/Scripts/twine upload -u %USER% -p %PASS% -r pypitest dist/*"

Loading

0 comments on commit 6ce7e02

Please sign in to comment.