diff options
author | lovetox <philipp@hoerist.com> | 2022-01-02 12:07:19 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2022-01-02 12:07:19 +0300 |
commit | 0a1b8b027057c4cf0dec2813e62c7a8f6d8b1281 (patch) | |
tree | 377ad0048f7341bc9226952abb8788b7c9099f09 /scripts | |
parent | e533fb18010698f07f859783d7fb79ce9a002d9e (diff) |
Scripts: link-gtk - cleanup dir before linking
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ci/link-gtk.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/scripts/ci/link-gtk.py b/scripts/ci/link-gtk.py index 06d364e58..8eb3c057d 100755 --- a/scripts/ci/link-gtk.py +++ b/scripts/ci/link-gtk.py @@ -17,17 +17,30 @@ gui_path = cwd / 'gajim' / 'gui' gtk_path = cwd / 'gajim' / 'gtk' -def link(target): +def cleanup_dir(target_dir: Path) -> None: + for path in target_dir.iterdir(): + if path.name in IGNORED_FILES: + continue + path.unlink() + + +def link(target: Path) -> None: 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: + +def link_files(source_dir: Path) -> None: + for path in source_dir.iterdir(): + if path.is_dir(): + if path.name not in IGNORED_DIRS: + link(path) + + elif path.name not in IGNORED_FILES: link(path) - elif path.name not in IGNORED_FILES: - link(path) + +cleanup_dir(gui_path) +link_files(gtk_path) |