From 148d41c7a7994956bc7fba05b4a5cdb35a1a6887 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Fri, 22 Jul 2016 13:30:52 -0400 Subject: [PATCH] Move python wrapper to contrib/python-bindings. --- CMakeLists.txt | 2 ++ .../include}/cell_accessor_wrapper.h | 0 .../python-bindings/include}/point_wrapper.h | 0 .../include}/triangulation_wrapper.h | 2 +- .../python-bindings/source}/CMakeLists.txt | 18 +++++++----- .../python-bindings/source}/__init__.py | 3 +- .../source}/cell_accessor_wrapper.cc | 6 ++-- .../source}/export_cell_accessor.cc | 4 +-- .../python-bindings/source}/export_point.cc | 4 +-- .../source}/export_triangulation.cc | 4 +-- .../python-bindings/source}/point_wrapper.cc | 2 +- .../source}/triangulation_wrapper.cc | 4 +-- .../python-bindings/source}/wrappers.cc | 0 .../tests}/cell_accessor_wrapper.py | 0 .../python-bindings/tests}/point_wrapper.py | 0 .../tests}/triangulation_wrapper.py | 0 source/CMakeLists.txt | 3 -- source/python/dummy.py | 29 ------------------- 18 files changed, 26 insertions(+), 55 deletions(-) rename {include/deal.II/python => contrib/python-bindings/include}/cell_accessor_wrapper.h (100%) rename {include/deal.II/python => contrib/python-bindings/include}/point_wrapper.h (100%) rename {include/deal.II/python => contrib/python-bindings/include}/triangulation_wrapper.h (99%) rename {source/python => contrib/python-bindings/source}/CMakeLists.txt (90%) rename {source/python => contrib/python-bindings/source}/__init__.py (92%) rename {source/python => contrib/python-bindings/source}/cell_accessor_wrapper.cc (99%) rename {source/python => contrib/python-bindings/source}/export_cell_accessor.cc (97%) rename {source/python => contrib/python-bindings/source}/export_point.cc (96%) rename {source/python => contrib/python-bindings/source}/export_triangulation.cc (98%) rename {source/python => contrib/python-bindings/source}/point_wrapper.cc (98%) rename {source/python => contrib/python-bindings/source}/triangulation_wrapper.cc (99%) rename {source/python => contrib/python-bindings/source}/wrappers.cc (100%) rename {tests/python => contrib/python-bindings/tests}/cell_accessor_wrapper.py (100%) rename {tests/python => contrib/python-bindings/tests}/point_wrapper.py (100%) rename {tests/python => contrib/python-bindings/tests}/triangulation_wrapper.py (100%) delete mode 100644 source/python/dummy.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 478691aa15..fb2debfca6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,8 @@ ADD_SUBDIRECTORY(source) # has to be included after bundled ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(examples) +ADD_SUBDIRECTORY(contrib/python-bindings/source) + IF(DEAL_II_HAVE_TESTS_DIRECTORY) ADD_SUBDIRECTORY(tests) ENDIF() diff --git a/include/deal.II/python/cell_accessor_wrapper.h b/contrib/python-bindings/include/cell_accessor_wrapper.h similarity index 100% rename from include/deal.II/python/cell_accessor_wrapper.h rename to contrib/python-bindings/include/cell_accessor_wrapper.h diff --git a/include/deal.II/python/point_wrapper.h b/contrib/python-bindings/include/point_wrapper.h similarity index 100% rename from include/deal.II/python/point_wrapper.h rename to contrib/python-bindings/include/point_wrapper.h diff --git a/include/deal.II/python/triangulation_wrapper.h b/contrib/python-bindings/include/triangulation_wrapper.h similarity index 99% rename from include/deal.II/python/triangulation_wrapper.h rename to contrib/python-bindings/include/triangulation_wrapper.h index 29a35545b0..13b7367b9a 100644 --- a/include/deal.II/python/triangulation_wrapper.h +++ b/contrib/python-bindings/include/triangulation_wrapper.h @@ -16,8 +16,8 @@ #ifndef dealii__triangulation_wrapper_h #define dealii__triangulation_wrapper_h +#include #include -#include #include #include diff --git a/source/python/CMakeLists.txt b/contrib/python-bindings/source/CMakeLists.txt similarity index 90% rename from source/python/CMakeLists.txt rename to contrib/python-bindings/source/CMakeLists.txt index 9955bd01b6..b490eee0cc 100644 --- a/source/python/CMakeLists.txt +++ b/contrib/python-bindings/source/CMakeLists.txt @@ -17,6 +17,13 @@ FIND_LIBRARY(Boost_PYTHON_LIBRARY boost_python PATH ${Boost_LIBRARY_DIRS} NO_DEF INCLUDE(FindPythonLibs) INCLUDE(FindPythonInterp) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) +INCLUDE_DIRECTORIES( + ${CMAKE_BINARY_DIR}/include/ + ${CMAKE_SOURCE_DIR}/include/ + ${DEAL_II_BUNDLED_INCLUDE_DIRS} + ${DEAL_II_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/contrib/python-bindings/include/ + ) INCLUDE_DIRECTORIES(SYSTEM ${PYTHON_INCLUDE_DIRS}) SET(_src @@ -29,11 +36,6 @@ SET(_src triangulation_wrapper.cc ) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/python/*.h - ) - - PYTHON_ADD_MODULE(PyDealII ${_src}) SET(PYTHON_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) @@ -50,14 +52,14 @@ INSTALL(TARGETS PyDealII DESTINATION ${PYTHON_INSTALL_PREFIX}/pydealii) SET(PYTHON_SOURCES __init__.py - dummy.py ) + FOREACH(PYTHON_SOURCE ${PYTHON_SOURCES}) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_BINARY_DIR}/python/pydealii/${PYTHON_SOURCE} - DEPENDS ${CMAKE_SOURCE_DIR}/source/python/${PYTHON_SOURCE} + DEPENDS ${CMAKE_SOURCE_DIR}/contrib/python-bindings/source/${PYTHON_SOURCE} COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${CMAKE_SOURCE_DIR}/source/python/${PYTHON_SOURCE} ${CMAKE_BINARY_DIR}/python/pydealii/${PYTHON_SOURCE} + ARGS -E copy ${CMAKE_SOURCE_DIR}/contrib/python-bindings/source/${PYTHON_SOURCE} ${CMAKE_BINARY_DIR}/python/pydealii/${PYTHON_SOURCE} COMMENT "Copying ${PYTHON_SOURCE}" ) ADD_CUSTOM_TARGET( diff --git a/source/python/__init__.py b/contrib/python-bindings/source/__init__.py similarity index 92% rename from source/python/__init__.py rename to contrib/python-bindings/source/__init__.py index f6326327e0..dd99d5fdbd 100644 --- a/source/python/__init__.py +++ b/contrib/python-bindings/source/__init__.py @@ -14,7 +14,6 @@ # --------------------------------------------------------------------- from .PyDealII import * -from .dummy import * -__all__ = ['PyDealII', 'dummy'] +__all__ = ['PyDealII'] __doc__ = PyDealII.__doc__ diff --git a/source/python/cell_accessor_wrapper.cc b/contrib/python-bindings/source/cell_accessor_wrapper.cc similarity index 99% rename from source/python/cell_accessor_wrapper.cc rename to contrib/python-bindings/source/cell_accessor_wrapper.cc index 1b17a91f0b..fc3ba9bf54 100644 --- a/source/python/cell_accessor_wrapper.cc +++ b/contrib/python-bindings/source/cell_accessor_wrapper.cc @@ -13,10 +13,10 @@ // // --------------------------------------------------------------------- +#include +#include +#include #include -#include -#include -#include DEAL_II_NAMESPACE_OPEN diff --git a/source/python/export_cell_accessor.cc b/contrib/python-bindings/source/export_cell_accessor.cc similarity index 97% rename from source/python/export_cell_accessor.cc rename to contrib/python-bindings/source/export_cell_accessor.cc index fef76167ca..52891c2dff 100644 --- a/source/python/export_cell_accessor.cc +++ b/contrib/python-bindings/source/export_cell_accessor.cc @@ -13,9 +13,9 @@ // // --------------------------------------------------------------------- +#include +#include #include -#include -#include DEAL_II_NAMESPACE_OPEN diff --git a/source/python/export_point.cc b/contrib/python-bindings/source/export_point.cc similarity index 96% rename from source/python/export_point.cc rename to contrib/python-bindings/source/export_point.cc index 1fbb7ed736..e79c82c058 100644 --- a/source/python/export_point.cc +++ b/contrib/python-bindings/source/export_point.cc @@ -13,10 +13,10 @@ // // --------------------------------------------------------------------- -#include -#include +#include #include #include +#include DEAL_II_NAMESPACE_OPEN diff --git a/source/python/export_triangulation.cc b/contrib/python-bindings/source/export_triangulation.cc similarity index 98% rename from source/python/export_triangulation.cc rename to contrib/python-bindings/source/export_triangulation.cc index 755c09d522..d2cede42e4 100644 --- a/source/python/export_triangulation.cc +++ b/contrib/python-bindings/source/export_triangulation.cc @@ -13,9 +13,9 @@ // // --------------------------------------------------------------------- +#include +#include #include -#include -#include DEAL_II_NAMESPACE_OPEN diff --git a/source/python/point_wrapper.cc b/contrib/python-bindings/source/point_wrapper.cc similarity index 98% rename from source/python/point_wrapper.cc rename to contrib/python-bindings/source/point_wrapper.cc index 8c9778fca8..833786b8d0 100644 --- a/source/python/point_wrapper.cc +++ b/contrib/python-bindings/source/point_wrapper.cc @@ -13,7 +13,7 @@ // // --------------------------------------------------------------------- -#include +#include #include DEAL_II_NAMESPACE_OPEN diff --git a/source/python/triangulation_wrapper.cc b/contrib/python-bindings/source/triangulation_wrapper.cc similarity index 99% rename from source/python/triangulation_wrapper.cc rename to contrib/python-bindings/source/triangulation_wrapper.cc index ea0e0c2ae0..84222ac863 100644 --- a/source/python/triangulation_wrapper.cc +++ b/contrib/python-bindings/source/triangulation_wrapper.cc @@ -13,8 +13,8 @@ // // --------------------------------------------------------------------- -#include -#include +#include +#include #include #include #include diff --git a/source/python/wrappers.cc b/contrib/python-bindings/source/wrappers.cc similarity index 100% rename from source/python/wrappers.cc rename to contrib/python-bindings/source/wrappers.cc diff --git a/tests/python/cell_accessor_wrapper.py b/contrib/python-bindings/tests/cell_accessor_wrapper.py similarity index 100% rename from tests/python/cell_accessor_wrapper.py rename to contrib/python-bindings/tests/cell_accessor_wrapper.py diff --git a/tests/python/point_wrapper.py b/contrib/python-bindings/tests/point_wrapper.py similarity index 100% rename from tests/python/point_wrapper.py rename to contrib/python-bindings/tests/point_wrapper.py diff --git a/tests/python/triangulation_wrapper.py b/contrib/python-bindings/tests/triangulation_wrapper.py similarity index 100% rename from tests/python/triangulation_wrapper.py rename to contrib/python-bindings/tests/triangulation_wrapper.py diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 3da4617522..4d3e8f7b4f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -48,9 +48,6 @@ ADD_SUBDIRECTORY(integrators) ADD_SUBDIRECTORY(matrix_free) ADD_SUBDIRECTORY(meshworker) ADD_SUBDIRECTORY(opencascade) -IF(DEAL_II_WITH_PYTHON) - ADD_SUBDIRECTORY(python) -ENDIF() FOREACH(build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${build} build_lowercase) diff --git a/source/python/dummy.py b/source/python/dummy.py deleted file mode 100644 index 4523f75471..0000000000 --- a/source/python/dummy.py +++ /dev/null @@ -1,29 +0,0 @@ -# --------------------------------------------------------------------- -# -# Copyright (C) 2016 by the deal.II authors -# -# This file is part of the deal.II library. -# -# The deal.II library is free software; you can use it, redistribute -# it, and/or modify it under the terms of the GNU Lesser General -# Public License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# The full text of the license can be found in the file LICENSE at -# the top level of the deal.II distribution. -# -# --------------------------------------------------------------------- - -"""This a dummy module that contains a global function and a class.""" - -__all__ = ['Dummy', 'bar'] - -def bar(): - """Print bar.""" - print('bar') - -class Dummy: - """This a dummy class that has only one member function.""" - - def foo(self): - """Print foo.""" - print('foo') -- 2.39.5