diff --git a/bin/find_modules.py b/bin/find_modules.py index 0b00c369c601a6fd77c7994e82476564df95ce9b..f8fa618ddf61b5c97e4b54f538ff25c299ef83bd 100644 --- a/bin/find_modules.py +++ b/bin/find_modules.py @@ -1,5 +1,3 @@ -from __future__ import print_function - try: from dune.common.module import resolve_dependencies, resolve_order, select_modules diff --git a/bin/setup-dunepy.py b/bin/setup-dunepy.py index 5aa8654a03861d607de83e7d732e118cea8f06ad..52d7b4b3a99b7bbc44902063851a9c50827b3961 100755 --- a/bin/setup-dunepy.py +++ b/bin/setup-dunepy.py @@ -1,6 +1,4 @@ #!/usr/bin/env python -from __future__ import absolute_import, division, print_function, unicode_literals - import getopt import os import shlex diff --git a/cmake/modules/DuneAddPybind11Module.cmake b/cmake/modules/DuneAddPybind11Module.cmake index 98b4f850a7a1b6eb01dae114da8e33365631ea8b..7f7180776edea80f64302264a5fb081900fe45c1 100644 --- a/cmake/modules/DuneAddPybind11Module.cmake +++ b/cmake/modules/DuneAddPybind11Module.cmake @@ -72,8 +72,6 @@ function(dune_add_pybind11_module) add_library(${PYBIND11_MODULE_NAME} SHARED ${PYBIND11_MODULE_SOURCES}) set_target_properties(${PYBIND11_MODULE_NAME} PROPERTIES PREFIX "") - #set_target_properties(${PYBIND11_MODULE_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) - #set_target_properties(${PYBIND11_MODULE_NAME} PROPERTIES VISIBILITY_INLINES_HIDDEN TRUE) target_compile_definitions(${PYBIND11_MODULE_NAME} PRIVATE ${PYBIND11_MODULE_COMPILE_DEFINITIONS}) dune_target_enable_all_packages(${PYBIND11_MODULE_NAME}) diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index 86bf35156aacab7920b95530d19f9f986b6e3fb0..d3250019eb0c4cd7a70ea060eef6cb84e61705a6 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -421,7 +421,7 @@ macro(dune_process_dependency_leafs modules versions is_required next_level_deps math(EXPR length "${mlength}-1") foreach(i RANGE 0 ${length}) list(GET mmodules ${i} _mod) - list(GET mversions ${i} _ver) + list(GET mversions ${i} _ver) find_dune_package(${_mod} ${is_required} VERSION "${_ver}") set(${_mod}_SEARCHED ON) if(NOT "${is_required}" STREQUAL "") diff --git a/cmake/modules/DuneSphinxDoc.cmake b/cmake/modules/DuneSphinxDoc.cmake index eb8dd1af2658d99fa01b41823e5981db2e8c0bfd..2be81667c26b1c2ca0261d87c6b4d92b7f291ed2 100644 --- a/cmake/modules/DuneSphinxDoc.cmake +++ b/cmake/modules/DuneSphinxDoc.cmake @@ -29,10 +29,6 @@ function(dune_sphinx_doc) configure_file(${SPHINX_DOC_CONF}.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py) elseif(EXISTS ${CMAKE_CURRENT_SOUREC_DIR}/${SPHINX_DOC_CONF}) configure_file(${SPHINX_DOC_CONF} ${CMAKE_CURRENT_BINARY_DIR}/conf.py COPYONLY) - # elseif(EXISTS ${CMAKE_SOURCE_DIR}/${SPHINX_DOC_CONF}.in) - # configure_file(${CMAKE_SOURCE_DIR}/${SPHINX_DOC_CONF}.in ${CMAKE_BINARY_DIR}/conf.py) - # elseif(EXISTS ${CMAKE_SOUREC_DIR}/${SPHINX_DOC_CONF}) - # configure_file(${CMAKE_SOURCE_DIR}/${SPHINX_DOC_CONF} ${CMAKE_BINARY_DIR}/conf.py COPYONLY) else() message(SEND_ERROR "Sphinx configuration '${SPHINX_DOC_CONF}' not found.") endif() diff --git a/dune/python/common/dynmatrix.hh b/dune/python/common/dynmatrix.hh index c2f6e27ab9e85caa80751932a0726d40ff6366c9..0bc7e77698b9b53f44692b2eb9420cc6f92fbfd9 100644 --- a/dune/python/common/dynmatrix.hh +++ b/dune/python/common/dynmatrix.hh @@ -50,7 +50,7 @@ namespace Dune cls.def("__repr__", [] (const DM& m) { - std::string repr = "DUNE DynamicMatrix:\n("; + std::string repr = "Dune::DynamicMatrix:\n("; for(unsigned int r = 0; r < m.rows(); r++) { diff --git a/dune/python/common/dynvector.hh b/dune/python/common/dynvector.hh index 86dbd4fbe8d3a1221f8a0937c53a40b672b868f1..2bd837be2f830b3f8695c615d0d79e91273c52e8 100644 --- a/dune/python/common/dynvector.hh +++ b/dune/python/common/dynvector.hh @@ -44,7 +44,7 @@ namespace Dune cls.def("__repr__", [] (const DV &v) { - std::string repr = "DUNE DynamicVector: ("; + std::string repr = "Dune::DynamicVector: ("; for (std::size_t i = 0; i < v.size(); ++i) repr += (i > 0 ? ", " : "") + std::to_string(v[i]); diff --git a/dune/python/common/getdimension.hh b/dune/python/common/getdimension.hh index 050d14a21ee73b7057376e09addb6ee8aacaa1d6..766e2bd5709a224ded12d26a4d1f84de5b2ae97a 100644 --- a/dune/python/common/getdimension.hh +++ b/dune/python/common/getdimension.hh @@ -12,9 +12,6 @@ struct GetDimension; template< class T > struct GetDimension< T, std::enable_if_t<std::is_arithmetic<T>::value>> : public std::integral_constant< int, 1 > {}; -// template<> -// struct GetDimension<double> -// : public std::integral_constant< int, 1 > {}; template< class FT, int dim > struct GetDimension<Dune::FieldVector<FT,dim>> : public std::integral_constant< int, dim > {}; diff --git a/dune/python/common/iteratorrange.hh b/dune/python/common/iteratorrange.hh deleted file mode 100644 index e122d7a2c1a4d16eb07cd9b5f615ca657902e6b3..0000000000000000000000000000000000000000 --- a/dune/python/common/iteratorrange.hh +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef DUNE_PYTHON_COMMON_ITERATORRANGE_HH -#define DUNE_PYTHON_COMMON_ITERATORRANGE_HH - -#include <dune/python/pybind11/pybind11.h> - -namespace Dune { -namespace Python { - -/** - * Simple range between a begin and an end iterator, with optional length. - * - * This class is similar to dune-common's IteratorRange, but allows - * for different types for begin and end, and includes an optional length - * for Python's `len(...)` operator. - * - * Instances of this type should be registered with - * \seealso registerIteratorRange - * - * \tparam BeginIt type of begin iterator - * \tparam EndIt type of end iterator - */ -template<typename BeginIt, typename EndIt = BeginIt> -class PyIteratorRange -{ -public: - using BeginIterator = BeginIt; - using EndIterator = EndIt; - - /** - * construct a new iterator range - */ - PyIteratorRange(const BeginIterator& begin, const EndIterator& end, std::size_t length = 0) - : begin_(begin) - , end_(end) - , length_(length) - {} - - /** - * returns begin iterator - */ - const BeginIterator& begin() const - { return begin_; } - - /** - * returns end iterator - */ - const EndIterator& end() const - { return end_; } - - /** - * returns distance between begin and end iterator. - * Used to implement Python's `__len__` protocol. - */ - std::size_t length() const - { return length_; } - -private: - BeginIterator begin_; - EndIterator end_; - std::size_t length_; -}; - -/** - * register a new iterator range Python type - * - * \tparam Range type of iterator range; should be an instance of \ref PyIteratorRange - * - * \param scope Python scope for the new class - * \param name Python name for the new class - * \param hasLength indicates whether Python type should implement `__len__` protocol or not - */ -template<typename Range> -auto registerIteratorRange(pybind11::handle scope, const char* name, bool hasLength = false) -{ - using BeginIterator = typename Range::BeginIterator; - using EndIterator = typename Range::EndIterator; - - // TODO use insertClass - auto cls = pybind11::class_<Range>(scope, name) - .def("__iter__", - [](const Range& range) { return pybind11::make_iterator(range.begin(), range.end()); }, - pybind11::keep_alive<0, 1>()); - - if (hasLength) { - cls.def(pybind11::init<const BeginIterator&, const EndIterator&, std::size_t>()); - cls.def("__len__", &Range::length); - } - else { - cls.def(pybind11::init<const BeginIterator&, const EndIterator&>()); - } - - return cls; -} - -} /* namespace Python */ -} /* namespace Dune */ - -#endif diff --git a/dune/python/common/logger.hh b/dune/python/common/logger.hh index b7fe1f3c3bee0b005669e8d74942c7c1ac04bae7..c3e5b4926bf909bf3716e3d51e74b4b5794ce19f 100644 --- a/dune/python/common/logger.hh +++ b/dune/python/common/logger.hh @@ -67,11 +67,7 @@ namespace Dune template< class... Args > void log ( int level, const std::string &msg, Args &&... args ) const { -#if PY_MAJOR_VERSION < 3 - pybind11::object pyLevel = pybind11::reinterpret_steal< pybind11::object >( PyInt_FromLong( level ) ); -#else // #if PY_MAJOR_VERSION < 3 pybind11::object pyLevel = pybind11::int_( level ); -#endif // #else // #if PY_MAJOR_VERSION < 3 logger_.attr( "log" )( pyLevel, msg, *pybind11::make_tuple( std::forward< Args >( args )... ) ); } diff --git a/dune/python/common/typeregistry.hh b/dune/python/common/typeregistry.hh index 263de015d5b3a2419c7e0855352edf1c54dc6e21..1fa2afa96ed91503afd419781662515457743750 100644 --- a/dune/python/common/typeregistry.hh +++ b/dune/python/common/typeregistry.hh @@ -375,9 +375,6 @@ namespace Dune std::vector<std::string> includes = typeName.includes(); includes.insert(includes.end(), inc.begin(), inc.end()); detail::insertIntoTypeRegistry<DuneType>(typeName.name(),"",includes); - // if (!entry.second) - // throw std::invalid_argument( (std::string("adding a class (") + - // typeid(DuneType).name() + ") twice to the type registry").c_str() ); } @@ -435,7 +432,6 @@ namespace Dune cls.def_property_readonly_static( "_typeName", [ entry ] ( pybind11::object ) { return entry.first->second.name; } ); cls.def_property_readonly_static( "_includes", [ entry ] ( pybind11::object ) { return entry.first->second.includes; } ); - // cls.def( "__str__", [ entry ] ( pybind11::object ) { return entry.first->second.name; } ); return std::make_pair( cls, true ); } diff --git a/dune/python/common/vector.hh b/dune/python/common/vector.hh index 59d2ad0f54ca86ee4702bc81e563cc46cf09dad0..afb0cdba4b0de82d0da26dd7d32e645d51d24993 100644 --- a/dune/python/common/vector.hh +++ b/dune/python/common/vector.hh @@ -164,7 +164,7 @@ namespace Dune template< std::size_t... i, class T, class... X > inline static constexpr auto extendArray ( std::index_sequence< i... >, const std::array< T, sizeof...( i ) > &array, X &&... x ) - -> std::enable_if_t< Std::conjunction< std::is_convertible< X, T >... >::value, std::array< T, sizeof...( i )+sizeof...( X ) > > + -> std::enable_if_t< std::conjunction< std::is_convertible< X, T >... >::value, std::array< T, sizeof...( i )+sizeof...( X ) > > { return {{ array[ i ]..., std::forward< X >( x )... }}; } @@ -283,7 +283,7 @@ namespace Dune return vectorize( std::forward< F >( f ), static_cast< pybind11::detail::function_signature_t< F > * >( nullptr ), std::move( xArray ) ); } - } // namespace Corepy + } // namespace Python } // namespace Dune diff --git a/dune/python/test/CMakeLists.txt b/dune/python/test/CMakeLists.txt index 9756e60c30c058c9d9c0dcf1a978f4167da3b87a..b31e4bdb5fcf5827cf8f0811d97db01deb8e6562 100644 --- a/dune/python/test/CMakeLists.txt +++ b/dune/python/test/CMakeLists.txt @@ -1,6 +1,12 @@ -# dune_symlink_to_source_files(FILES myclass.hh test_class_export.py) - dune_python_add_test(NAME pythontests COMMAND ${PYTHON_EXECUTABLE} pythontests.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} LABELS quick) + +dune_add_test(SOURCES test_embed1.cc + LINK_LIBRARIES ${DUNE_LIBS} ${PYTHON_LIBRARIES} + LABELS quick + ) + +add_executable(test_embed2 EXCLUDE_FROM_ALL test_embed2.cc) +target_link_libraries(test_embed2 ${DUNE_LIBS} ${PYTHON_LIBRARIES}) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 69d0db40683274ad4d7c4efa20d2b06781958fa8..bf6f08c0410bb4c3fcac06cfadfb8be2eeb46376 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,5 +1,3 @@ add_subdirectory(dune) -if((${DUNE_COMMON_VERSION} VERSION_LESS 2.6)) - configure_file(setup.py.in setup.py) -endif() +configure_file(setup.py.in setup.py) diff --git a/python/dune/common/CMakeLists.txt b/python/dune/common/CMakeLists.txt index 1f815511ccd9182b37911115303c391dd28befaa..de0dc76114af0f6cfd50fd14d43ab906eedb7ced 100644 --- a/python/dune/common/CMakeLists.txt +++ b/python/dune/common/CMakeLists.txt @@ -1,12 +1,13 @@ add_python_targets(common __init__ compatibility - deprecated + deprecated # deprecated 2.8 module checkconfiguration hashit - pickle + pickle # deprecated 2.8 project + utility ) dune_add_pybind11_module(NAME _common) set_property(TARGET _common PROPERTY LINK_LIBRARIES dunecommon) diff --git a/python/dune/common/_common.cc b/python/dune/common/_common.cc index c8ecb6d47443a9fc13799e04ad3f6b0ebb264ee0..00af8beb393ea35c9c6406816a7659d5c8affefc 100644 --- a/python/dune/common/_common.cc +++ b/python/dune/common/_common.cc @@ -20,17 +20,6 @@ PYBIND11_MODULE( _common, module ) Dune::Python::addToTypeRegistry<int>(Dune::Python::GenerateTypeName("int")); Dune::Python::addToTypeRegistry<std::size_t>(Dune::Python::GenerateTypeName("std::size_t")); - // to reduce compile during dune-common build don't preregister any FV/FM classes - /* - Dune::Python::registerFieldVector<double>(module, std::make_integer_sequence<int, 3>()); - - Dune::Hybrid::forEach( std::make_integer_sequence< int, 3 >(), [ module ] ( auto rows ) { - Dune::Hybrid::forEach( std::make_integer_sequence< int, 3 >(), [ module ] ( auto cols ) { - Dune::Python::registerFieldMatrix< double, decltype(rows)::value, cols >( module ); - } ); - } ); - */ - Dune::Python::registerDynamicVector<double>(module); Dune::Python::registerDynamicMatrix<double>(module); diff --git a/python/dune/common/checkconfiguration.py b/python/dune/common/checkconfiguration.py index ee3e0a0df280e8d30ce156aec652568cd7059b72..21af19883823bd2bb764470e5dbd75f459d802c0 100644 --- a/python/dune/common/checkconfiguration.py +++ b/python/dune/common/checkconfiguration.py @@ -1,5 +1,3 @@ -from __future__ import print_function, unicode_literals - import logging import os import re @@ -7,7 +5,7 @@ import subprocess import dune.common.module -from dune.common.compatibility import buffer_to_str +from dune.common.utility import buffer_to_str from dune.generator import builder, ConfigurationError logger = logging.getLogger(__name__) @@ -25,10 +23,8 @@ def assertHave(identifier): matches = [match for match in [re.match('^[ ]*#define[ ]+' + identifier.strip() + '[ ]+ENABLE', line) for line in open(config)] if match is not None] if not matches: - # logger.info("checkconfiguration.have(" + identifier + ") failed - identifier not defined in " + config) raise ConfigurationError(identifier + " is not set in dune-py's config.h") elif matches.__len__() > 1: - # logger.info("checkconfiguration.have(" + identifier + ") failed - multiple definitions in " + config) raise ConfigurationError(identifier + " found multiple times in dune-py's config.h") def preprocessorAssert(tests): diff --git a/python/dune/common/compatibility.py b/python/dune/common/compatibility.py index 726a7e71fa07b57433fa1d3ca6d60b3fb2738679..8fa1bee9012d9aa04d60894c5c38c9a07ad6002c 100644 --- a/python/dune/common/compatibility.py +++ b/python/dune/common/compatibility.py @@ -1,40 +1,8 @@ -import importlib -import sys - -if sys.version_info.major == 2: - def buffer_to_str(b): - return b -else: - def buffer_to_str(b): - return b.decode('utf-8') - - -if sys.version_info.major == 2: - def isString(s): - return isinstance(s, (str, unicode)) - - def isInteger(i): - return isinstance(i, (int, long)) -else: - def isString(s): - return isinstance(s, str) - - def isInteger(i): - return isinstance(i, int) - - -if sys.version_info.major == 2: - def reload_module(module): - reload(module) - return module -else: - reload_module = importlib.reload - -if sys.version_info.major == 2: - from inspect import getargspec - def getNumberOfParameters(func): - return len( getargspec(func).args ) -else: - from inspect import signature - def getNumberOfParameters(func): - return len( signature(func).parameters ) +print("""WARNING: +Importing deprecated `dune.common.compatibility'. The Python 2.7 versions +of the functions defined here were removed and the Python 3+ versions moved +so use + import dune.common.utility +instead +""") +from .utility import * diff --git a/python/dune/common/module.py b/python/dune/common/module.py index b799db2855fa6b49aeb77449cf08aa41b6f177b4..ddf2a4da28e382731ec7100cd4b17bdb29d7ffd5 100644 --- a/python/dune/common/module.py +++ b/python/dune/common/module.py @@ -13,10 +13,10 @@ import sys from os.path import expanduser if __name__ == "dune.common.module": - from dune.common.compatibility import buffer_to_str + from dune.common.utility import buffer_to_str from dune.common import project else: - from compatibility import buffer_to_str + from utility import buffer_to_str import project logger = logging.getLogger(__name__) diff --git a/python/dune/common/pickle.py b/python/dune/common/pickle.py index 77ade5200e69b5acfa33d801f6e795f47e85d049..aacd7620a1d337fa1b02e8e5060d0bd46648f0f1 100644 --- a/python/dune/common/pickle.py +++ b/python/dune/common/pickle.py @@ -1,6 +1,7 @@ -import sys +print("""WARNING: +Importing deprecated `dune.common.pickle' use + import pickle +instead +""") -if sys.version_info.major == 2: - from cPickle import * -else: - from pickle import * +from pickle import * diff --git a/python/dune/common/project.py b/python/dune/common/project.py index 4b9889cca9d831b2169a99c43a71d3775c964d14..ba4806c676596a66eece978f2f4cc304c886426f 100644 --- a/python/dune/common/project.py +++ b/python/dune/common/project.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - import os def write_cmake_file(dir, content=None, subdirs=None, install=None): diff --git a/python/dune/common/utility.py b/python/dune/common/utility.py new file mode 100644 index 0000000000000000000000000000000000000000..b5a7b40b42f3cd2f36d5bab4ad7313b9b6de1919 --- /dev/null +++ b/python/dune/common/utility.py @@ -0,0 +1,17 @@ +import importlib +import sys +from inspect import signature + +def buffer_to_str(b): + return b.decode('utf-8') + +def isString(s): + return isinstance(s, str) + +def isInteger(i): + return isinstance(i, int) + +reload_module = importlib.reload + +def getNumberOfParameters(func): + return len( signature(func).parameters ) diff --git a/python/dune/create.py b/python/dune/create.py index 725fecdfc333a603672375742dc0c78f7246715b..29e9e8bf4803e80439099b9c62fe1840701a4192 100644 --- a/python/dune/create.py +++ b/python/dune/create.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - import importlib import sys import pkgutil @@ -82,7 +80,6 @@ def get(category=None,entry=None): colLength[0] = max(colLength[0],len(entries[-1][0])) colLength[1] = max(colLength[1],len(entries[-1][1])) colLength[2] = max(colLength[2],len(entries[-1][2])) - # print(k,"\t function'"+e[0].__name__+"' from '"+'.'.join(m for m in n)+"'") entries.sort() print("entry".ljust(colLength[0]), "function".ljust(colLength[1]), @@ -113,27 +110,17 @@ def signatureDict(func): # all non var argument of the function as key and containing a either # Empty or the default argument provided by the function signature - if sys.version_info.major == 2: - sig = inspect.getargspec(func) - names=list(sig.args) - defaults=list(sig.defaults) if sig.defaults else list() - for i in range(len(names)-len(defaults)): - defaults.insert(0,Empty) - ret = dict(zip(names, defaults)) - else: - ret = {} - sig = inspect.signature(func) - for p,v in sig.parameters.items(): - # we only extract positional or keyword argument (i.e. not *args,**kwargs) - if v.kind == v.POSITIONAL_OR_KEYWORD: - name = v.name - default = v.default if not v.default is v.empty else Empty - ret.update({name:default}) + ret = {} + sig = inspect.signature(func) + for p,v in sig.parameters.items(): + # we only extract positional or keyword argument (i.e. not *args,**kwargs) + if v.kind == v.POSITIONAL_OR_KEYWORD: + name = v.name + default = v.default if not v.default is v.empty else Empty + ret.update({name:default}) return ret def _creatorCall(create, usedKeys, *args, **kwargs): - # print("*********************************************") - # print("creatorCall:",key) # get signature of create function to call signature = signatureDict(create) # check if any of the parameter names correspond to some creator - @@ -147,7 +134,6 @@ def _creatorCall(create, usedKeys, *args, **kwargs): if name=='view' and not name in kwargs and 'grid' in kwargs: kwargs.update({"view":kwargs["grid"]}) usedKeys.update(["grid"]) - # print("checking parameter: ",name,end=" -\n ") creator = globals().get(name) if creator: # a creator for this parameter name exists assert signature[name] == Empty, "argument in create method corresponding to creatibles should not have default values" @@ -170,8 +156,6 @@ def _creatorCall(create, usedKeys, *args, **kwargs): else: signature[name] = argument usedKeys.update([name]) - # print(signature) - # print("*********************************************") return create(**signature) def creatorCall(self, key, *args, **kwargs): @@ -193,7 +177,6 @@ def creatorCall(self, key, *args, **kwargs): kwargs.update({'view':kwargs['grid']}) usedKeys.update(['grid']) instance = _creatorCall(create,usedKeys,*args,**kwargs) - # print(set(kwargs), usedKeys) assert set(kwargs) == usedKeys, "some provided named parameters where not used" return instance diff --git a/python/dune/generator/algorithm.py b/python/dune/generator/algorithm.py index bbdf343c441b77b6aa6de3b463af3faea91e0539..a2dd20c84c7672f274a78f78bc91fc2a48dffc00 100644 --- a/python/dune/generator/algorithm.py +++ b/python/dune/generator/algorithm.py @@ -1,10 +1,8 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - import numpy from dune.common.hashit import hashIt from . import builder -from dune.common.compatibility import isString +from dune.common.utility import isString def cppType(arg): try: diff --git a/python/dune/generator/builder.py b/python/dune/generator/builder.py index 002f65f22b29194c52997e98573b4d429e8d4590..541013b14176fdbf4bc868e94ca762f8deed1b2c 100644 --- a/python/dune/generator/builder.py +++ b/python/dune/generator/builder.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - import importlib import logging import shlex @@ -52,7 +50,7 @@ except ModuleNotFoundError: return exc_type == None from dune.common import comm -from dune.common.compatibility import buffer_to_str, isString, reload_module +from dune.common.utility import buffer_to_str, isString, reload_module from dune.generator.exceptions import CompileError, ConfigurationError import dune.common.module diff --git a/python/dune/generator/exceptions.py b/python/dune/generator/exceptions.py index b65a44e675f70ffb5544cb051497691a36d54846..690e570573b9a425bfe7475c7578be37580a768d 100644 --- a/python/dune/generator/exceptions.py +++ b/python/dune/generator/exceptions.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - class CompileError(Exception): '''raise this when there's a problem compiling an extension module''' def __init__(self, error): diff --git a/python/dune/generator/generator.py b/python/dune/generator/generator.py index f0529c42ced2424b03d6ac902d21a461c888e4c4..a7dbcea9e67aa54c6eef049aec2d5025eb468709 100644 --- a/python/dune/generator/generator.py +++ b/python/dune/generator/generator.py @@ -6,8 +6,6 @@ provided by python dictonaries stored in files. """ -from __future__ import absolute_import, division, print_function, unicode_literals - import logging from . import builder @@ -155,13 +153,3 @@ def simpleGenerator(inc, baseType, namespace, pythonname=None, filename=None): moduleName = namespace + "_" + baseType + "_" + hashIt(typeName) return generator.load(includes, typeName, moduleName, *args) return load - -from . import Method as Method_ -from . import Constructor as Constructor_ -from dune.deprecate import deprecated -@deprecated("import from dune.generator directly") -class Method(Method_): - pass -@deprecated("import from dune.generator directly") -class Constructor(Constructor_): - pass diff --git a/python/dune/generator/importclass.py b/python/dune/generator/importclass.py index 45bfe01caa5aaf1d713a1f38b42fbdec2c012447..d6cda077f882734f7de42ea5d41945898ebe5def 100644 --- a/python/dune/generator/importclass.py +++ b/python/dune/generator/importclass.py @@ -1,10 +1,8 @@ -from __future__ import absolute_import, division, print_function, unicode_literals - import os from dune.common.hashit import hashIt from . import builder -from dune.common.compatibility import isString +from dune.common.utility import isString from dune.generator.algorithm import cppType def load(className, includeFiles, *args): diff --git a/python/setup.py.in b/python/setup.py.in index 1ae9da931648069a367f19f36b3fa300f9a33855..e52ec0c261d4f644687a3922fd73777020a7c20b 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -3,10 +3,10 @@ from setuptools import setup, find_packages setup(name="dune.common", namespace_packages=['dune'], description="Python lib for dune", - version="${DUNE_PYTHON_VERSION}", + version="${DUNE_COMMON_VERSION}", author="Andreas Dedner and Martin Nolte", packages = find_packages(), zip_safe = 0, package_data = {'': ['*.so']}, - install_requires = ['portalocker'] + install_requires = ['portalocker','mpi4py','numpy'] )