From 258cd5d5836a6660f1122cec274f0a947c1d0459 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Sun, 27 Mar 2022 00:56:26 -0400
Subject: packaging: rework how pyinstaller gets its instructions

Make use of pyinstaller hooks by creating a hook that updates how the
`mesonbuild` import functions.

This is more or less the same as passing a bajillion arguments to
pyinstaller's CLI, but allows the logic to be self-contained (and
reusable). It becomes more obvious what parts of the process pertain to
pyinstaller, and which parts pertain to MSI/pkg creation.
---
 packaging/createpkg.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'packaging/createpkg.py')

diff --git a/packaging/createpkg.py b/packaging/createpkg.py
index 533b3b9..70da656 100755
--- a/packaging/createpkg.py
+++ b/packaging/createpkg.py
@@ -22,8 +22,6 @@ import xml.etree.ElementTree as ET
 sys.path.append(os.getcwd())
 from mesonbuild import coredata
 
-from createmsi import get_modules
-
 class PkgGenerator:
 
     def __init__(self):
@@ -46,10 +44,9 @@ class PkgGenerator:
         pyinstaller_bin = '/Users/jpakkane/Library/Python/3.8/bin/pyinstaller'
         pyinst_cmd = [pyinstaller_bin,
                       '--clean',
+                      '--additional-hooks-dir=packaging',
                       '--distpath',
                       self.pkg_dir]
-        for m in get_modules():
-            pyinst_cmd += ['--hidden-import', m]
         pyinst_cmd += ['meson.py']
         subprocess.check_call(pyinst_cmd)
         tmpdir = os.path.join(self.pkg_dir, 'meson')
-- 
cgit v1.1