Commit 69f4b7cd authored by polyfloyd's avatar polyfloyd
Browse files

python3Packages.gnucash: Build from existing gnucash package

parent ddd5c213
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -25,8 +25,12 @@
  swig,
  webkitgtk_4_0,
  wrapGAppsHook3,
  python ? null,
  enablePython ? false,
}:

assert enablePython -> (python != null);

stdenv.mkDerivation rec {
  pname = "gnucash";
  version = "5.11";
@@ -45,6 +49,11 @@ stdenv.mkDerivation rec {
    pkg-config
  ];

  cmakeFlags = lib.optional enablePython [
    "-DWITH_PYTHON=\"ON\""
    "-DPYTHON_SYSCONFIG_BUILD=\"$out\""
  ];

  buildInputs =
    [
      aqbanking
@@ -68,7 +77,8 @@ stdenv.mkDerivation rec {
      JSONParse
      FinanceQuote
      perl
    ]);
    ])
    ++ lib.optional enablePython python;

  patches = [
    # this patch disables test-gnc-timezone and test-gnc-datetime which fail due to nix datetime challenges
@@ -81,6 +91,20 @@ stdenv.mkDerivation rec {
    ./0004-exec-fq-wrapper.patch
  ];

  postPatch = ''
    patch -p0 <<END_PATCH
      +++ bindings/python/__init__.py
      @@ -1,3 +1,7 @@
      +import os
      +os.environ['GNC_DBD_DIR'] = '${libdbiDrivers}/lib/dbd'
      +os.environ['GSETTINGS_SCHEMA_DIR'] = '${glib.makeSchemaPath "$out" "gnucash-${version}"}'
      +
       # import all the symbols from gnucash_core, so basic gnucash stuff can be
       # loaded with:
       # >>> from gnucash import thingy
        END_PATCH
  '';

  # this needs to be an environment variable and not a cmake flag to suppress
  # guile warning
  env.GUILE_AUTO_COMPILE = "0";
+5 −0
Original line number Diff line number Diff line
@@ -5605,6 +5605,11 @@ self: super: with self; {
  gntp = callPackage ../development/python-modules/gntp { };
  gnucash = toPythonModule (pkgs.gnucash.override {
    inherit (self) python;
    enablePython = true;
  });
  gnureadline = callPackage ../development/python-modules/gnureadline { };
  go2rtc-client = callPackage ../development/python-modules/go2rtc-client { };