Philipp Hörist pushed to branch master at gajim / gajim


Commits:
17e9923a by lovetox at 2021-12-26T23:15:38+01:00
Scripts: Port link-gtk to python

- - - - -


3 changed files:

- .gitlab-ci.yml
- + scripts/ci/link-gtk.py
- − scripts/ci/link-gtk.sh


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -12,7 +12,7 @@ pyright:
     - pip3 install -I git+https://dev.gajim.org/gajim/gi-stubs.git
     - npm install pyright
     - python3 -V
-    - scripts/ci/link-gtk.sh
+    - python3 scripts/ci/link-gtk.py
     - $(npm bin)/pyright --version
     - $(npm bin)/pyright
   interruptible: true


=====================================
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)


=====================================
scripts/ci/link-gtk.sh deleted
=====================================
@@ -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



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/17e9923ae82142fb6b97cd1ba41e72a2ce9838c1

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/17e9923ae82142fb6b97cd1ba41e72a2ce9838c1
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to