From 09769c3283cc9837bc46db589611ef5628992a9f Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 20 Mar 2024 11:40:21 +0100 Subject: [PATCH] Fix python warning when running python -m netgen.config, remove unused config_cli.py --- python/CMakeLists.txt | 11 +++++++++-- python/config/__init__.py | 1 + python/config/__main__.py | 4 ++++ python/{ => config}/config_template.py | 0 python/config_cli.py | 10 ---------- 5 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 python/config/__init__.py create mode 100644 python/config/__main__.py rename python/{ => config}/config_template.py (100%) delete mode 100644 python/config_cli.py diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9223cc1c..fabe9c53 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -4,13 +4,20 @@ if(have_options) get_target_property(ngcore_compile_options ngcore INTERFACE_COMPILE_OPTIONS) endif(have_options) -configure_file(config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY) +configure_file(config/config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY) configure_file(version_template.py ${CMAKE_CURRENT_BINARY_DIR}/version.py @ONLY) install(FILES + config/__init__.py + config/__main__.py ${CMAKE_CURRENT_BINARY_DIR}/config.py + DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}/config/ + COMPONENT netgen + ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py - __main__.py __init__.py config_cli.py + __main__.py __init__.py meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py read_meshio.py webgui.py diff --git a/python/config/__init__.py b/python/config/__init__.py new file mode 100644 index 00000000..27c9ec62 --- /dev/null +++ b/python/config/__init__.py @@ -0,0 +1 @@ +from .config import * diff --git a/python/config/__main__.py b/python/config/__main__.py new file mode 100644 index 00000000..6760d400 --- /dev/null +++ b/python/config/__main__.py @@ -0,0 +1,4 @@ +from .config import get_cmake_dir + +if __name__ == '__main__': + print(get_cmake_dir()) diff --git a/python/config_template.py b/python/config/config_template.py similarity index 100% rename from python/config_template.py rename to python/config/config_template.py diff --git a/python/config_cli.py b/python/config_cli.py deleted file mode 100644 index 572f9750..00000000 --- a/python/config_cli.py +++ /dev/null @@ -1,10 +0,0 @@ -import netgen.config - -if __name__=="__main__": - import argparse - parser = argparse.ArgumentParser() - parser.add_argument("--cmake-dir", help="print path to CMake config files", action='store_true') - args = parser.parse_args() - if(args.cmake_dir): - print(netgen.config.get_cmake_dir()) -