[GNC-dev] Windows Build VM

Manfred Usselmann manfred at usselmann.de
Thu Nov 16 06:50:57 EST 2023



Hi,

Am 2023-11-07 04:53, schrieb john:

> On Nov 6, 2023, at 16:12, Manfred Usselmann <manfred at usselmann.de> 
> wrote:
> Hi John,
> 
> Am 2023-11-06 19:31, schrieb john:
> On Nov 6, 2023, at 05:11, Manfred Usselmann <manfred at usselmann.de> 
> wrote:
> Hi,
> Am 2023-10-01 17:47, schrieb john:
> On Oct 1, 2023, at 06:00, Derek Atkins <derek at ihtfp.com> wrote:
> On Sun, October 1, 2023 12:00 am, flywire wrote:
> https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106619.html
> John wrote:
> we don't have a Windows CI action, the nightly builds are done with the
> https://github.com/gnucash/GnuCash-on-windows powershell scripts on a
> Windows VM in Derek's basement.
  The nightly builds are those on 
https://code.gnucash.org/builds/win32/stable/, right?
Would it be possible to additonally provide a version there which 
includes the Python bindings? No, there's no way to make that work with 
an installed package.

> Since there already exists a working build environment, I would hope 
> that it's not too much work?
  That depends on what you want to use for your Python. If you can use 
the MSYS2 environment from Powershell (some MSYS2 things work directly 
in Powershell, others need a Bash shell) then you can simply add 
-DWITH_PYTHON=ON to the CMakeArgs in jhbuild and build it. Don't run the 
installer, just add 
c:\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages to 
PYTHONPATH and run your scripts.

After starting from scratch I'm now able to run a successful build 
including the Python bindings.

After adding
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages
to PYTHONPATH my script now starts and does no longer complain about the 
gnucash imports.

But the script aborts and it looks like Python does not find 
_gnucash_core_c.dll in this folder. :-(

I also added 
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash 
to the Windows Path, but this does not help.

Traceback (most recent call last):
   File 
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", 
line 14, in swig_import_helper
     return importlib.import_module(mname)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File 
"C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", 
line 90, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
   File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
   File "<frozen importlib._bootstrap>", line 1318, in 
_find_and_load_unlocked
ModuleNotFoundError: No module named 'gnucash._gnucash_core_c'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "C:\Users\mu\Documents\Nextcloud_Manfred\Manfred 
Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py", line 18, in 
<module>
     from gnucash import Session, Account, Transaction, Split, 
GncNumeric, GUID, GUIDString, gnucash_core_c
   File 
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\__init__.py", 
line 6, in <module>
     from gnucash.gnucash_core import *
   File 
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core.py", 
line 36, in <module>
     from gnucash import gnucash_core_c
   File 
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", 
line 17, in <module>
     _gnucash_core_c = swig_import_helper()
                       ^^^^^^^^^^^^^^^^^^^^
   File 
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py", 
line 16, in swig_import_helper
     return importlib.import_module('_gnucash_core_c')
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File 
"C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py", 
line 90, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_gnucash_core_c'

Process finished with exit code 1

> If the MSYS2 python doesn't work for you then you'll need to fiddle 
> with paths and such so that CMake finds the python libraries that you 
> want it to. You must make sure that everything Python is linked to the 
> same Python installation.
> Thanks, this sounds promising.
> 
> Results so far:
> 
> - I had to set-executionpolicy Unrestricted.
> 
> - I had to add libgcrypt to setup-mngw54.ps1
> 
> - How do I add -DWITH_PYTHON=ON to jhbuildrc?
> append_autogenargs("gnucash", "-DWITH_PYTHON=ON")  ?

   That will work.

For me it didn't. I also changed it to

append_autogenargs("gnucash-git", "-DWITH_PYTHON=ON")

since I believe this is getting build. Eventually I added it directly to 
gnucash.modules.

Regards,
Manfred


More information about the gnucash-devel mailing list