significantly
Modify the DEBUG and PINFO macros to return unless qof_log_check is
true. Replace almost all direct calls to g_debug and g_message with
DEBUG and PINFO respectively.
Track the highest logging level sent to qof_log_set_level to provide a
short-circuit return in qof_log_check. Remove setting GNC_MOD_TESTS to
QOF_LOG_DEBUG so that the short-circuit threshold isn't defeated by
always being DEBUG.
Net result: 33% improvement in xml load times.
Not everything from the 6 Book-Currency commits is removed: Switching
the Num and split-action fields and restricting edits of transactions
older than n days were included and those changes are left in place.
Some other partly-implemented features were also part of these commits
and were removed: Options for setting a default capital gains account
and currency, completion of the LIFO cap-gains policy, and creation of
a list of cap-gains policies.
If any of these are to be revived they should each be done in a separate
feature branch and submitted via Github pull request for a code review
before merging; a design discussion on gnucash-devel before restarting
work is also advisable.
* txn-currency can be specified explicitly instead of currency of
first split
* split memos can be specified
Note test-register.scm gets some changes because the Trans Num field
was erroneously saved into Split Action fields. Now the num field is
only copied into the TransNum field.
>>> nominator='123456'
A digit is missing in the string returned from to_string_with_decimal_point_placed. The -1 error.
>>> point_place=2
>>> nominator[:-point_place - 1], nominator[-point_place:]
('123', '56')
When a transaction is added from the ledger, price database is updated properly.
But if the transaction is imported, there is no price db update.
This change adds the proper pricedb update in the import path (qfx/ofx/qif).
Tested with make check
When a guile coder uses a variable but omits use-modules, this code
will scan *all* available modules and offer the appropriate module
name.
Before:
Unbound variable: gnc-build-url
After:
Unbound variable: gnc-build-url. Did you forget (use-module (sw_gnc_html))?
If guile calls a C function which expects gnc_numeric but sends a
non-number, it will create a gnc_numeric_error object. This will allow
error gnc_numeric to be handled elsewhere.
Also the overflow gnc_numeric was incorrectly created.
locale-sensitive string-sorting functions -- currently mirrors guile's
(ice-9 i18n) functions -- may be modified to call C code if guile code
is not reliable.
Compiling our guile scripts will run loaded libraries. One of the libraries to
load is the engine library which expects to find the enabled backends (xml and or dbi).
If those aren't built yet, this will result in error messages printed in the build output.
test arguments, deprecated as well as new mode arguments
test creating a session with a new xml file using __init__()
and begin(). Test raising exception when opening nonexistent
file without respective mode setting.
default_arguments_decorator until now only allows positional
argument defaults. This adds keyword defaults. The keywords
can be mapped to the positional arguments by optional argument
kargs_pos so interactions between keyword and positional arg
defaults can raise a TypeError. Some more information in
the docstring is included. In addition the docstring of
the wrapped function will be modified to contain information
about the defaults.
allow keyword arguments for function_class methods
and functions. process_dict_convert_to_instance() is added to
mimic the behavior of the process_list_convert_to_instance()
Derived methods in gnucash_core.py like raise_backend_errors_after_call
get modified to accept being called with keyword args.
Also adds some docstrings.
the deprecation submodule will house content related to deprecation.
That is general convenience function and functions related to specific
deprecation issues. The latter starts with decorator functions to bridge
the change in qof_session_begin argument change to SessionOpenMode.
subtle bug here-- used string-hash to convert guid-string to a number
which is faster to use as hash key. but string-hash does not guarantee
that there are no hash collisions. it is best to use guid string
instead which is guaranteed to uniquely define a split.
For clarity. In so doing found the backend behavior a bit inconsistent
so it's modified to do what the enum values indicate.
In the course of changing the various calls I found some implementation
errors in the back end and corrected them.
make gnc_path_get_localedir() and GETTEXT_PACKAGE available for python
to access locales. Import gettext module to provide _ as translator
method. Provide null _-method returning english text in case of missing gettext.
Make a lot of messages translatable by adding _-method. Include python
files to create .pot-files.
The previous fix didn't calculate the comparison time correctly and
ended up in the wrong day because the GMT time is before the local time.
In the course of checking the corner-case timezones (Midway and
Kiritimati) I found an error in the GncDateTime calculation of the
neutral time, so fixed that too.
Reported for Invoices on gnucash-user. Checked all other uses of
xaccTransSetPostDateSecs(), fixed the ones that weren't passing an
already normalized time64. For Invoices change the post_date to also be
normalized so that it stays the same as the transaction post_date. That
also protects it from the displayed date changing depending on timezone.
The python binding invoice post_time test had to be changed to match.
This also drops the python wrapper for gnc-module. As for the guile wrappers,
python should use other means of loading our shared libraries.
This commit required a few tweaks to the dependency chain as some units
inherited dependency information from gnc-module's public dependency
interface.
file(COPY ) will only trigger when the destination file doesn't exist yet.
It won't retrigger on source file changes.
configure_file on the other hand will. To avoid unwanted substitution
attempts this can be invoked with the COPYONLY keyword.
Disadvantage of configure_file is that it will only take one
input file where file(COPY ) can operate on a list of files.
As such the configure_file statement has to be wrapped in a foreach.
A few uses of file(COPY ) can't be replaced as they are setting
file permissions. And the one in make_dist has been kept as that
always operates on an empty directory, hence copying is guaranteed.
The former will monitor the file for updates and copy it again
the latter will only copy the file if it doesn't exist in the destination yet
Resolves most merge conflicts. The only bit I was unable
to merge from maint into master is the use of match-lambda
in category-barchart.scm. This will have to be redone manually.
Emit appropriate deprecation warnings in case code tries to invoke the removed functions.
Only for gnc:module-load a more elaborate compat function has
been written which should allow code using this obsolete function
to continue to function. The emitted deprecation warning will
guide the user to update his/her code for future compatibility.
app-utils now is an ordinery shared library
A few bits worth mentioning:
1. it's not guile-free just yet, so instead of a gnc_module_load
your code may have to call scm_c_use_module("gnucash app-utils");
to expose the scm side of the app-utils api. This call has been
added to gnucash-bin.c for example
2. while lots of noise in this commit is to rename from gncmodule-app-utils
to gnc-app-utils, I'll point out the library has also been moved from
<libdir>/gnucash to <libdir>. This required changes in app-util's
CMakeLists.txt file for the install side and in the top level
CMakeLists.txt file for the build directory structure.
3. The C side link module test has been removed as linking an ordinary
shared library should be considered well tested by the compiler devs.
The scheme side module load test has been slightly tweaked to no longer
try to use gnc:module-load, but instead now checks whether the app-utils
api is properly exposed to scheme after loading it via use-modules.
4. Dropped a completely obsolete README file.
With that in place we no longer need to (gnc:module-load "gnucash/gnome-utils" 0)
the gnome-utils gncmodule. An ordinary (use-modules (gnucash gnome-utils)) suffices
With that in place we no longer need to (gnc:module-load "gnucash/app-utils" 0)
the app-utils gncmodule. An ordinary (use-modules (gnucash app-utils)) suffices
- move test modules into a subdirectory on Windows as well
- move the futuremod module into its own subdirectory
to avoid its load warnings each time gnc_module_init is called
That also tends to happen when building guile modules.
- remove the log handlers filtering out the futuremodsys warnings
They didn't match the actual warning signature anyway and
they're no longer emitted during testing
This is a first rudimentary separation of gnc-module tests
based on whether they require guile or not. Needs plenty of refinement
which will be applied in followup commits.
1. Instead of creating a C wrapper around gettext to then wrap in
guile, use guile's builtin gettext support directly.
The code still defines the _ and N_ shorthands. However it doesn't
really warant a separate module just for these two shorthands.
Instead define them in core-utils. So all code wanting to use
_ or N_ in guile should now use the (gnucash core-utils) module.
The bulk of this commit is actually deleting the scm-gettext
target and using (gnucash core-utils) instead of (gnucash gettext).
2. As the definition of _ and N_ is removed from app-utils.scm,
the app-utils test for a functional N_ macro has been moved to a
new test file in the guile bindinds tests.
3. The (gnucash gettext) module has been deprecated. Use
(gnucash core-utils) from now on.
This is just a cosmetic. This way the scm targets in the CMakeLists.txt
file are ordered according to their dependencies (targets later in the
file can depend on targets earlier in the file).
This commit tries to do the minimum necessary to move the guile bits from engine
to bindings/guile. As engine is a very central piece in the software, this unfortunately
still touches many other source files:
- A few helper objects have been squashed together:
* engine-helpers-guile.[ch] (of which the c part is extracted from engine-helpers.c)
* gncBusGuile.[ch]
* gnc-hooks-scm.[ch]
- The initialization function of gncmod-engine no longer initializes the scm bits.
Any scm code that wants to interact with the engine code now has to load
the (gnucash engine) scm module, or sometimes (gnucash business-core).
The bulk of changes in this commit actually is updating all the scm consumers to do so.
- scm-scm target has been removed. Instead (gnucash utilities) is part
of scm-engine. A few dependency graphs have been updated for this.
More refinements will be in followup commits.
That should trigger a regeneration of these swig sources if
any of the header files change.
This is done via a small macro that can be reused for other wrappers as well.
Note
cmake 3.15 introduces a 'FILTER' generator expression
that might allow us to do something like the following:
$<FILTER:$<TARGET_PROPERTY:baselib,SOURCES>,INCLUDE,"*.h[pp]?$">
I toyed briefly with that idea but it currently has two issues:
1. 3.15 is newer than our current minimum cmake requirement, so we can't
depend in that feature yet.
2. the sources are relative to *their* source directory, which
is different from the one in which the wrappers are generated
So they should still be properly transformed into absolute paths
By properly marking certain parameters as private or public
we can have cmake work out most of the link_libraries and
include_directoris for other targets dependent on core-utils
Note core-utils.i is used by both the guile and the python bindings so
it is moved up to the common bindings directory, while guile
specific changes are in bindings/guile.
There are more, but these are most common ones.
There are also a number of urls that don't behave well when https, so those are skipped
At some point I have also started marking non-working URLs as [DEAD LINK], though
that's not a full coverage.
Initialisation of some business objects has been done with
datetime.date.today() and it is also mentioned as a possibility
in the source doc. So leave it possible.