From 78ad82cdb2781763f60eb194c78a278ca7cef1a2 Mon Sep 17 00:00:00 2001 From: David Andrs Date: Thu, 26 Oct 2023 09:40:27 -0600 Subject: [PATCH] pyfprops is now only fprops --- docs/pyplots/plot_err.py | 2 +- docs/python/example.rst | 2 +- python/CMakeLists.txt | 4 ++-- python/setup.py.in | 4 ++-- python/src/CMakeLists.txt | 14 +++++++------- python/src/fprops.cpp | 2 +- python/src/{pyfprops => fprops}/__init__.py | 2 +- python/tests/test_air.py | 2 +- python/tests/test_co2.py | 2 +- python/tests/test_helium.py | 2 +- python/tests/test_nitrogen.py | 2 +- src/CMakeLists.txt | 13 ++++++++----- test/src/CMakeLists.txt | 2 +- 13 files changed, 28 insertions(+), 25 deletions(-) rename python/src/{pyfprops => fprops}/__init__.py (77%) diff --git a/docs/pyplots/plot_err.py b/docs/pyplots/plot_err.py index 3c3619b..e74bd14 100644 --- a/docs/pyplots/plot_err.py +++ b/docs/pyplots/plot_err.py @@ -6,7 +6,7 @@ from CoolProp import AbstractState from CoolProp.CoolProp import PhaseSI, PropsSI, get_global_param_string import CoolProp.CoolProp as CoolProp -import pyfprops as fp +import fprops as fp import math import numpy as np import matplotlib.pyplot as plt diff --git a/docs/python/example.rst b/docs/python/example.rst index a644e56..ce19652 100644 --- a/docs/python/example.rst +++ b/docs/python/example.rst @@ -6,7 +6,7 @@ temperature = 280 K. .. code:: - import pyfprops as fp + import fprops as fp n2 = fp.Nitrogen() # p = 1MPa, T = 280 K s = n2.p_T(1e6, 280) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 6555a66..099a53e 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -10,8 +10,8 @@ if (FPROPS_BUILD_TESTS) find_program(PYTEST "pytest" REQUIRED) enable_testing() add_test( - NAME pyfprops-test + NAME python-tests COMMAND ${PYTEST} ${CMAKE_CURRENT_SOURCE_DIR} ) - set_tests_properties(pyfprops-test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/src:$ENV{PYTHONPATH}") + set_tests_properties(python-tests PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/src:$ENV{PYTHONPATH}") endif() diff --git a/python/setup.py.in b/python/setup.py.in index f082fae..f66c3dd 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -1,8 +1,8 @@ from setuptools import Extension, setup setup( - name='pyfprops', + name='fprops', version='${PROJECT_VERSION}', - packages=['pyfprops'], + packages=['fprops'], package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}/src' } ) diff --git a/python/src/CMakeLists.txt b/python/src/CMakeLists.txt index b866bf5..2d65bd1 100644 --- a/python/src/CMakeLists.txt +++ b/python/src/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.4...3.18) -project(pyfprops LANGUAGES C CXX) +project(fprops LANGUAGES C CXX) find_package(pybind11 2.9 REQUIRED) -pybind11_add_module(${PROJECT_NAME} fprops.cpp) +pybind11_add_module(fprops fprops.cpp) target_include_directories( - ${PROJECT_NAME} + fprops PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include @@ -14,13 +14,13 @@ target_include_directories( ) target_link_libraries( - ${PROJECT_NAME} + fprops PUBLIC - fprops + libfprops ) install( - TARGETS ${PROJECT_NAME} + TARGETS fprops COMPONENT python - LIBRARY DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/pyfprops" + LIBRARY DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/fprops" ) diff --git a/python/src/fprops.cpp b/python/src/fprops.cpp index c6ed7b3..1d3a056 100644 --- a/python/src/fprops.cpp +++ b/python/src/fprops.cpp @@ -11,7 +11,7 @@ using namespace fprops; namespace py = pybind11; -PYBIND11_MODULE(pyfprops, m) +PYBIND11_MODULE(fprops, m) { m.doc() = "pybind11 plugin for fprops"; diff --git a/python/src/pyfprops/__init__.py b/python/src/fprops/__init__.py similarity index 77% rename from python/src/pyfprops/__init__.py rename to python/src/fprops/__init__.py index 8fd732e..404cf5e 100644 --- a/python/src/pyfprops/__init__.py +++ b/python/src/fprops/__init__.py @@ -1,4 +1,4 @@ -from .pyfprops import * +from .fprops import * __all__ = [ Air, diff --git a/python/tests/test_air.py b/python/tests/test_air.py index ff590b4..b0c2246 100644 --- a/python/tests/test_air.py +++ b/python/tests/test_air.py @@ -1,4 +1,4 @@ -import pyfprops as fp +import fprops as fp import pytest import math diff --git a/python/tests/test_co2.py b/python/tests/test_co2.py index 76166ee..4b8e01d 100644 --- a/python/tests/test_co2.py +++ b/python/tests/test_co2.py @@ -1,4 +1,4 @@ -import pyfprops as fp +import fprops as fp import pytest import math diff --git a/python/tests/test_helium.py b/python/tests/test_helium.py index a895e6b..3c448fc 100644 --- a/python/tests/test_helium.py +++ b/python/tests/test_helium.py @@ -1,4 +1,4 @@ -import pyfprops as fp +import fprops as fp import pytest import math diff --git a/python/tests/test_nitrogen.py b/python/tests/test_nitrogen.py index 393beb1..c21d2ef 100644 --- a/python/tests/test_nitrogen.py +++ b/python/tests/test_nitrogen.py @@ -1,4 +1,4 @@ -import pyfprops as fp +import fprops as fp import pytest import math diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 862e0ac..50bf40e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ add_library( - ${PROJECT_NAME} + libfprops SHARED Air.cpp CarbonDioxide.cpp @@ -13,20 +13,23 @@ add_library( SinglePhaseFluidProperties.cpp Utils.cpp ) +if(NOT MSVC) + set_target_properties(libfprops PROPERTIES OUTPUT_NAME fprops) +endif() if(CMAKE_PROJECT_NAME STREQUAL "fprops") target_code_coverage(${PROJECT_NAME}) target_sanitization(${PROJECT_NAME}) endif() set_target_properties( - ${PROJECT_NAME} + libfprops PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) target_include_directories( - ${PROJECT_NAME} + libfprops PUBLIC $ $ @@ -38,7 +41,7 @@ target_include_directories( ) target_link_libraries( - ${PROJECT_NAME} + libfprops PUBLIC fmt::fmt PRIVATE @@ -57,7 +60,7 @@ write_basic_package_version_file(fpropsConfigVersion.cmake ) install( - TARGETS fprops + TARGETS libfprops EXPORT fpropsTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib diff --git a/test/src/CMakeLists.txt b/test/src/CMakeLists.txt index 395b7a8..edcb819 100644 --- a/test/src/CMakeLists.txt +++ b/test/src/CMakeLists.txt @@ -31,7 +31,7 @@ target_include_directories( target_link_libraries( ${PROJECT_NAME} PUBLIC - fprops + libfprops gtest_main gmock_main )