diff --git a/include/binary_c_python.h b/include/binary_c_python.h index c242d96e5ff7745beb16c0c403472ec47ce29d30..b6bbb86e131c42ae3ea8bf9f7b0cc85807c3ddf5 100644 --- a/include/binary_c_python.h +++ b/include/binary_c_python.h @@ -7,6 +7,8 @@ */ #include "binary_c_API.h" +#include "binary_c.h" +#include "binary_c_API_prototypes.h" /* Binary_c's python API prototypes */ int run_system(char * argstring, diff --git a/setup.py b/setup.py index 86f77130511ba0dd29f5d5e67b489d38e6e7d86d..349c368029212989033b7f0f926b6fd7b2e26f55 100644 --- a/setup.py +++ b/setup.py @@ -21,13 +21,13 @@ def license(): with open("LICENSE.md") as file: return file.read() -def check_version(installed_binary_c_version, required_binary_c_version): +def check_version(installed_binary_c_version, required_binary_c_versions): """Function to check the installed version and compare it to the required version""" message = """ - The binary_c version that is installed ({}) does not match any of the binary_c versions ({}) + The binary_c version that is installed ({}) does not match the binary_c versions ({}) that this release of the binary_c python module requires. - """.format(installed_binary_c_version, required_binary_c_version) - assert installed_binary_c_version in required_binary_c_version, message + """.format(installed_binary_c_version, required_binary_c_versions) + assert installed_binary_c_version in required_binary_c_versions, message ### REQUIRED_BINARY_C_VERSIONS = ['2.1.7'] @@ -110,6 +110,10 @@ for x in DEFINES: if y: BINARY_C_DEFINE_MACROS.extend([(y.group(1), None)]) +# add API header file +API_h = os.path.join(BINARY_C_DIR, "src", "API", "binary_c_API.h") +BINARY_C_DEFINE_MACROS.extend([("BINARY_C_API_H", API_h)]) + ############################################################ # Setting all directories and LIBRARIES to their final values ############################################################ @@ -141,16 +145,17 @@ RUNTIME_LIBRARY_DIRS = [ # os.path.join(CWD, "binarycpython/core/"), ] + BINARY_C_LIBDIRS -print('\n') -print("BINARY_C_CONFIG: ", str(BINARY_C_CONFIG) + "\n") -print("incdirs: ", str(INCLUDE_DIRS) + "\n") -print("BINARY_C_LIBS: ", str(BINARY_C_LIBS) + "\n") -print("LIBRARIES: ", str(LIBRARIES) + "\n") -print("LIBRARY_DIRS: ", str(LIBRARY_DIRS) + "\n") -print("RUNTIME_LIBRARY_DIRS: ", str(RUNTIME_LIBRARY_DIRS) + "\n") -print("BINARY_C_CFLAGS: ", str(BINARY_C_CFLAGS) + "\n") -print("macros: ", str(BINARY_C_DEFINE_MACROS) + "\n") -print('\n') +# print('\n') +# print("BINARY_C_CONFIG: ", str(BINARY_C_CONFIG) + "\n") +# print("incdirs: ", str(INCLUDE_DIRS) + "\n") +# print("BINARY_C_LIBS: ", str(BINARY_C_LIBS) + "\n") +# print("LIBRARIES: ", str(LIBRARIES) + "\n") +# print("LIBRARY_DIRS: ", str(LIBRARY_DIRS) + "\n") +# print("RUNTIME_LIBRARY_DIRS: ", str(RUNTIME_LIBRARY_DIRS) + "\n") +# print("BINARY_C_CFLAGS: ", str(BINARY_C_CFLAGS) + "\n") +# print("API_h: ", str(API_h) + "\n") +# print("macros: ", str(BINARY_C_DEFINE_MACROS) + "\n") +# print('\n') ############################################################ # Making the extension function diff --git a/src/binary_c_python_api.c b/src/binary_c_python_api.c index 404e217021b4963713ce575f7d45609958646994..973a0253983fafb7847297fdc8140346887496fa 100644 --- a/src/binary_c_python_api.c +++ b/src/binary_c_python_api.c @@ -79,7 +79,7 @@ int run_system(char * argstring, NULL, // previous_stardatas NULL, // preferences &store, // store - &persistent_data, // persistent_data TODO: see if this use is correct + NULL, // persistent_data TODO: see if this use is correct &argstring, // argv -1 // argc ); diff --git a/tests/python_API_test.py b/tests/python_API_test.py index 8c352914ca8c4e0208cb8e3fe36dff2bb128c758..ed3afe416ef5240aa35ad098f5a1483942aa986b 100755 --- a/tests/python_API_test.py +++ b/tests/python_API_test.py @@ -10,6 +10,7 @@ from binarycpython.utils.custom_logging_functions import ( from binarycpython.utils.functions import temp_dir import tempfile +import textwrap ############################################################ # Test script for the api functions @@ -18,9 +19,7 @@ import tempfile ############################################################ -# Evolution functionality - - +# Evolution functions def test_run_system(): m1 = 15.0 # Msun m2 = 14.0 # Msun @@ -43,7 +42,7 @@ def test_run_system(): print("function: test_run_system") print("Binary_c output:") - print(output) + print(textwrap.indent(output, "\t")) def test_run_system_with_log(): @@ -74,13 +73,10 @@ def test_run_system_with_log(): print("function: test_run_system_with_log") print("Binary_c output:") - print(output) + print(textwrap.indent(output, "\t")) def test_run_system_with_custom_logging(): - """ - """ - # generate logging lines. Here you can choose whatever you want to have logged, and with what header # this generates working print statements logging_line = autogen_C_logging_code( @@ -116,56 +112,55 @@ def test_run_system_with_custom_logging(): print("function: test_run_system_with_custom_logging") print("memory adress of custom logging functions:") - print(func_memaddr) + print(textwrap.indent(str(func_memaddr), "\t")) - out = binary_c_python_api.run_system( + output = binary_c_python_api.run_system( argstring, custom_logging_func_memaddr=func_memaddr ) print("binary_c output:") - print(out) + print(textwrap.indent(output, "\t")) + # Testing other utility functions def test_return_help(): - out = binary_c_python_api.return_help("M_1") + output = binary_c_python_api.return_help("M_1") print("function: test_return_help") print("help output:") - print(out) + print(textwrap.indent(output, "\t")) def test_return_arglines(): - out = binary_c_python_api.return_arglines() + output = binary_c_python_api.return_arglines() print("function: test_return_arglines") print("arglines output:") - print(out) + print(textwrap.indent(output, "\t")) def test_return_help_all(): - out = binary_c_python_api.return_help_all("M_1") + output = binary_c_python_api.return_help_all("M_1") print("function: test_return_help_all") print("help all output:") - print(out) + print(textwrap.indent(output, "\t")) def test_return_version_info(): - out = binary_c_python_api.return_version_info() + output = binary_c_python_api.return_version_info() print("function: test_return_version_info") print("version info output:") - print(out) + print(textwrap.indent(output, "\t")) # Testing other functions - - def test_return_store(): - out = binary_c_python_api.return_store("") + output = binary_c_python_api.return_store("") print("function: test_return_store") print("store memory adress:") - print(out) + print(textwrap.indent(str(output), "\t")) ####