Most things are building, but not the Python code

This commit is contained in:
John Wiegley 2008-05-12 05:10:08 -04:00
parent 6f345c6578
commit 2ead28363a
4 changed files with 51 additions and 77 deletions

View file

@ -20,6 +20,15 @@ libamounts_la_SOURCES = \
value.cc \ value.cc \
times.cc \ times.cc \
utils.cc utils.cc
if HAVE_EXPAT
libamounts_la_CPPFLAGS += -DHAVE_EXPAT=1
endif
if HAVE_XMLPARSE
libamounts_la_CPPFLAGS += -DHAVE_XMLPARSE=1
endif
if HAVE_LIBOFX
libamounts_la_CPPFLAGS += -DHAVE_LIBOFX=1
endif
if HAVE_BOOST_PYTHON if HAVE_BOOST_PYTHON
libamounts_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1 libamounts_la_CPPFLAGS += -DUSE_BOOST_PYTHON=1
endif endif
@ -27,7 +36,7 @@ if DEBUG
libamounts_la_CPPFLAGS += -DDEBUG_MODE libamounts_la_CPPFLAGS += -DDEBUG_MODE
endif endif
libledger_la_CPPFLAGS = libledger_la_CPPFLAGS = $(libamounts_la_CPPFLAGS)
libledger_la_SOURCES = \ libledger_la_SOURCES = \
binary.cc \ binary.cc \
config.cc \ config.cc \
@ -49,20 +58,15 @@ libledger_la_SOURCES = \
xml.cc xml.cc
# quotes.cc this is currently not being included # quotes.cc this is currently not being included
if HAVE_EXPAT if HAVE_EXPAT
libledger_la_CPPFLAGS += -DHAVE_EXPAT=1
libledger_la_SOURCES += gnucash.cc libledger_la_SOURCES += gnucash.cc
endif endif
if HAVE_XMLPARSE if HAVE_XMLPARSE
libledger_la_CPPFLAGS += -DHAVE_XMLPARSE=1
libledger_la_SOURCES += gnucash.cc libledger_la_SOURCES += gnucash.cc
endif endif
if HAVE_LIBOFX if HAVE_LIBOFX
libledger_la_CPPFLAGS += -DHAVE_LIBOFX=1
libledger_la_SOURCES += ofx.cc libledger_la_SOURCES += ofx.cc
endif endif
if DEBUG
libledger_la_CPPFLAGS += -DDEBUG_MODE
endif
libledger_la_LDFLAGS = -release 2.6.0.90 libledger_la_LDFLAGS = -release 2.6.0.90
pkginclude_HEADERS = \ pkginclude_HEADERS = \
@ -104,39 +108,28 @@ nodist_libledger_la_SOURCES = system.hh.gch
BUILT_SOURCES += system.hh.gch BUILT_SOURCES += system.hh.gch
CLEANFILES += system.hh.gch system.hh CLEANFILES += system.hh.gch system.hh
$(top_builddir)/system.hh.gch: $(srcdir)/src/utility/system.hh acconf.h $(top_builddir)/system.hh.gch: $(srcdir)/system.hh $(top_builddir)/acconf.h
echo "#include \"src/utility/system.hh\"" > $(top_builddir)/system.hh echo "#include \"$(srcdir)/system.hh\"" > $(top_builddir)/system.hh
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(libledger_la_CPPFLAGS) \ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-o $@ $(srcdir)/src/utility/system.hh $(libledger_la_CPPFLAGS) \
$(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
-g -o $@ $(srcdir)/system.hh
endif endif
###################################################################### ######################################################################
bin_PROGRAMS = ledger bin_PROGRAMS = ledger
ledger_CPPFLAGS =
ledger_SOURCES = main.cc
ledger_LDADD = $(LIBOBJS) libamounts.la libledger.la
if HAVE_EXPAT
ledger_CPPFLAGS += -DHAVE_EXPAT=1
endif
if HAVE_XMLPARSE
ledger_CPPFLAGS += -DHAVE_XMLPARSE=1
endif
if HAVE_LIBOFX
ledger_CPPFLAGS += -DHAVE_LIBOFX=1
endif
if DEBUG
ledger_CPPFLAGS += -DDEBUG_MODE
endif
ledger_LDFLAGS = -static # for the sake of command-line speed
info_TEXINFOS = ledger.texi ledger_CPPFLAGS = $(libledger_la_CPPFLAGS)
ledger_SOURCES = main.cc
ledger_LDADD = $(LIBOBJS) libamounts.la libledger.la
ledger_LDFLAGS = -static # for the sake of command-line speed
###################################################################### info_TEXINFOS = ledger.texi
dist_lisp_LISP = ledger.el timeclock.el dist_lisp_LISP = ledger.el timeclock.el
DISTCLEANFILES = ledger.elc timeclock.elc DISTCLEANFILES = ledger.elc timeclock.elc
###################################################################### ######################################################################
@ -152,13 +145,13 @@ clean-local:
PYLIBS = amounts gmp PYLIBS = amounts gmp
amounts.so: amounts.cc libamounts.la amounts.so: amounts.cc libamounts.la
CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \
LDFLAGS="$(LDFLAGS) -L. -L.libs" \ LDFLAGS="$(LDFLAGS) -L. -L.libs" \
PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
python $(srcdir)/setup.py build --build-lib=. python $(srcdir)/setup.py build --build-lib=.
install-exec-hook: install-exec-hook:
CFLAGS="$(CPPFLAGS) -I$(srcdir) $(libamounts_la_CPPFLAGS)" \ CFLAGS="$(CPPFLAGS) $(DEFAULT_INCLUDES) $(libamounts_la_CPPFLAGS)" \
LDFLAGS="$(LDFLAGS) -L. -L.libs" \ LDFLAGS="$(LDFLAGS) -L. -L.libs" \
PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \ PYLIBS="$(PYLIBS)" SRCDIR="$(srcdir)" \
python $(srcdir)/setup.py install --prefix=$(prefix) python $(srcdir)/setup.py install --prefix=$(prefix)

13
acprep
View file

@ -57,7 +57,7 @@ LDFLAGS="$LIBDIRS"
LOCAL=false LOCAL=false
# Warning flags # Warning flags
CXXFLAGS="$CXXFLAGS -Wall -ansi" CXXFLAGS="$CXXFLAGS -Wall -ansi -Winvalid-pch"
#CXXFLAGS="$CXXFLAGS -Wextra" #CXXFLAGS="$CXXFLAGS -Wextra"
#CXXFLAGS="$CXXFLAGS -Weffc++" #CXXFLAGS="$CXXFLAGS -Weffc++"
#CXXFLAGS="$CXXFLAGS -Wcast-align" #CXXFLAGS="$CXXFLAGS -Wcast-align"
@ -78,7 +78,10 @@ CXXFLAGS="$CXXFLAGS -Wall -ansi"
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
--devel) --devel)
SWITCHES="$SWITCHES --disable-shared --enable-pch" #SWITCHES="$SWITCHES --disable-shared --enable-pch"
SWITCHES="$SWITCHES --disable-shared"
CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING=1"
CPPFLAGS="$CPPFLAGS -DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE=1"
;; ;;
--debug) --debug)
@ -127,13 +130,15 @@ if [ "$LOCAL" = "false" -a -d "$HOME/Products" ]; then
if [ -x version ]; then if [ -x version ]; then
version="-$(./version)" version="-$(./version)"
fi fi
projdir="$HOME/Products/$(basename $HERE)$version" projdir="$HOME/Products/$(basename $HERE)"
rm -fr ${projdir}*
projdir="$projdir$version"
if [ ! -d "$projdir" ]; then if [ ! -d "$projdir" ]; then
mkdir -p "$projdir" mkdir -p "$projdir"
fi fi
cd "$projdir" || (echo "Cannot change to $projdir"; exit 1) cd "$projdir" || (echo "Cannot change to $projdir"; exit 1)
fi fi
"$HERE/configure" --srcdir="$HERE" \ "$HERE/configure" --srcdir="$HERE" CXX="$CXX" \
CPPFLAGS="$CPPFLAGS" CXXFLAGS="$CXXFLAGS $local_cxxflags" \ CPPFLAGS="$CPPFLAGS" CXXFLAGS="$CXXFLAGS $local_cxxflags" \
LDFLAGS="$LDFLAGS" LIBS="$LIBS" $SWITCHES "$@" LDFLAGS="$LDFLAGS" LIBS="$LIBS" $SWITCHES "$@"

