summaryrefslogtreecommitdiffstats
path: root/icons/copybreeze.sh
diff options
context:
space:
mode:
Diffstat (limited to 'icons/copybreeze.sh')
-rwxr-xr-xicons/copybreeze.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/icons/copybreeze.sh b/icons/copybreeze.sh
new file mode 100755
index 00000000..e3deae01
--- /dev/null
+++ b/icons/copybreeze.sh
@@ -0,0 +1,75 @@
1#!/usr/bin/env python2
2
3import sh
4import subprocess
5import os
6from shutil import copyfile, copy2
7from os import path
8
9wantedIcons = [
10 "application-menu.svg",
11 "dialog-cancel.svg",
12 "dialog-ok.svg",
13 "document-decrypt.svg",
14 "document-edit.svg",
15 "document-encrypt.svg",
16 "edit-delete.svg",
17 "edit-find.svg",
18 "edit-undo.svg",
19 "error.svg",
20 "folder.svg",
21 "im-user.svg",
22 "mail-mark-important.svg",
23 "mail-mark-unread-new.svg",
24 "mail-reply-sender.svg",
25 "network-disconnect.svg",
26 "view-refresh.svg"
27]
28
29def ensure_dir(file_path):
30 directory = os.path.dirname(file_path)
31 if not os.path.exists(directory):
32 os.makedirs(directory)
33
34def copyFile(rootDir, dir, file):
35 print("Copy file " + root + ", " + dir + ", " + file)
36 reldir = dir.replace(path.join(rootDir, "icons"), "")
37 src = os.path.join(dir, file)
38 if os.path.islink(src):
39 # We're dealing with a symlink
40 linkto = os.readlink(src)
41 targetRelpath = path.join(os.path.dirname(src), linkto)
42 targetReldir = os.path.dirname(targetRelpath)
43
44 # First recursively copy target
45 copyFile(rootDir, targetReldir, targetRelpath.replace(targetReldir + "/", ""))
46
47 #Create symlinks for normal and dark version
48 dst = "./breeze/icons" + path.join(reldir, file)
49 ensure_dir(dst)
50 os.symlink(linkto, dst)
51
52 invertedDst = "./breeze/icons" + path.join(reldir, file.replace(".svg", "-inverted.svg"))
53 ensure_dir(invertedDst)
54 os.symlink(linkto.replace(".svg", "-inverted.svg"), invertedDst)
55 else:
56 # A regular icon, just copy normal and dark version
57 dst = "./breeze/icons" + path.join(reldir, file)
58 print("Copying: " + path.join(dir, file) + " to " + dst)
59 ensure_dir(dst)
60 copy2(src, dst)
61
62 invertedDst = "./breeze/icons" + path.join(reldir, file.replace(".svg", "-inverted.svg"))
63 print("Copying: " + src.replace("icons", "icons-dark") + " to " + invertedDst)
64 ensure_dir(invertedDst)
65 copy2(src.replace("icons", "icons-dark"), invertedDst)
66
67dir="upstreamBreeze"
68if not os.path.exists(dir):
69 sh.git.clone("--depth", "1", "git://anongit.kde.org/breeze-icons.git", dir)
70
71dirToWalk = dir + "/icons"
72for root, dirs, files in os.walk(dirToWalk):
73 for file in files:
74 if any(file == s for s in wantedIcons):
75 copyFile(dir, root, file)