[meld/flatpak-ci: 29/31] meld: Move conf.py to be meson templated and add import hackery
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/flatpak-ci: 29/31] meld: Move conf.py to be meson templated and add import hackery
- Date: Fri, 29 Nov 2019 21:15:20 +0000 (UTC)
commit 8d975b03c6a73e5c164b13bbee1c503b075d07ba
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Nov 30 06:13:43 2019 +1000
meld: Move conf.py to be meson templated and add import hackery
The meson templating is a way to move away from the extremely custom
hacks we have in our distutils helpers, but also it's necessary for
sanely adding support for multiple flatpak builds.
bin/meld | 17 +++++++++++++++++
meld/{conf.py => conf.py.in} | 0
2 files changed, 17 insertions(+)
---
diff --git a/bin/meld b/bin/meld
index 38340b1b..875aedf7 100755
--- a/bin/meld
+++ b/bin/meld
@@ -77,6 +77,23 @@ if os.path.exists(os.path.join(melddir, "meld.doap")):
uninstalled = True
devel = os.path.exists(os.path.join(melddir, ".git"))
+if uninstalled:
+ # Import system hackery to import conf.py.in without copying it to
+ # have a .py suffix. This is entirely so that we can run from a git
+ # checkout without any user intervention.
+ import importlib.machinery
+ import importlib.util
+
+ loader = importlib.machinery.SourceFileLoader(
+ 'meld.conf', './meld/conf.py.in')
+ spec = importlib.util.spec_from_loader(loader.name, loader)
+ mod = importlib.util.module_from_spec(spec)
+ loader.exec_module(mod)
+
+ import meld
+ meld.conf = mod
+ sys.modules['meld.conf'] = mod
+
import meld.conf # noqa: E402
# Silence warnings on non-devel releases (minor version is divisible by 2)
diff --git a/meld/conf.py b/meld/conf.py.in
similarity index 100%
rename from meld/conf.py
rename to meld/conf.py.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]