mirror of
https://github.com/triqs/dft_tools
synced 2024-12-22 20:34:38 +01:00
[app4triqs] Rename files and Python module from toto to app4triqs
-Automatically detect any wrap generator files -rename tests to basic/Py_Basic
This commit is contained in:
parent
445e15d153
commit
28d600f149
@ -1,5 +1,5 @@
|
||||
#include <cmath>
|
||||
#include "./toto.hpp"
|
||||
#include "./app4triqs.hpp"
|
||||
|
||||
namespace app4triqs {
|
||||
|
@ -7,6 +7,7 @@ namespace app4triqs {
|
||||
* A very useful and important class
|
||||
*
|
||||
* @note A Useful note
|
||||
* @include app4triqs/app4triqs.hpp
|
||||
*/
|
||||
class toto {
|
||||
|
||||
@ -74,25 +75,4 @@ namespace app4triqs {
|
||||
*/
|
||||
int chain(int i, int j);
|
||||
|
||||
/**
|
||||
* Chain digits of three integers
|
||||
*
|
||||
* @param i The first integer
|
||||
* @param j The second integer
|
||||
* @param k The third integer
|
||||
* @return An integer containing the digits of both i and j
|
||||
*
|
||||
* @remark
|
||||
*/
|
||||
int chain(int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Chain digits of one integers
|
||||
*
|
||||
* @param i The first integer
|
||||
*
|
||||
* @remark
|
||||
*/
|
||||
int chain(int i);
|
||||
|
||||
} // namespace app4triqs
|
@ -35,7 +35,7 @@ macro(generate_docs header_file)
|
||||
)
|
||||
endmacro(generate_docs)
|
||||
|
||||
generate_docs(${PROJECT_SOURCE_DIR}/c++/app4triqs/toto.hpp)
|
||||
generate_docs(${PROJECT_SOURCE_DIR}/c++/app4triqs/app4triqs.hpp)
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Build & Run the C++ doc examples and capture the output
|
||||
|
@ -10,4 +10,3 @@ Table of contents
|
||||
issues
|
||||
changelog
|
||||
about
|
||||
|
||||
|
@ -36,8 +36,7 @@ Python reference manual
|
||||
.. automodule:: app4triqs
|
||||
:members:
|
||||
|
||||
.. autoclass:: app4triqs.toto_module.Toto
|
||||
.. autoclass:: app4triqs.app4triqs_module.Toto
|
||||
:members:
|
||||
|
||||
.. autofunction:: app4triqs.toto_module.chain
|
||||
|
||||
.. autofunction:: app4triqs.app4triqs_module.chain
|
||||
|
@ -1,7 +1,3 @@
|
||||
# Build the python module
|
||||
add_cpp2py_module(toto_module)
|
||||
target_link_libraries(toto_module app4triqs_c)
|
||||
|
||||
# Configure the version
|
||||
configure_file(version.py.in version.py)
|
||||
|
||||
@ -13,7 +9,14 @@ foreach(file ${python_sources})
|
||||
configure_file(${file} ${file} COPYONLY)
|
||||
endforeach()
|
||||
|
||||
# Install python module to proper location
|
||||
# Build any python modules
|
||||
foreach(gen ${wrap_generators})
|
||||
string(REPLACE "_desc.py" "" module_name ${gen})
|
||||
add_cpp2py_module(${module_name})
|
||||
target_link_libraries(${module_name} app4triqs_c)
|
||||
endforeach()
|
||||
|
||||
# Install python modules to proper location
|
||||
set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/app4triqs)
|
||||
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
||||
install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST})
|
||||
|
@ -25,6 +25,6 @@ r"""
|
||||
DOC
|
||||
|
||||
"""
|
||||
from toto_module import Toto, chain
|
||||
from app4triqs_module import Toto, chain
|
||||
|
||||
__all__ = ['Toto', 'chain']
|
||||
|
@ -1,15 +1,14 @@
|
||||
# Generated automatically using the command :
|
||||
# c++2py ../../c++/app4triqs/toto.hpp -p --members_read_only -N app4triqs -a app4triqs -m toto_module -o toto_module -C pytriqs --cxxflags="-std=c++17 "
|
||||
# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module -C pytriqs --cxxflags="-std=c++17 "
|
||||
from cpp2py.wrap_generator import *
|
||||
|
||||
# The module
|
||||
module = module_(full_name = "toto_module", doc = "", app_name = "app4triqs")
|
||||
module = module_(full_name = "app4triqs_module", doc = r"", app_name = "app4triqs")
|
||||
|
||||
# Imports
|
||||
module.add_imports(*[])
|
||||
|
||||
# Add here all includes
|
||||
module.add_include("app4triqs/toto.hpp")
|
||||
module.add_include("app4triqs/app4triqs.hpp")
|
||||
|
||||
# Add here anything to add in the C++ code at the start, e.g. namespace using
|
||||
module.add_preamble("""
|
||||
@ -54,14 +53,12 @@ c.add_method("""std::string hdf5_scheme ()""",
|
||||
|
||||
c.add_property(name = "i",
|
||||
getter = cfunction("int get_i ()"),
|
||||
doc = """Simple accessor""")
|
||||
doc = r"""Simple accessor""")
|
||||
|
||||
module.add_class(c)
|
||||
|
||||
module.add_function ("int app4triqs::chain (int i, int j)", doc = r"""Chain digits of two integers
|
||||
|
||||
Chain the decimal digits of two integers i and j, and return the result
|
||||
|
||||
Parameters
|
||||
----------
|
||||
i
|
@ -1,5 +1,5 @@
|
||||
#include <triqs/test_tools/gfs.hpp>
|
||||
#include <app4triqs/toto.hpp>
|
||||
#include <app4triqs/app4triqs.hpp>
|
||||
|
||||
using namespace app4triqs;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import unittest
|
||||
|
||||
from app4triqs import Toto
|
||||
from app4triqs import Toto, chain
|
||||
from pytriqs.archive import *
|
||||
from pytriqs.utility import mpi
|
||||
|
||||
@ -37,6 +37,14 @@ class test_toto(unittest.TestCase):
|
||||
|
||||
self.assertEqual(a, Toto(1))
|
||||
|
||||
class test_chain(unittest.TestCase):
|
||||
|
||||
def test_chain(self):
|
||||
|
||||
i = 111
|
||||
j = 222
|
||||
ij = chain(i,j)
|
||||
self.assertEqual(ij, 111222)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -5,11 +5,11 @@ foreach(file ${all_h5_ref_files})
|
||||
endforeach()
|
||||
|
||||
# List of all tests
|
||||
set(all_tests Toto chain)
|
||||
set(all_tests Basic)
|
||||
|
||||
foreach(test ${all_tests})
|
||||
get_filename_component(test_name ${test} NAME_WE)
|
||||
get_filename_component(test_dir ${test} DIRECTORY)
|
||||
add_test(NAME ${test_name} COMMAND ${TRIQS_PYTHON_INTERPRETER} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||
set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD})
|
||||
add_test(NAME Py_${test_name} COMMAND ${TRIQS_PYTHON_INTERPRETER} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
||||
set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD})
|
||||
endforeach()
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import unittest
|
||||
|
||||
from app4triqs import chain
|
||||
|
||||
class test_chain(unittest.TestCase):
|
||||
|
||||
def test_chain(self):
|
||||
|
||||
i = 111
|
||||
j = 222
|
||||
ij = chain(i,j)
|
||||
self.assertEqual(ij, 111222)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user