Merge branch 'next'
This commit is contained in:
commit
be91f38ab4
33 changed files with 241 additions and 138 deletions
72
.gitignore
vendored
72
.gitignore
vendored
|
|
@ -1,58 +1,38 @@
|
|||
.timestamp
|
||||
*.[oa]
|
||||
*.backup
|
||||
*.elc
|
||||
*.l[oa]
|
||||
*.pyc
|
||||
*~
|
||||
.timestamp
|
||||
/*.tar.bz2
|
||||
/*.tar.gz
|
||||
/.deps/
|
||||
/.libs/
|
||||
/ABOUT-NLS
|
||||
/BaselineTests
|
||||
/Doxyfile.gen
|
||||
/Makefile
|
||||
/Makefile.am
|
||||
/Makefile.in
|
||||
/PyUnitTests
|
||||
/RegressionTests
|
||||
/TAGS
|
||||
/acconf.h.in
|
||||
/aclocal.m4
|
||||
/autogen.sh
|
||||
/autom4te.cache/
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.rpath
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.ac
|
||||
/depcomp
|
||||
/elisp-comp
|
||||
/install-sh
|
||||
/intl/
|
||||
/ledger
|
||||
/ltmain.sh
|
||||
/m4/
|
||||
/make.sh
|
||||
/missing
|
||||
/po/
|
||||
/py-compile
|
||||
/src/system.hh.gch
|
||||
/texinfo.tex
|
||||
/version.m4
|
||||
|
||||
*.[oa]
|
||||
*.l[oa]
|
||||
/*.tar.bz2
|
||||
/*.tar.gz
|
||||
/.deps/
|
||||
/.libs/
|
||||
/BaselineTests
|
||||
/Doxyfile.gen
|
||||
/Makefile
|
||||
/PyUnitTests
|
||||
/RegressionTests
|
||||
/config.h
|
||||
/config.log
|
||||
/config.status
|
||||
/data_tests
|
||||
/doc/.dirstamp
|
||||
/doc/html/
|
||||
/doc/latex/
|
||||
/doc/ledger.info
|
||||
/doc/refman.pdf
|
||||
/doc/report/
|
||||
/depcomp
|
||||
/doc/*.aux
|
||||
/doc/*.cp
|
||||
/doc/*.fn
|
||||
|
|
@ -63,15 +43,33 @@
|
|||
/doc/*.toc
|
||||
/doc/*.tp
|
||||
/doc/*.vr
|
||||
/doc/.dirstamp
|
||||
/doc/html/
|
||||
/doc/latex/
|
||||
/doc/ledger.info
|
||||
/doc/refman.pdf
|
||||
/doc/report/
|
||||
/elisp-comp
|
||||
/expr_tests
|
||||
/install-sh
|
||||
/intl/
|
||||
/ledger
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/m4/
|
||||
/make.sh
|
||||
/math_tests
|
||||
/missing
|
||||
/mkinstalldirs
|
||||
/po/
|
||||
/py-compile
|
||||
/report_tests
|
||||
/shave
|
||||
/shave-libtool
|
||||
/src/system.hh.gch
|
||||
/stamp-h1
|
||||
/test/python/
|
||||
/texinfo.tex
|
||||
/tmpcvs*/
|
||||
/tmpwrk*/
|
||||
/util_tests
|
||||
/mkinstalldirs
|
||||
|
|
|
|||
27
acprep
27
acprep
|
|
@ -633,17 +633,13 @@ class PrepareBuild(CommandLineApp):
|
|||
|
||||
def current_version(self):
|
||||
if not self.current_ver:
|
||||
if self.git_working_tree():
|
||||
#date = self.get_stdout('git', 'log', '--format=%ci', '-1', 'HEAD')
|
||||
#date = re.sub(" [-+][0-9][0-9][0-9][0-9]$", "", date)
|
||||
#when = datetime.datetime.strptime(date, "%Y-%m-%d %H:%M:%S")
|
||||
#self.current_ver = when.strftime("%Y%m%d_%H%M%S")
|
||||
#commit = self.get_stdout('git', 'log', '--format=%h', 'HEAD^..HEAD')
|
||||
#self.current_ver += "_" + commit
|
||||
tag = self.get_stdout('git', 'describe', '--all', '--long')
|
||||
self.current_ver = re.sub('heads/', '', tag)
|
||||
else:
|
||||
self.current_ver = "no-git"
|
||||
version_m4 = open('version.m4', 'r')
|
||||
for line in version_m4.readlines():
|
||||
match = re.match('m4_define\(\[VERSION_NUMBER\], \[([0-9.]+[-abgrc0-9]*)\]\)',
|
||||
line)
|
||||
assert(match)
|
||||
self.current_ver = match.group(1)
|
||||
version_m4.close()
|
||||
return self.current_ver
|
||||
|
||||
def need_to_prepare_autotools(self):
|
||||
|
|
@ -726,13 +722,6 @@ class PrepareBuild(CommandLineApp):
|
|||
POTFILES_in.write('\n')
|
||||
POTFILES_in.close()
|
||||
|
||||
def phase_version(self, *args):
|
||||
self.log.info('Executing phase: version')
|
||||
version_m4 = open('version.m4', 'w')
|
||||
version_m4.write("m4_define([VERSION_NUMBER], [%s])\n" %
|
||||
self.current_version())
|
||||
version_m4.close()
|
||||
|
||||
def copytimes(self, src, dest):
|
||||
os.utime(dest, (os.stat(src)[ST_ATIME], os.stat(src)[ST_MTIME]))
|
||||
|
||||
|
|
@ -766,7 +755,6 @@ class PrepareBuild(CommandLineApp):
|
|||
reason = self.need_to_prepare_autotools()
|
||||
if reason:
|
||||
self.log.info('autogen.sh must be run ' + reason)
|
||||
self.phase_version()
|
||||
self.phase_autogen()
|
||||
self.phase_gettext()
|
||||
self.phase_aclocal()
|
||||
|
|
@ -1419,6 +1407,7 @@ class PrepareBuild(CommandLineApp):
|
|||
|
||||
if self.options.jobs > 1:
|
||||
make_args.append('-j%d' % self.options.jobs)
|
||||
make_args.append('JOBS=%d' % self.options.jobs)
|
||||
|
||||
self.log.debug('Configure arguments => ' + str(config_args))
|
||||
self.log.debug('Makefile arguments => ' + str(make_args))
|
||||
|
|
|
|||
47
doc/ledger.1
47
doc/ledger.1
|
|
@ -1,4 +1,4 @@
|
|||
.Dd February 2, 2010
|
||||
.Dd June 15, 2010
|
||||
.Dt ledger 1
|
||||
.Sh NAME
|
||||
.Nm ledger
|
||||
|
|
@ -53,7 +53,7 @@ Also show accounts whose total is zero.
|
|||
Rather than display a hierarchical tree, flatten the report to show subtotals
|
||||
for only accounts matching
|
||||
.Ar report-query .
|
||||
.It Fl \-no\-total
|
||||
.It Fl \-no-total
|
||||
Suppress the summary total shown at the bottom of the report (when not zero).
|
||||
.El
|
||||
.Pp
|
||||
|
|
@ -263,6 +263,7 @@ transactions they are contained in. See the manual for more information.
|
|||
.It Fl \-account Ar STR
|
||||
.It Fl \-account-width Ar INT
|
||||
.It Fl \-actual Pq Fl L
|
||||
.It Fl \-actual-dates
|
||||
.It Fl \-add-budget
|
||||
.It Fl \-amount Ar EXPR Pq Fl t
|
||||
.It Fl \-amount-data Pq Fl j
|
||||
|
|
@ -275,8 +276,11 @@ transactions they are contained in. See the manual for more information.
|
|||
.It Fl \-basis Pq Fl B
|
||||
.It Fl \-begin Ar DATE Pq Fl b
|
||||
.It Fl \-budget
|
||||
.It Fl \-budget-format Ar FMT
|
||||
.It Fl \-by-payee Pq Fl P
|
||||
.It Fl \-cache Ar FILE
|
||||
.It Fl \-cleared Pq Fl C
|
||||
.It Fl \-cleared-format Ar FMT
|
||||
.It Fl \-collapse Pq Fl n
|
||||
.It Fl \-collapse-if-zero
|
||||
.It Fl \-color
|
||||
|
|
@ -284,12 +288,16 @@ transactions they are contained in. See the manual for more information.
|
|||
.It Fl \-cost
|
||||
See
|
||||
.Fl \-basis .
|
||||
.It Fl \-count
|
||||
.It Fl \-csv-format Ar FMT
|
||||
.It Fl \-current Pq Fl c
|
||||
.It Fl \-daily
|
||||
.It Fl \-date Ar EXPR
|
||||
.It Fl \-date-format Ar DATEFMT Pq Fl y
|
||||
.It Fl \-datetime-format Ar FMT
|
||||
.It Fl \-date-width Ar INT
|
||||
.It Fl \-debug Ar STR
|
||||
.It Fl \-decimal-comma
|
||||
.It Fl \-depth Ar INT
|
||||
.It Fl \-deviation Pq Fl D
|
||||
.It Fl \-display Ar EXPR Pq Fl d
|
||||
|
|
@ -308,13 +316,25 @@ See
|
|||
See
|
||||
.Fl \-head .
|
||||
.It Fl \-flat
|
||||
.It Fl \-force-color
|
||||
.It Fl \-force-pager
|
||||
.It Fl \-forecast-while Ar EXPR
|
||||
(Also
|
||||
.Fl \-forecast
|
||||
).
|
||||
.It Fl \-forecast-years Ar INT
|
||||
.It Fl \-format Ar FMT Pq Fl F
|
||||
.It Fl \-full-help
|
||||
.It Fl \-gain Pq Fl G
|
||||
.It Fl \-generated
|
||||
.It Fl \-group-by Ar EXPR
|
||||
.It Fl \-group-title-format Ar FMT
|
||||
.It Fl \-head Ar INT
|
||||
.It Fl \-help
|
||||
.It Fl \-help-calc
|
||||
.It Fl \-help-comm
|
||||
.It Fl \-help-disp
|
||||
.It Fl \-import Ar STR
|
||||
.It Fl \-init-file Ar FILE
|
||||
.It Fl \-input-date-format Ar DATEFMT
|
||||
.It Fl \-invert
|
||||
|
|
@ -329,26 +349,37 @@ See
|
|||
.It Fl \-lots
|
||||
.It Fl \-lots-actual
|
||||
.It Fl \-market Pq Fl V
|
||||
.It Fl \-master-account Ar STR
|
||||
.It Fl \-meta Ar EXPR
|
||||
.It Fl \-meta-width Ar INT
|
||||
.It Fl \-monthly Pq Fl M
|
||||
.It Fl \-no-color
|
||||
.It Fl \-no-rounding
|
||||
.It Fl \-no-titles
|
||||
.It Fl \-no-total
|
||||
.It Fl \-now Ar DATE
|
||||
.It Fl \-only Ar EXPR
|
||||
.It Fl \-options
|
||||
.It Fl \-output Ar FILE Pq Fl o
|
||||
.It Fl \-pager Ar STR
|
||||
.It Fl \-payee
|
||||
.It Fl \-payee-width Ar INT
|
||||
.It Fl \-pending
|
||||
.It Fl \-percentage Pq Fl \%
|
||||
.It Fl \-percent Pq Fl \%
|
||||
.It Fl \-period Ar PERIOD Pq Fl p
|
||||
.It Fl \-period-sort
|
||||
.It Fl \-pivot Ar STR
|
||||
.It Fl \-plot-amount-format Ar FMT
|
||||
.It Fl \-plot-total-format Ar FMT
|
||||
.It Fl \-prepend-format Ar FMT
|
||||
.It Fl \-prepend-width Ar INT
|
||||
.It Fl \-price Pq Fl I
|
||||
.It Fl \-price-db Ar FILE
|
||||
.It Fl \-price-exp Ar STR
|
||||
See
|
||||
.Fl \-leeway .
|
||||
.It Fl \-prices-format Ar FMT
|
||||
.It Fl \-pricesdb-format Ar FMT
|
||||
.It Fl \-print-format Ar FMT
|
||||
.It Fl \-pricedb-format Ar FMT
|
||||
.It Fl \-quantity Pq Fl O
|
||||
.It Fl \-quarterly
|
||||
.It Fl \-raw
|
||||
|
|
@ -365,9 +396,6 @@ appeared in the original journal file.
|
|||
.It Fl \-revalued-total Ar EXPR
|
||||
.It Fl \-seed Ar INT
|
||||
.It Fl \-script
|
||||
.It Fl \-set-account Ar EXPR
|
||||
.It Fl \-set-payee Ar EXPR
|
||||
.It Fl \-set-price Ar EXPR
|
||||
.It Fl \-sort Ar EXPR Pq Fl S
|
||||
.It Fl \-sort-all
|
||||
.It Fl \-sort-xacts
|
||||
|
|
@ -382,6 +410,9 @@ appeared in the original journal file.
|
|||
.It Fl \-truncate
|
||||
.It Fl \-unbudgeted
|
||||
.It Fl \-uncleared Pq Fl U
|
||||
.It Fl \-unrealized
|
||||
.It Fl \-unrealized-gains
|
||||
.It Fl \-unrealized-losses
|
||||
.It Fl \-unround
|
||||
.It Fl \-verbose
|
||||
.It Fl \-verify
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@
|
|||
namespace ledger {
|
||||
|
||||
class commodity_t;
|
||||
class annotation_t;
|
||||
class keep_details_t;
|
||||
struct annotation_t;
|
||||
struct keep_details_t;
|
||||
|
||||
DECLARE_EXCEPTION(amount_error, std::runtime_error);
|
||||
|
||||
|
|
|
|||
|
|
@ -188,12 +188,6 @@ post_handler_ptr chain_post_handlers(post_handler_ptr base_handler,
|
|||
else
|
||||
handler.reset(new sort_posts(handler, report.HANDLER(sort_).str()));
|
||||
}
|
||||
#if 0
|
||||
else if (! report.HANDLED(period_) &&
|
||||
! report.HANDLED(unsorted)) {
|
||||
handler.reset(new sort_posts(handler, "date"));
|
||||
}
|
||||
#endif
|
||||
|
||||
// collapse_posts causes xacts with multiple posts to appear as xacts
|
||||
// with a subtotaled post for each commodity used.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
namespace ledger {
|
||||
|
||||
class keep_details_t;
|
||||
struct keep_details_t;
|
||||
class commodity_pool_t;
|
||||
|
||||
DECLARE_EXCEPTION(commodity_error, std::runtime_error);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ value_t expr_t::real_calc(scope_t& scope)
|
|||
try {
|
||||
return ptr->calc(scope, &locus);
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (locus) {
|
||||
string current_context = error_context();
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ pass_down_posts::pass_down_posts(post_handler_ptr handler,
|
|||
try {
|
||||
item_handler<post_t>::operator()(*post);
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
add_error_context(item_context(*post, _("While handling posting")));
|
||||
throw;
|
||||
}
|
||||
|
|
@ -256,9 +256,9 @@ void anonymize_posts::render_commodity(amount_t& amt)
|
|||
|
||||
void anonymize_posts::operator()(post_t& post)
|
||||
{
|
||||
SHA1 sha;
|
||||
uint_least32_t message_digest[5];
|
||||
bool copy_xact_details = false;
|
||||
SHA1 sha;
|
||||
unsigned int message_digest[5];
|
||||
bool copy_xact_details = false;
|
||||
|
||||
if (last_xact != post.xact) {
|
||||
temps.copy_xact(*post.xact);
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ public:
|
|||
report_t& _report,
|
||||
expr_t _group_by_expr)
|
||||
: post_chain(_post_chain), report(_report),
|
||||
group_by_expr(_group_by_expr),
|
||||
preflush_func(bind(&post_splitter::print_title, this, _1)) {
|
||||
group_by_expr(_group_by_expr) {
|
||||
TRACE_CTOR(post_splitter, "scope_t&, post_handler_ptr, expr_t");
|
||||
preflush_func = bind(&post_splitter::print_title, this, _1);
|
||||
}
|
||||
virtual ~post_splitter() {
|
||||
TRACE_DTOR(post_splitter);
|
||||
|
|
@ -350,8 +350,7 @@ class anonymize_posts : public item_handler<post_t>
|
|||
public:
|
||||
anonymize_posts(post_handler_ptr handler)
|
||||
: item_handler<post_t>(handler), next_comm_id(0), last_xact(NULL),
|
||||
rnd_gen(static_cast<unsigned int>(reinterpret_cast<uintmax_t>(this) +
|
||||
static_cast<uintmax_t>(std::time(0)))),
|
||||
rnd_gen(static_cast<unsigned int>(static_cast<uintmax_t>(std::time(0)))),
|
||||
integer_range(1, 2000000000L),
|
||||
integer_gen(rnd_gen, integer_range) {
|
||||
TRACE_CTOR(anonymize_posts, "post_handler_ptr");
|
||||
|
|
|
|||
|
|
@ -367,13 +367,13 @@ post_t * generate_posts_iterator::operator()()
|
|||
post = posts();
|
||||
}
|
||||
}
|
||||
catch (std::exception& err) {
|
||||
catch (std::exception&) {
|
||||
add_error_context(_("While parsing generated transaction (seed %1):")
|
||||
<< seed);
|
||||
add_error_context(buf.str());
|
||||
throw;
|
||||
}
|
||||
catch (int status) {
|
||||
catch (int) {
|
||||
add_error_context(_("While parsing generated transaction (seed %1):")
|
||||
<< seed);
|
||||
add_error_context(buf.str());
|
||||
|
|
|
|||
|
|
@ -422,6 +422,7 @@ expr_t::func_t global_scope_t::look_for_command(scope_t& scope,
|
|||
|
||||
void global_scope_t::visit_man_page() const
|
||||
{
|
||||
#ifndef WIN32
|
||||
int pid = fork();
|
||||
if (pid < 0) {
|
||||
throw std::logic_error(_("Failed to fork child process"));
|
||||
|
|
@ -436,6 +437,7 @@ void global_scope_t::visit_man_page() const
|
|||
|
||||
int status = -1;
|
||||
wait(&status);
|
||||
#endif
|
||||
exit(0); // parent
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +473,7 @@ void handle_debug_options(int argc, char * argv[])
|
|||
// global in utils.h
|
||||
_trace_level = boost::lexical_cast<uint8_t>(argv[i + 1]);
|
||||
}
|
||||
catch (const boost::bad_lexical_cast& e) {
|
||||
catch (const boost::bad_lexical_cast&) {
|
||||
throw std::logic_error(_("Argument to --trace must be an integer"));
|
||||
}
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ int main(int argc, char * argv[], char * envp[])
|
|||
filesystem::path::default_name_check(filesystem::portable_posix_name);
|
||||
|
||||
std::signal(SIGINT, sigint_handler);
|
||||
#ifndef WIN32
|
||||
std::signal(SIGPIPE, sigpipe_handler);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GETTEXT)
|
||||
::textdomain("ledger");
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus, const int depth)
|
|||
return result;
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (locus && ! *locus)
|
||||
*locus = this;
|
||||
throw;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ namespace {
|
|||
|
||||
opt(args);
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (name[0] == '-')
|
||||
add_error_context(_("While parsing option '%1'") << name);
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ void process_environment(const char ** envp, const string& tag,
|
|||
if (! value.empty())
|
||||
process_option(string("$") + buf, string(buf), scope, q + 1, value);
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
add_error_context(_("While parsing environment variable option '%1':")
|
||||
<< *p);
|
||||
throw;
|
||||
|
|
|
|||
|
|
@ -484,7 +484,7 @@ expr_t::parser_t::parse(std::istream& in,
|
|||
|
||||
return top_node;
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (original_string) {
|
||||
add_error_context(_("While parsing value expression:"));
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ namespace ledger {
|
|||
|
||||
class query_t : public predicate_t
|
||||
{
|
||||
protected:
|
||||
class parser_t;
|
||||
|
||||
public:
|
||||
class lexer_t
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ commodity_quote_from_script(commodity_t& commodity,
|
|||
DEBUG("commodity.download", "invoking command: " << getquote_cmd);
|
||||
|
||||
bool success = true;
|
||||
#ifndef WIN32
|
||||
if (FILE * fp = popen(getquote_cmd.c_str(), "r")) {
|
||||
if (std::feof(fp) || ! std::fgets(buf, 255, fp))
|
||||
success = false;
|
||||
|
|
@ -103,6 +104,7 @@ commodity_quote_from_script(commodity_t& commodity,
|
|||
// Don't try to download this commodity again.
|
||||
commodity.add_flags(COMMODITY_NOMARKET);
|
||||
}
|
||||
#endif
|
||||
return none;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1040,7 +1040,6 @@ option_t<report_t> * report_t::lookup_option(const char * p)
|
|||
else OPT(unrealized_gains_);
|
||||
else OPT(unrealized_losses_);
|
||||
else OPT(unround);
|
||||
else OPT(unsorted);
|
||||
break;
|
||||
case 'w':
|
||||
OPT(weekly);
|
||||
|
|
|
|||
|
|
@ -315,7 +315,6 @@ public:
|
|||
HANDLER(unrealized_gains_).report(out);
|
||||
HANDLER(unrealized_losses_).report(out);
|
||||
HANDLER(unround).report(out);
|
||||
HANDLER(unsorted).report(out);
|
||||
HANDLER(weekly).report(out);
|
||||
HANDLER(wide).report(out);
|
||||
HANDLER(yearly).report(out);
|
||||
|
|
@ -914,8 +913,6 @@ public:
|
|||
.set_expr(string("--unround"), "unrounded(total_expr)");
|
||||
});
|
||||
|
||||
OPTION(report_t, unsorted);
|
||||
|
||||
OPTION_(report_t, weekly, DO() { // -W
|
||||
parent->HANDLER(period_).on(string("--weekly"), "weekly");
|
||||
});
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace {
|
|||
*/
|
||||
int do_fork(std::ostream ** os, const path& pager_path)
|
||||
{
|
||||
#ifndef WIN32
|
||||
int pfd[2];
|
||||
|
||||
int status = pipe(pfd);
|
||||
|
|
@ -104,6 +105,9 @@ namespace {
|
|||
*os = new fdstream(pfd[1]);
|
||||
}
|
||||
return pfd[1];
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +124,7 @@ void output_stream_t::initialize(const optional<path>& output_file,
|
|||
|
||||
void output_stream_t::close()
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (os != &std::cout) {
|
||||
checked_delete(os);
|
||||
os = &std::cout;
|
||||
|
|
@ -134,6 +139,7 @@ void output_stream_t::close()
|
|||
if (! WIFEXITED(status) || WEXITSTATUS(status) != 0)
|
||||
throw std::logic_error(_("Error in the pager"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ledger
|
||||
|
|
|
|||
|
|
@ -611,7 +611,7 @@ void instance_t::automated_xact_directive(char * line)
|
|||
|
||||
ae.release();
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (reveal_context) {
|
||||
add_error_context(_("While parsing automated transaction:"));
|
||||
add_error_context(source_context(pathname, pos, curr_pos, "> "));
|
||||
|
|
@ -657,7 +657,7 @@ void instance_t::period_xact_directive(char * line)
|
|||
}
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (reveal_context) {
|
||||
add_error_context(_("While parsing periodic transaction:"));
|
||||
add_error_context(source_context(pathname, pos, curr_pos, "> "));
|
||||
|
|
@ -1359,7 +1359,7 @@ post_t * instance_t::parse_post(char * line,
|
|||
return post.release();
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
add_error_context(_("While parsing posting:"));
|
||||
add_error_context(line_context(buf, beg, len));
|
||||
throw;
|
||||
|
|
@ -1557,7 +1557,7 @@ xact_t * instance_t::parse_xact(char * line,
|
|||
return xact.release();
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
if (reveal_context) {
|
||||
add_error_context(_("While parsing transaction:"));
|
||||
add_error_context(source_context(xact->pos->pathname,
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags,
|
|||
length = static_cast<std::size_t>(in.tellg() - pos);
|
||||
}
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
kind = ERROR;
|
||||
length = static_cast<std::size_t>(in.tellg() - pos);
|
||||
throw;
|
||||
|
|
@ -449,7 +449,7 @@ void expr_t::token_t::next(std::istream& in, const parse_flags_t& pflags,
|
|||
|
||||
void expr_t::token_t::rewind(std::istream& in)
|
||||
{
|
||||
in.seekg(- length, std::ios::cur);
|
||||
in.seekg(- int(length), std::ios::cur);
|
||||
if (in.fail())
|
||||
throw_(parse_error, _("Failed to rewind input stream"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ inline char peek_next_nonws(std::istream& in) {
|
|||
*_p = '\0'; \
|
||||
}
|
||||
|
||||
inline string to_hex(uint_least32_t * message_digest, const int len = 1)
|
||||
inline string to_hex(unsigned int * message_digest, const int len = 1)
|
||||
{
|
||||
std::ostringstream buf;
|
||||
|
||||
|
|
@ -664,7 +664,7 @@ inline string sha1sum(const string& str)
|
|||
SHA1 sha;
|
||||
sha.Reset();
|
||||
sha << str.c_str();
|
||||
uint_least32_t message_digest[5];
|
||||
unsigned int message_digest[5];
|
||||
sha.Result(message_digest);
|
||||
return to_hex(message_digest, 5);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ void auto_xact_t::extend_xact(xact_base_t& xact)
|
|||
xact.verify();
|
||||
|
||||
}
|
||||
catch (const std::exception& err) {
|
||||
catch (const std::exception&) {
|
||||
add_error_context(item_context(*this, _("While applying automated transaction")));
|
||||
add_error_context(item_context(xact, _("While extending transaction")));
|
||||
throw;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,30 @@
|
|||
# final balance is the same as what the balance report shows.
|
||||
|
||||
import sys
|
||||
#import re
|
||||
import re
|
||||
|
||||
from difflib import ndiff
|
||||
|
||||
multiproc = False
|
||||
try:
|
||||
from multiprocessing import Pool
|
||||
multiproc = True
|
||||
except:
|
||||
pass
|
||||
|
||||
args = sys.argv
|
||||
jobs = 1
|
||||
match = re.match('-j([0-9]+)?', args[1])
|
||||
if match:
|
||||
args = [args[0]] + args[2:]
|
||||
if match.group(1):
|
||||
jobs = int(match.group(1))
|
||||
if jobs == 1:
|
||||
multiproc = False
|
||||
|
||||
from LedgerHarness import LedgerHarness
|
||||
|
||||
harness = LedgerHarness(sys.argv)
|
||||
harness = LedgerHarness(args)
|
||||
|
||||
#def normalize(line):
|
||||
# match = re.match("((\s*)([A-Za-z]+)?(\s*)([-0-9.]+)(\s*)([A-Za-z]+)?)( (.+))?$", line)
|
||||
|
|
@ -104,14 +121,28 @@ def generation_test(seed):
|
|||
|
||||
beg_range = 1
|
||||
end_range = 20
|
||||
if len(sys.argv) > 4:
|
||||
beg_range = int(sys.argv[3])
|
||||
end_range = int(sys.argv[4])
|
||||
if len(args) > 4:
|
||||
beg_range = int(args[3])
|
||||
end_range = int(args[4])
|
||||
|
||||
for i in range(beg_range, end_range):
|
||||
def run_gen_test(i):
|
||||
if generation_test(i):
|
||||
harness.success()
|
||||
else:
|
||||
harness.failure()
|
||||
|
||||
if multiproc:
|
||||
pool = Pool(jobs*2)
|
||||
else:
|
||||
pool = None
|
||||
|
||||
if pool:
|
||||
pool.map(run_gen_test, range(beg_range, end_range))
|
||||
else:
|
||||
for i in range(beg_range, end_range):
|
||||
run_gen_test(i)
|
||||
|
||||
if pool:
|
||||
pool.close()
|
||||
pool.join()
|
||||
harness.exit()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,27 @@ import re
|
|||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import copy_reg
|
||||
import types
|
||||
|
||||
def _pickle_method(method):
|
||||
func_name = method.im_func.__name__
|
||||
obj = method.im_self
|
||||
cls = method.im_class
|
||||
return _unpickle_method, (func_name, obj, cls)
|
||||
|
||||
def _unpickle_method(func_name, obj, cls):
|
||||
for cls in cls.mro():
|
||||
try:
|
||||
func = cls.__dict__[func_name]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
return func.__get__(obj, cls)
|
||||
|
||||
copy_reg.pickle(types.MethodType, _pickle_method, _unpickle_method)
|
||||
|
||||
class LedgerHarness:
|
||||
ledger = None
|
||||
sourcepath = None
|
||||
|
|
|
|||
|
|
@ -5,18 +5,35 @@ import os
|
|||
import re
|
||||
import tempfile
|
||||
|
||||
multiproc = False
|
||||
try:
|
||||
from multiprocessing import Pool
|
||||
multiproc = True
|
||||
except:
|
||||
pass
|
||||
|
||||
from string import join
|
||||
from difflib import unified_diff
|
||||
|
||||
from LedgerHarness import LedgerHarness
|
||||
|
||||
harness = LedgerHarness(sys.argv)
|
||||
tests = sys.argv[3]
|
||||
args = sys.argv
|
||||
jobs = 1
|
||||
match = re.match('-j([0-9]+)?', args[1])
|
||||
if match:
|
||||
args = [args[0]] + args[2:]
|
||||
if match.group(1):
|
||||
jobs = int(match.group(1))
|
||||
if jobs == 1:
|
||||
multiproc = False
|
||||
|
||||
harness = LedgerHarness(args)
|
||||
tests = args[3]
|
||||
|
||||
if not os.path.isdir(tests) and not os.path.isfile(tests):
|
||||
sys.exit(1)
|
||||
|
||||
class RegressFile:
|
||||
class RegressFile(object):
|
||||
def __init__(self, filename):
|
||||
self.filename = filename
|
||||
self.fd = open(self.filename)
|
||||
|
|
@ -137,24 +154,36 @@ class RegressFile:
|
|||
if not use_stdin:
|
||||
os.remove(tempdata[1])
|
||||
|
||||
def run_tests(self):
|
||||
def run_tests(self, pool):
|
||||
test = self.read_test()
|
||||
while test:
|
||||
self.run_test(test)
|
||||
if pool:
|
||||
pool.apply_async(RegressFile.run_test, (self, test,))
|
||||
else:
|
||||
self.run_test(test)
|
||||
test = self.read_test(test)
|
||||
|
||||
def close(self):
|
||||
self.fd.close()
|
||||
|
||||
if os.path.isdir(tests):
|
||||
for test_file in os.listdir(tests):
|
||||
if re.search('\.test$', test_file):
|
||||
entry = RegressFile(os.path.join(tests, test_file))
|
||||
entry.run_tests()
|
||||
entry.close()
|
||||
else:
|
||||
entry = RegressFile(tests)
|
||||
entry.run_tests()
|
||||
entry.close()
|
||||
if __name__ == '__main__':
|
||||
if multiproc:
|
||||
pool = Pool(jobs*2)
|
||||
else:
|
||||
pool = None
|
||||
|
||||
harness.exit()
|
||||
if os.path.isdir(tests):
|
||||
for test_file in os.listdir(tests):
|
||||
if re.search('\.test$', test_file):
|
||||
entry = RegressFile(os.path.join(tests, test_file))
|
||||
entry.run_tests(pool)
|
||||
entry.close()
|
||||
else:
|
||||
entry = RegressFile(tests)
|
||||
entry.run_tests(pool)
|
||||
entry.close()
|
||||
|
||||
if pool:
|
||||
pool.close()
|
||||
pool.join()
|
||||
harness.exit()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates --unsorted
|
||||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-dates
|
||||
<<<
|
||||
C 1.00s = 100c
|
||||
C 1.00G = 100s
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices --unsorted
|
||||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lot-prices
|
||||
<<<
|
||||
C 1.00s = 100c
|
||||
C 1.00G = 100s
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots --unsorted
|
||||
reg -F '%(justify(scrub(total_expr), 80, 80, true))\n' --lots
|
||||
<<<
|
||||
C 1.00s = 100c
|
||||
C 1.00G = 100s
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
VERSION = 3.0.0
|
||||
LIBVERSION = $(shell echo $(PACKAGE_VERSION) | sed 's/[-abgrc].*//')
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
dist_man_MANS = doc/ledger.1
|
||||
SUBDIRS = po intl
|
||||
|
|
@ -25,7 +25,7 @@ libledger_util_la_SOURCES = \
|
|||
lib/sha1.cpp
|
||||
|
||||
libledger_util_la_CPPFLAGS = $(lib_cppflags)
|
||||
libledger_util_la_LDFLAGS = -release $(VERSION)
|
||||
libledger_util_la_LDFLAGS = -release $(LIBVERSION)
|
||||
|
||||
libledger_math_la_SOURCES = \
|
||||
src/balance.cc \
|
||||
|
|
@ -36,7 +36,7 @@ libledger_math_la_SOURCES = \
|
|||
src/amount.cc
|
||||
|
||||
libledger_math_la_CPPFLAGS = $(lib_cppflags)
|
||||
libledger_math_la_LDFLAGS = -release $(VERSION)
|
||||
libledger_math_la_LDFLAGS = -release $(LIBVERSION)
|
||||
|
||||
libledger_expr_la_SOURCES = \
|
||||
src/option.cc \
|
||||
|
|
@ -51,7 +51,7 @@ libledger_expr_la_SOURCES = \
|
|||
src/value.cc
|
||||
|
||||
libledger_expr_la_CPPFLAGS = $(lib_cppflags)
|
||||
libledger_expr_la_LDFLAGS = -release $(VERSION)
|
||||
libledger_expr_la_LDFLAGS = -release $(LIBVERSION)
|
||||
|
||||
libledger_data_la_SOURCES = \
|
||||
src/lookup.cc \
|
||||
|
|
@ -68,7 +68,7 @@ libledger_data_la_SOURCES = \
|
|||
src/item.cc
|
||||
|
||||
libledger_data_la_CPPFLAGS = $(lib_cppflags)
|
||||
libledger_data_la_LDFLAGS = -release $(VERSION)
|
||||
libledger_data_la_LDFLAGS = -release $(LIBVERSION)
|
||||
|
||||
libledger_report_la_SOURCES = \
|
||||
src/stats.cc \
|
||||
|
|
@ -87,7 +87,7 @@ libledger_report_la_SOURCES = \
|
|||
src/session.cc
|
||||
|
||||
libledger_report_la_CPPFLAGS = $(lib_cppflags)
|
||||
libledger_report_la_LDFLAGS = -release $(VERSION)
|
||||
libledger_report_la_LDFLAGS = -release $(LIBVERSION)
|
||||
|
||||
pkginclude_HEADERS = \
|
||||
src/utils.h \
|
||||
|
|
@ -369,7 +369,7 @@ RegressTests_SOURCES = test/RegressTests.py
|
|||
EXTRA_DIST += test/regress test/convert.py test/LedgerHarness.py
|
||||
|
||||
RegressTests: $(srcdir)/test/RegressTests.py
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress \"\$$@\"" > $@
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/regress \"\$$@\"" > $@
|
||||
chmod 755 $@
|
||||
|
||||
BaselineTests_SOURCES = test/RegressTests.py
|
||||
|
|
@ -377,7 +377,7 @@ BaselineTests_SOURCES = test/RegressTests.py
|
|||
EXTRA_DIST += test/baseline
|
||||
|
||||
BaselineTests: $(srcdir)/test/RegressTests.py
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline \"\$$@\"" > $@
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/baseline \"\$$@\"" > $@
|
||||
chmod 755 $@
|
||||
|
||||
ManualTests_SOURCES = test/RegressTests.py
|
||||
|
|
@ -385,7 +385,7 @@ ManualTests_SOURCES = test/RegressTests.py
|
|||
EXTRA_DIST += test/manual
|
||||
|
||||
ManualTests: $(srcdir)/test/RegressTests.py
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual \"\$$@\"" > $@
|
||||
echo "$(PYTHON) $(srcdir)/test/RegressTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) $(srcdir)/test/manual \"\$$@\"" > $@
|
||||
chmod 755 $@
|
||||
|
||||
ConfirmTests_SOURCES = test/ConfirmTests.py
|
||||
|
|
@ -406,7 +406,7 @@ ConfirmTests: $(srcdir)/test/ConfirmTests.py
|
|||
GenerateTests_SOURCES = test/GenerateTests.py
|
||||
|
||||
GenerateTests: $(srcdir)/test/GenerateTests.py
|
||||
echo "$(PYTHON) $(srcdir)/test/GenerateTests.py $(top_builddir)/ledger$(EXEEXT) $(srcdir) 1 ${1:-20} \"\$$@\"" > $@
|
||||
echo "$(PYTHON) $(srcdir)/test/GenerateTests.py -j$(JOBS) $(top_builddir)/ledger$(EXEEXT) $(srcdir) 1 ${1:-20} \"\$$@\"" > $@
|
||||
chmod 755 $@
|
||||
|
||||
FULLCHECK=$(srcdir)/test/fullcheck.sh
|
||||
|
|
|
|||
|
|
@ -44,4 +44,3 @@ src/system.hh.gch
|
|||
stamp-h1
|
||||
texinfo.tex
|
||||
util_tests
|
||||
version.m4
|
||||
|
|
|
|||
1
version.m4
Normal file
1
version.m4
Normal file
|
|
@ -0,0 +1 @@
|
|||
m4_define([VERSION_NUMBER], [3.0.0])
|
||||
Loading…
Add table
Reference in a new issue