summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/py_commodity.cc1
-rw-r--r--src/pyinterp.cc5
3 files changed, 15 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9fd7d295..c6a9e28e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -244,11 +244,20 @@ endif()
add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES main.cc global.cc)
if(BUILD_LIBRARY)
+ add_library(pyledger SHARED ${LEDGER_SOURCES})
+ add_ledger_library_dependencies(pyledger)
+ if(CMAKE_HOST_APPLE)
+ set_target_properties(pyledger PROPERTIES OUTPUT_NAME ledger)
+ set_target_properties(pyledger PROPERTIES SUFFIX .so)
+ set(CMAKE_SHARED_LIBRARY_PREFIX )
+ endif()
+
add_library(libledger ${LEDGER_SOURCES} ${PROJECT_SOURCE_DIR}/lib/sha1.cpp)
set_target_properties(libledger PROPERTIES OUTPUT_NAME ledger)
add_executable(ledger main.cc global.cc)
+ install(TARGETS pyledger DESTINATION lib)
install(TARGETS libledger DESTINATION lib)
install(FILES ${LEDGER_INCLUDES} DESTINATION include/ledger)
else()
diff --git a/src/py_commodity.cc b/src/py_commodity.cc
index fd932fc7..44c272f8 100644
--- a/src/py_commodity.cc
+++ b/src/py_commodity.cc
@@ -315,6 +315,7 @@ void export_commodity()
scope().attr("COMMODITY_STYLE_SUFFIXED") = COMMODITY_STYLE_SUFFIXED;
scope().attr("COMMODITY_STYLE_SEPARATED") = COMMODITY_STYLE_SEPARATED;
scope().attr("COMMODITY_STYLE_DECIMAL_COMMA") = COMMODITY_STYLE_DECIMAL_COMMA;
+ scope().attr("COMMODITY_STYLE_TIME_COLON") = COMMODITY_STYLE_TIME_COLON;
scope().attr("COMMODITY_STYLE_THOUSANDS") = COMMODITY_STYLE_THOUSANDS;
scope().attr("COMMODITY_NOMARKET") = COMMODITY_NOMARKET;
scope().attr("COMMODITY_BUILTIN") = COMMODITY_BUILTIN;
diff --git a/src/pyinterp.cc b/src/pyinterp.cc
index e15ff503..12690854 100644
--- a/src/pyinterp.cc
+++ b/src/pyinterp.cc
@@ -34,6 +34,7 @@
#include "pyinterp.h"
#include "pyutils.h"
#include "account.h"
+#include "report.h"
#include "xact.h"
#include "post.h"
@@ -76,6 +77,10 @@ void initialize_for_python()
export_xact();
export_session();
export_journal();
+
+ python_session.reset(new ledger::python_interpreter_t);
+ shared_ptr<session_t> session_ptr = python_session;
+ scope_t::default_scope = new report_t(*session_ptr);
}
struct python_run