Skip to content
Snippets Groups Projects
Commit 37ba80d2 authored by Dominic Kempf's avatar Dominic Kempf Committed by Andreas Dedner
Browse files

Adapt dune-geometry to overhaul of the Python-CMake interface

added missing 'include_package_data' to setup.py.in

improve on ci

add clang test

pep 42: use implicit namespace packages which make it possible to combine subpackages using editable (source) and non editable (pypi)

only use a cmake install a python module in the SKBUILD setting - for an install from build dir pip will take take of this since it is part of the setup.py file

add a stopgap solution unti ci repo up and running again

Update requirements in setup.py.in to include dune packages

[testing]

only add dune modules that have been found as requirements in setup.py.in

removed setup.py.in since the default is provided in dune-common

adapt ci yml file to python bindings on by default

disable python bindings for clang 5 (ubuntu 18) since no numpy matching numpy version can be installed from the gitlab registry

[testing]
parent 86a72a03
No related branches found
No related tags found
1 merge request!166refactor the way python is used in dune
......@@ -11,22 +11,30 @@ before_script:
- . /duneci/bin/duneci-init-job
- duneci-install-module https://gitlab.dune-project.org/core/dune-common.git
debian-11-gcc-9-17-python:
image: registry.dune-project.org/docker/ci/debian:11
ubuntu-20.04-clang-10-20-nobindings:
image: registry.dune-project.org/docker/ci/ubuntu:20.04
script: duneci-standard-test
stage: test
variables:
DUNECI_TOOLCHAIN: gcc-9-17
# so we need some variables to build the dune-py module during execution of the first python test:
# we need to find the dune mdoule
DUNE_CONTROL_PATH: /duneci/modules:$CI_PROJECT_DIR
# the position for the dune-py module
DUNE_PY_DIR: /duneci/modules/dune-py
DUNE_LOG_LEVEL: DEBUG
# during dune-py build this variable is used - do know a way to access
# the CMAKE_FLAGS used to build the modules...
DUNE_CMAKE_FLAGS: "-DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_FLAGS='-std=c++17 -O2 -g -Wall -fdiagnostics-color=always' -DDUNE_ENABLE_PYTHONBINDINGS=ON -DDUNE_MAX_TEST_CORES=4 -DBUILD_SHARED_LIBS=TRUE -DDUNE_PYTHON_INSTALL_LOCATION=none -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Alberta=TRUE -DCMAKE_DISABLE_FIND_PACKAGE_Vc=TRUE -DCMAKE_DISABLE_DOCUMENTATION=TRUE"
# cmake flags we use for all dune moudle - important is that build shared libs is set (need some better way of doing this)
DUNECI_CMAKE_FLAGS: $DUNE_CMAKE_FLAGS
# finally set the python path to all modules
PYTHONPATH: /duneci/modules/dune-common/build-cmake/python:$CI_PROJECT_DIR/build-cmake/python
DUNECI_TOOLCHAIN: clang-10-20
DUNECI_CMAKE_FLAGS: '-DDUNE_ENABLE_PYTHONBINDINGS=ON'
tags: [duneci]
# no numpy version available for this image on the gitlab registry
# disable python bindings for now
ubuntu:18.04 clang-6-17:
image: registry.dune-project.org/docker/ci/ubuntu:18.04
script: duneci-standard-test
stage: test
variables:
DUNECI_TOOLCHAIN: clang-6-17
DUNECI_CMAKE_FLAGS: "-DDUNE_ENABLE_PYTHONBINDINGS=OFF"
tags: [duneci]
ubuntu:18.04 clang-5-17:
image: registry.dune-project.org/docker/ci/ubuntu:18.04
script: duneci-standard-test
stage: test
variables:
DUNECI_TOOLCHAIN: clang-5-17
DUNECI_CMAKE_FLAGS: "-DDUNE_ENABLE_PYTHONBINDINGS=OFF"
tags: [duneci]
......@@ -27,7 +27,6 @@ add_subdirectory("lib")
# if Python bindings are enabled, include necessary sub directories.
if( DUNE_ENABLE_PYTHONBINDINGS )
add_subdirectory("python")
dune_python_install_package(PATH python)
endif()
# finalize the dune project, e.g. generating config.h etc.
......
[build-system]
requires = ['setuptools', 'wheel', 'scikit-build', 'cmake', 'ninja', 'requests', 'dune-common>=2.8.0.dev0']
requires = ['dune-common>=2.8.0.dev0', 'pip', 'setuptools', 'wheel', 'scikit-build', 'cmake', 'ninja', 'requests']
build-backend = 'setuptools.build_meta'
add_subdirectory(dune)
configure_file(setup.py.in setup.py)
dune_python_install_package(
PATH "."
CMAKE_METADATA_FILE dune/geometry/metadata.cmake
DEPENDS _geometry
)
add_subdirectory(geometry)
add_python_targets(dune
__init__
)
__import__('pkg_resources').declare_namespace(__name__)
......@@ -5,4 +5,6 @@ add_python_targets(geometry
)
dune_add_pybind11_module(NAME _geometry)
set_property(TARGET _geometry PROPERTY LINK_LIBRARIES dunecommon dunegeometry APPEND)
install(TARGETS _geometry LIBRARY DESTINATION python/dune/geometry)
if(SKBUILD)
install(TARGETS _geometry LIBRARY DESTINATION python/dune/geometry)
endif()
from ..generator.generator import SimpleGenerator
from dune.generator.generator import SimpleGenerator
from dune.common.hashit import hashIt
def module(dim):
typeName = "Dune::Geo::ReferenceElement<Dune::Geo::ReferenceElementImplementation<double," + str(dim) + "> >"
......
from setuptools import setup, find_packages
pkg = [m for m in "${ProjectPythonRequires}".split(' ') if "dune" not in m]
setup(name="${ProjectName}",
namespace_packages=['dune'],
description="${ProjectDescription}",
version="${ProjectVersionString}",
author="${ProjectAuthor}",
author_email="${ProjectMaintainerEmail}",
packages = find_packages(),
zip_safe = 0,
package_data = {'': ['*.so']},
install_requires = pkg
)
import os, sys
try:
from dune.packagemetadata import metaData
except ImportError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment