Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlovetox <philipp@hoerist.com>2021-12-27 01:14:17 +0300
committerlovetox <philipp@hoerist.com>2021-12-27 01:15:38 +0300
commit17e9923ae82142fb6b97cd1ba41e72a2ce9838c1 (patch)
tree3008398c7b56edf1a57ffb05bbc3e3b361b9626a /scripts
parenta308fa83765232b8078a3a41bebaf1d81cad5105 (diff)
Scripts: Port link-gtk to python
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ci/link-gtk.py33
-rwxr-xr-xscripts/ci/link-gtk.sh7
2 files changed, 33 insertions, 7 deletions
diff --git a/scripts/ci/link-gtk.py b/scripts/ci/link-gtk.py
new file mode 100755
index 000000000..06d364e58
--- /dev/null
+++ b/scripts/ci/link-gtk.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+# Creates links from gui folder to all files in the gtk folder
+# This is needed for pyright to work correctly with the dynamic gui imports
+
+from pathlib import Path
+
+IGNORED_FILES = ['__init__.py']
+IGNORED_DIRS = ['__pycache__']
+
+cwd = Path.cwd()
+
+if cwd.name != 'gajim':
+ exit('Script needs to be excecuted from gajim repository root directory')
+
+gui_path = cwd / 'gajim' / 'gui'
+gtk_path = cwd / 'gajim' / 'gtk'
+
+
+def link(target):
+ source = str(target)
+ source = source.replace('gajim/gtk', 'gajim/gui')
+ source = Path(source)
+ source.symlink_to(target)
+ print('create symlink from', source, 'to', target)
+
+for path in gtk_path.iterdir():
+ if path.is_dir():
+ if path.name not in IGNORED_DIRS:
+ link(path)
+
+ elif path.name not in IGNORED_FILES:
+ link(path)
diff --git a/scripts/ci/link-gtk.sh b/scripts/ci/link-gtk.sh
deleted file mode 100755
index 6575bf7a6..000000000
--- a/scripts/ci/link-gtk.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-cd gajim
-mv gui gui_temp
-cp -r gtk gui
-mv -f gui_temp/__init__.py gui/__init__.py
-rm -r gui_temp