View file

@ -15,6 +15,5 @@ setup(name = "Ledger",
url = "http://www.newartisans.com/software/ledger.html", url = "http://www.newartisans.com/software/ledger.html",
ext_modules = [ ext_modules = [
Extension("ledger", Extension("ledger",
[os.path.join(os.environ['SRCDIR'], [os.path.join(os.environ['SRCDIR'], "pyledger.cc")],
"src", "python", "pyledger.cc")],
define_macros = defines, libraries = libs)]) define_macros = defines, libraries = libs)])

View file

@ -281,6 +281,8 @@ bool parse_transactions(std::istream& in,
const string& kind, const string& kind,
unsigned long beg_pos) unsigned long beg_pos)
{ {
TRACE_START(entry_xacts, 1, "Time spent parsing transactions:");
static char line[MAX_LINE + 1]; static char line[MAX_LINE + 1];
bool added = false; bool added = false;
@ -302,29 +304,20 @@ bool parse_transactions(std::istream& in,
} }
} }
TRACE_STOP(entry_xacts, 1);
return added; return added;
} }
#if 0
namespace {
TIMER_DEF(parsing_total, "total parsing time");
TIMER_DEF(entry_xacts, "parsing transactions");
TIMER_DEF(entry_details, "parsing entry details");
TIMER_DEF(entry_date, "parsing entry date");
}
#endif
entry_t * parse_entry(std::istream& in, char * line, account_t * master, entry_t * parse_entry(std::istream& in, char * line, account_t * master,
textual_parser_t& parser, unsigned long& pos) textual_parser_t& parser, unsigned long& pos)
{ {
TRACE_START(entry_text, 1, "Time spent preparing entry text:");
std::auto_ptr<entry_t> curr(new entry_t); std::auto_ptr<entry_t> curr(new entry_t);
// Parse the date // Parse the date
#if 0
TIMER_START(entry_date);
#endif
char * next = next_element(line); char * next = next_element(line);
if (char * p = std::strchr(line, '=')) { if (char * p = std::strchr(line, '=')) {
@ -333,16 +326,8 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
} }
curr->_date = parse_datetime(line); curr->_date = parse_datetime(line);
#if 0
TIMER_STOP(entry_date);
#endif
// Parse the optional cleared flag: * // Parse the optional cleared flag: *
#if 0
TIMER_START(entry_details);
#endif
transaction_t::state_t state = transaction_t::UNCLEARED; transaction_t::state_t state = transaction_t::UNCLEARED;
if (next) { if (next) {
switch (*next) { switch (*next) {
@ -371,15 +356,11 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
curr->payee = next ? next : "<Unspecified payee>"; curr->payee = next ? next : "<Unspecified payee>";
#if 0 TRACE_STOP(entry_text, 1);
TIMER_STOP(entry_details);
#endif
// Parse all of the transactions associated with this entry // Parse all of the transactions associated with this entry
#if 0 TRACE_START(entry_details, 1, "Time spent parsing entry details:");
TIMER_START(entry_xacts);
#endif
unsigned long end_pos; unsigned long end_pos;
unsigned long beg_line = linenum; unsigned long beg_line = linenum;
@ -418,9 +399,7 @@ entry_t * parse_entry(std::istream& in, char * line, account_t * master,
break; break;
} }
#if 0 TRACE_STOP(entry_details, 1);
TIMER_STOP(entry_xacts);
#endif
return curr.release(); return curr.release();
} }
@ -544,15 +523,13 @@ unsigned int textual_parser_t::parse(std::istream& in,
account_t * master, account_t * master,
const path * original_file) const path * original_file)
{ {
TRACE_START(parsing_total, 1, "Total time spent parsing text:");
static bool added_auto_entry_hook = false; static bool added_auto_entry_hook = false;
static char line[MAX_LINE + 1]; static char line[MAX_LINE + 1];
unsigned int count = 0; unsigned int count = 0;
unsigned int errors = 0; unsigned int errors = 0;
#if 0
TIMER_START(parsing_total);
#endif
std::list<account_t *> account_stack; std::list<account_t *> account_stack;
auto_entry_finalizer_t auto_entry_finalizer(journal); auto_entry_finalizer_t auto_entry_finalizer(journal);
@ -827,6 +804,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
default: { default: {
unsigned long pos = beg_pos; unsigned long pos = beg_pos;
TRACE_START(entries, 1, "Time spent handling entries:");
if (entry_t * entry = if (entry_t * entry =
parse_entry(in, line, account_stack.front(), *this, pos)) { parse_entry(in, line, account_stack.front(), *this, pos)) {
if (journal->add_entry(entry)) { if (journal->add_entry(entry)) {
@ -844,6 +822,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
throw new parse_error("Failed to parse entry"); throw new parse_error("Failed to parse entry");
} }
end_pos = pos; end_pos = pos;
TRACE_STOP(entries, 1);
break; break;
} }
} }
@ -882,9 +861,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
if (errors > 0) if (errors > 0)
throw (int)errors; throw (int)errors;
#if 0 TRACE_STOP(parsing_total, 1);
TIMER_STOP(parsing_total);
#endif
return count; return count;
} }