diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | Makefile.in | 4 | ||||
-rwxr-xr-x | configure | 182 | ||||
-rw-r--r-- | configure.in | 29 | ||||
-rw-r--r-- | src/py_amount.cc | 12 | ||||
-rw-r--r-- | src/pyledger.cc | 5 |
6 files changed, 192 insertions, 44 deletions
diff --git a/Makefile.am b/Makefile.am index 434d1278..af6a0cb0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,7 +81,7 @@ if USE_PCH libledger_la_CXXFLAGS = $(WARNFLAGS) nodist_libledger_la_SOURCES = system.hh.gch -BUILT_SOURCES += system.hh.gch system.hh +BUILT_SOURCES += system.hh.gch CLEANFILES += system.hh.gch system.hh $(top_builddir)/system.hh.gch: $(srcdir)/src/system.hh acconf.h @@ -245,8 +245,6 @@ doxygen-docs: $(top_builddir)/Doxyfile.gen ###################################################################### -all: check - check-syntax: g++ -I. -Itests $(CPPFLAGS) $(UnitTests_CXXFLAGS) \ -o /dev/null -S $(CHK_SOURCES) diff --git a/Makefile.in b/Makefile.in index 709b77e0..7f3e2cb0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,7 +45,7 @@ host_triplet = @host@ @DEBUG_TRUE@am__append_8 = -DFULL_DEBUG @HAVE_BOOST_PYTHON_TRUE@am__append_9 = -DUSE_BOOST_PYTHON=1 @HAVE_BOOST_PYTHON_TRUE@am__append_10 = src/pyinterp.cc -@USE_PCH_TRUE@am__append_11 = system.hh.gch system.hh +@USE_PCH_TRUE@am__append_11 = system.hh.gch @USE_PCH_TRUE@am__append_12 = system.hh.gch system.hh bin_PROGRAMS = ledger$(EXEEXT) @HAVE_BOOST_PYTHON_TRUE@am__append_13 = libpyledger.la @@ -1787,8 +1787,6 @@ doxygen-docs: $(top_builddir)/Doxyfile.gen ###################################################################### -all: check - check-syntax: g++ -I. -Itests $(CPPFLAGS) $(UnitTests_CXXFLAGS) \ -o /dev/null -S $(CHK_SOURCES) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for ledger 3.0-git-optimal_optional. +# Generated by GNU Autoconf 2.61 for ledger 3.0-git. # # Report bugs to <johnw@newartisans.com>. # @@ -728,8 +728,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='ledger' PACKAGE_TARNAME='ledger' -PACKAGE_VERSION='3.0-git-optimal_optional' -PACKAGE_STRING='ledger 3.0-git-optimal_optional' +PACKAGE_VERSION='3.0-git' +PACKAGE_STRING='ledger 3.0-git' PACKAGE_BUGREPORT='johnw@newartisans.com' ac_unique_file="ledger" @@ -898,6 +898,8 @@ pyexecdir pkgpyexecdir HAVE_BOOST_PYTHON_TRUE HAVE_BOOST_PYTHON_FALSE +HAVE_CPPUNIT_TRUE +HAVE_CPPUNIT_FALSE DEBUG_TRUE DEBUG_FALSE USE_PCH_TRUE @@ -1424,7 +1426,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ledger 3.0-git-optimal_optional to adapt to many kinds of systems. +\`configure' configures ledger 3.0-git to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1494,7 +1496,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ledger 3.0-git-optimal_optional:";; + short | recursive ) echo "Configuration of ledger 3.0-git:";; esac cat <<\_ACEOF @@ -1605,7 +1607,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ledger configure 3.0-git-optimal_optional +ledger configure 3.0-git generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1619,7 +1621,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ledger $as_me 3.0-git-optimal_optional, which was +It was created by ledger $as_me 3.0-git, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -2310,7 +2312,7 @@ fi # Define the identity of the package. PACKAGE='ledger' - VERSION='3.0-git-optimal_optional' + VERSION='3.0-git' cat >>confdefs.h <<_ACEOF @@ -4851,7 +4853,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 4854 "configure"' > conftest.$ac_ext + echo '#line 4856 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7110,11 +7112,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7113: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7115: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7117: \$? = $ac_status" >&5 + echo "$as_me:7119: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7378,11 +7380,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7381: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7383: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7385: \$? = $ac_status" >&5 + echo "$as_me:7387: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7482,11 +7484,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7485: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7487: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7489: \$? = $ac_status" >&5 + echo "$as_me:7491: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9790,7 +9792,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9793 "configure" +#line 9795 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9890,7 +9892,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9893 "configure" +#line 9895 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12226,11 +12228,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12229: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12231: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12233: \$? = $ac_status" >&5 + echo "$as_me:12235: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -12330,11 +12332,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12333: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12335: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12337: \$? = $ac_status" >&5 + echo "$as_me:12339: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13900,11 +13902,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13903: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13905: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13907: \$? = $ac_status" >&5 + echo "$as_me:13909: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14004,11 +14006,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14007: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14009: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14011: \$? = $ac_status" >&5 + echo "$as_me:14013: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16202,11 +16204,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16205: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16207: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16209: \$? = $ac_status" >&5 + echo "$as_me:16211: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16470,11 +16472,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16473: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16475: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16477: \$? = $ac_status" >&5 + echo "$as_me:16479: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16574,11 +16576,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16577: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16579: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16581: \$? = $ac_status" >&5 + echo "$as_me:16583: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20536,6 +20538,102 @@ fi fi +# check for CppUnit +{ echo "$as_me:$LINENO: checking if cppunit is available" >&5 +echo $ECHO_N "checking if cppunit is available... $ECHO_C" >&6; } +if test "${cppunit_avail+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cppunit_save_libs=$LIBS + LIBS="-lcppunit $LIBS" + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <cppunit/CompilerOutputter.h> + #include <cppunit/TestResult.h> + #include <cppunit/TestResultCollector.h> + #include <cppunit/TestRunner.h> + #include <cppunit/TextTestProgressListener.h> + #include <cppunit/BriefTestProgressListener.h> + #include <cppunit/XmlOutputter.h> + #include <cppunit/extensions/TestFactoryRegistry.h> +int +main () +{ +CPPUNIT_NS::TestResult controller; + CPPUNIT_NS::TestResultCollector result; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + cppunit_avail=true +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cppunit_avail=false +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + LIBS=$cppunit_save_libs +fi +{ echo "$as_me:$LINENO: result: $cppunit_avail" >&5 +echo "${ECHO_T}$cppunit_avail" >&6; } + +if test x$cppunit_avail = xtrue ; then + if true; then + HAVE_CPPUNIT_TRUE= + HAVE_CPPUNIT_FALSE='#' +else + HAVE_CPPUNIT_TRUE='#' + HAVE_CPPUNIT_FALSE= +fi + +else + if false; then + HAVE_CPPUNIT_TRUE= + HAVE_CPPUNIT_FALSE='#' +else + HAVE_CPPUNIT_TRUE='#' + HAVE_CPPUNIT_FALSE= +fi + +fi + # Check for options # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then @@ -21731,6 +21829,20 @@ echo "$as_me: error: conditional \"HAVE_BOOST_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${HAVE_CPPUNIT_TRUE}" && test -z "${HAVE_CPPUNIT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPPUNIT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_CPPUNIT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_CPPUNIT_TRUE}" && test -z "${HAVE_CPPUNIT_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_CPPUNIT\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_CPPUNIT\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${DEBUG_TRUE}" && test -z "${DEBUG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"DEBUG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -22045,7 +22157,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ledger $as_me 3.0-git-optimal_optional, which was +This file was extended by ledger $as_me 3.0-git, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22098,7 +22210,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -ledger config.status 3.0-git-optimal_optional +ledger config.status 3.0-git configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -22446,6 +22558,8 @@ pyexecdir!$pyexecdir$ac_delim pkgpyexecdir!$pkgpyexecdir$ac_delim HAVE_BOOST_PYTHON_TRUE!$HAVE_BOOST_PYTHON_TRUE$ac_delim HAVE_BOOST_PYTHON_FALSE!$HAVE_BOOST_PYTHON_FALSE$ac_delim +HAVE_CPPUNIT_TRUE!$HAVE_CPPUNIT_TRUE$ac_delim +HAVE_CPPUNIT_FALSE!$HAVE_CPPUNIT_FALSE$ac_delim DEBUG_TRUE!$DEBUG_TRUE$ac_delim DEBUG_FALSE!$DEBUG_FALSE$ac_delim USE_PCH_TRUE!$USE_PCH_TRUE$ac_delim @@ -22454,7 +22568,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 37; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 39; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.in b/configure.in index f8e0b956..20798aaa 100644 --- a/configure.in +++ b/configure.in @@ -347,6 +347,35 @@ else AM_CONDITIONAL(HAVE_BOOST_PYTHON, false) fi +# check for CppUnit +AC_CACHE_CHECK( + [if cppunit is available], + [cppunit_avail], + [cppunit_save_libs=$LIBS + LIBS="-lcppunit $LIBS" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [#include <cppunit/CompilerOutputter.h> + #include <cppunit/TestResult.h> + #include <cppunit/TestResultCollector.h> + #include <cppunit/TestRunner.h> + #include <cppunit/TextTestProgressListener.h> + #include <cppunit/BriefTestProgressListener.h> + #include <cppunit/XmlOutputter.h> + #include <cppunit/extensions/TestFactoryRegistry.h>], + [CPPUNIT_NS::TestResult controller; + CPPUNIT_NS::TestResultCollector result;], + [cppunit_avail=true], + [cppunit_avail=false]) + AC_LANG_POP + LIBS=$cppunit_save_libs]) + +if [test x$cppunit_avail = xtrue ]; then + AM_CONDITIONAL(HAVE_CPPUNIT, true) +else + AM_CONDITIONAL(HAVE_CPPUNIT, false) +fi + # Check for options AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging], diff --git a/src/py_amount.cc b/src/py_amount.cc index c2d1291d..f152ceb1 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -22,6 +22,7 @@ amount_t py_round_2(amount_t& amount) { return amount.round(); } +#if 0 struct commodity_updater_wrap : public commodity_base_t::updater_t { PyObject * self; @@ -40,6 +41,7 @@ commodity_t * py_find_commodity(const string& symbol) { return commodity_t::find(symbol); } +#endif #define EXC_TRANSLATOR(type) \ void exc_translate_ ## type(const type& err) { \ @@ -211,23 +213,29 @@ void export_amount() .def("annotate_commodity", &amount_t::annotate_commodity) .def("strip_annotations", &amount_t::strip_annotations) +#if 0 .def("price", &amount_t::price) .def("date", &amount_t::date) .def("tag", &amount_t::tag) +#endif .def("parse", py_parse_1) .def("parse", py_parse_2) +#if 0 .def("parse_conversion", &amount_t::parse_conversion) .staticmethod("parse_conversion") +#endif .def("valid", &amount_t::valid) ; +#if 0 class_< commodity_base_t::updater_t, commodity_updater_wrap, boost::noncopyable > ("updater") ; +#endif scope().attr("COMMODITY_STYLE_DEFAULTS") = COMMODITY_STYLE_DEFAULTS; scope().attr("COMMODITY_STYLE_SUFFIXED") = COMMODITY_STYLE_SUFFIXED; @@ -237,8 +245,8 @@ void export_amount() scope().attr("COMMODITY_STYLE_NOMARKET") = COMMODITY_STYLE_NOMARKET; scope().attr("COMMODITY_STYLE_BUILTIN") = COMMODITY_STYLE_BUILTIN; - class_< commodity_t > ("commodity") #if 0 + class_< commodity_t > ("commodity") .add_property("symbol", &commodity_t::symbol) .add_property("name", &commodity_t::name, &commodity_t::set_name) @@ -272,8 +280,8 @@ void export_amount() .def("value", &commodity_t::value) .def("valid", &commodity_t::valid) -#endif ; +#endif #define EXC_TRANSLATE(type) \ register_exception_translator<type>(&exc_translate_ ## type); diff --git a/src/pyledger.cc b/src/pyledger.cc index b7654e5d..688374a6 100644 --- a/src/pyledger.cc +++ b/src/pyledger.cc @@ -46,8 +46,9 @@ void shutdown_for_python() } +ledger::session_t python_session; + BOOST_PYTHON_MODULE(ledger) { - ledger::initialize(); - ledger::initialize_for_python(); + ledger::set_session_context(&python_session); } |