summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-04 09:53:10 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:37 -0400
commit93096b77f3c03b826c8857e4817ccd1bca52f9ee (patch)
tree403a0ddfc0241b6b959d7b9c4eefabd77832e166
parent0214a136c2b21b3cff3dfc94095d2badc3136b1b (diff)
downloadfork-ledger-93096b77f3c03b826c8857e4817ccd1bca52f9ee.tar.gz
fork-ledger-93096b77f3c03b826c8857e4817ccd1bca52f9ee.tar.bz2
fork-ledger-93096b77f3c03b826c8857e4817ccd1bca52f9ee.zip
Got PyUnitTests functioning again.
-rw-r--r--Makefile.am14
-rw-r--r--Makefile.in34
-rw-r--r--src/py_amount.cc4
-rw-r--r--src/pyledger.cc6
4 files changed, 41 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am
index cddd1257..46d27666 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -168,7 +168,7 @@ CLEANFILES += ledger.so
clean-local:
rm -fr build
-ledger_so_SOURCES = src/pyledger.cc
+ledger_so_SOURCES = src/pyledger.cc src/py_amount.cc
ledger_so_DEPENDENCIES = libledger.la gdtoa/libgdtoa.la libpyledger.la
PYLIBS = pyledger ledger gdtoa gmp boost_date_time \
@@ -184,19 +184,19 @@ if HAVE_LIBOFX
PYLIBS += ofx
endif
-ledger.so: src/pyledger.cc \
- libledger.la gdtoa/libgdtoa.la libpyledger.la
- SRCDIR="$(srcdir)" \
+PYLEDGER_SRC = src/pyledger.cc \
+ src/py_amount.cc
+
+ledger.so: $(ledger_so_SOURCES) $(ledger_so_DEPENDENCIES)
CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
- PYLIBS="$(PYLIBS)" \
+ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
python $(srcdir)/setup.py build --build-lib=.
install-exec-hook:
- SRCDIR="$(srcdir)" \
CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
- PYLIBS="$(PYLIBS)" \
+ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
python $(srcdir)/setup.py install --prefix=$(prefix)
endif
diff --git a/Makefile.in b/Makefile.in
index c937d66f..8175b693 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -147,8 +147,9 @@ ledger_DEPENDENCIES = $(LIBOBJS) libledger.la gdtoa/libgdtoa.la \
ledger_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(ledger_CXXFLAGS) $(CXXFLAGS) \
$(ledger_LDFLAGS) $(LDFLAGS) -o $@
-am__ledger_so_SOURCES_DIST = src/pyledger.cc
-@HAVE_BOOST_PYTHON_TRUE@am_ledger_so_OBJECTS = pyledger.$(OBJEXT)
+am__ledger_so_SOURCES_DIST = src/pyledger.cc src/py_amount.cc
+@HAVE_BOOST_PYTHON_TRUE@am_ledger_so_OBJECTS = pyledger.$(OBJEXT) \
+@HAVE_BOOST_PYTHON_TRUE@ py_amount.$(OBJEXT)
ledger_so_OBJECTS = $(am_ledger_so_OBJECTS)
ledger_so_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@
@@ -424,13 +425,16 @@ info_TEXINFOS = docs/ledger.texi
######################################################################
dist_lisp_LISP = lisp/ledger.el lisp/timeclock.el
-@HAVE_BOOST_PYTHON_TRUE@ledger_so_SOURCES = src/pyledger.cc
+@HAVE_BOOST_PYTHON_TRUE@ledger_so_SOURCES = src/pyledger.cc src/py_amount.cc
@HAVE_BOOST_PYTHON_TRUE@ledger_so_DEPENDENCIES = libledger.la gdtoa/libgdtoa.la libpyledger.la
@HAVE_BOOST_PYTHON_TRUE@PYLIBS = pyledger ledger gdtoa gmp \
@HAVE_BOOST_PYTHON_TRUE@ boost_date_time boost_signals \
@HAVE_BOOST_PYTHON_TRUE@ boost_filesystem boost_regex \
@HAVE_BOOST_PYTHON_TRUE@ boost_python $(am__append_15) \
@HAVE_BOOST_PYTHON_TRUE@ $(am__append_16) $(am__append_17)
+@HAVE_BOOST_PYTHON_TRUE@PYLEDGER_SRC = src/pyledger.cc \
+@HAVE_BOOST_PYTHON_TRUE@ src/py_amount.cc
+
nodist_UnitTests_SOURCES = tests/UnitTests.cc \
\
tests/numerics/BasicAmount.cc \
@@ -624,6 +628,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-xmlparse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libledger_la-xpath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libpyledger_la-py_amount.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/py_amount.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pyledger.Po@am__quote@
.cc.o:
@@ -955,6 +960,20 @@ pyledger.obj: src/pyledger.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pyledger.obj `if test -f 'src/pyledger.cc'; then $(CYGPATH_W) 'src/pyledger.cc'; else $(CYGPATH_W) '$(srcdir)/src/pyledger.cc'; fi`
+py_amount.o: src/py_amount.cc
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT py_amount.o -MD -MP -MF $(DEPDIR)/py_amount.Tpo -c -o py_amount.o `test -f 'src/py_amount.cc' || echo '$(srcdir)/'`src/py_amount.cc
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/py_amount.Tpo $(DEPDIR)/py_amount.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/py_amount.cc' object='py_amount.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o py_amount.o `test -f 'src/py_amount.cc' || echo '$(srcdir)/'`src/py_amount.cc
+
+py_amount.obj: src/py_amount.cc
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT py_amount.obj -MD -MP -MF $(DEPDIR)/py_amount.Tpo -c -o py_amount.obj `if test -f 'src/py_amount.cc'; then $(CYGPATH_W) 'src/py_amount.cc'; else $(CYGPATH_W) '$(srcdir)/src/py_amount.cc'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/py_amount.Tpo $(DEPDIR)/py_amount.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/py_amount.cc' object='py_amount.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o py_amount.obj `if test -f 'src/py_amount.cc'; then $(CYGPATH_W) 'src/py_amount.cc'; else $(CYGPATH_W) '$(srcdir)/src/py_amount.cc'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1754,19 +1773,16 @@ dist-hook:
@HAVE_BOOST_PYTHON_TRUE@clean-local:
@HAVE_BOOST_PYTHON_TRUE@ rm -fr build
-@HAVE_BOOST_PYTHON_TRUE@ledger.so: src/pyledger.cc \
-@HAVE_BOOST_PYTHON_TRUE@ libledger.la gdtoa/libgdtoa.la libpyledger.la
-@HAVE_BOOST_PYTHON_TRUE@ SRCDIR="$(srcdir)" \
+@HAVE_BOOST_PYTHON_TRUE@ledger.so: $(ledger_so_SOURCES) $(ledger_so_DEPENDENCIES)
@HAVE_BOOST_PYTHON_TRUE@ CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
@HAVE_BOOST_PYTHON_TRUE@ LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
-@HAVE_BOOST_PYTHON_TRUE@ PYLIBS="$(PYLIBS)" \
+@HAVE_BOOST_PYTHON_TRUE@ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
@HAVE_BOOST_PYTHON_TRUE@ python $(srcdir)/setup.py build --build-lib=.
@HAVE_BOOST_PYTHON_TRUE@install-exec-hook:
-@HAVE_BOOST_PYTHON_TRUE@ SRCDIR="$(srcdir)" \
@HAVE_BOOST_PYTHON_TRUE@ CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libledger_la_CPPFLAGS)" \
@HAVE_BOOST_PYTHON_TRUE@ LDFLAGS="$(LDFLAGS) -L. -L.libs -Lgdtoa -Lgdtoa/.libs" \
-@HAVE_BOOST_PYTHON_TRUE@ PYLIBS="$(PYLIBS)" \
+@HAVE_BOOST_PYTHON_TRUE@ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
@HAVE_BOOST_PYTHON_TRUE@ python $(srcdir)/setup.py install --prefix=$(prefix)
PyUnitTests: $(srcdir)/tests/python/PyUnitTests.py
diff --git a/src/py_amount.cc b/src/py_amount.cc
index c1dd7649..61e3e4b5 100644
--- a/src/py_amount.cc
+++ b/src/py_amount.cc
@@ -34,11 +34,14 @@ void export_amount()
scope().attr("AMOUNT_PARSE_NO_REDUCE") = AMOUNT_PARSE_NO_REDUCE;
class_< amount_t > ("amount")
+#if 0
.def("initialize", &amount_t::initialize)
.staticmethod("initialize")
.def("shutdown", &amount_t::shutdown)
.staticmethod("shutdown")
+#endif
+#if 0
.add_static_property("keep_base", &amount_t::keep_base)
.add_static_property("keep_price", &amount_t::keep_price)
@@ -46,6 +49,7 @@ void export_amount()
.add_static_property("keep_tag", &amount_t::keep_tag)
.add_static_property("full_strings", &amount_t::full_strings)
+#endif
.def(init<double>())
.def(init<long>())
diff --git a/src/pyledger.cc b/src/pyledger.cc
index 08e6dbd1..1fe5708a 100644
--- a/src/pyledger.cc
+++ b/src/pyledger.cc
@@ -37,8 +37,12 @@ void initialize_for_python()
ledger::session_t python_session;
+void hello() {
+ std::cout << "Hello, world!" << std::endl;
+}
+
BOOST_PYTHON_MODULE(ledger)
{
- ledger::initialize_for_python();
ledger::set_session_context(&python_session);
+ ledger::initialize_for_python();
}