forked from codebrainz/geany-themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·45 lines (33 loc) · 1.19 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
"""
Simple script to install geany-themes. Must be run from geany-themes dir.
"""
import os
import glob
import shutil
from optparse import OptionParser
p = OptionParser()
p.add_option("-d", metavar="DIR", dest="geany_dir",
default=os.path.join(os.path.expanduser("~"),".config/geany"),
help="path to your Geany config directory")
opts, args = p.parse_args()
if not os.path.isdir(opts.geany_dir):
msg = "Geany config dir '%s' does not exist, " % opts.geany_dir
msg += "please use -d option pointing to where Geany keeps your configuration."
p.error(msg)
src_filedefs = "filedefs"
dst_filedefs = os.path.join(opts.geany_dir, "filedefs")
src_colorschemes = "colorschemes"
dst_colorschemes = os.path.join(opts.geany_dir, "colorschemes")
fd_count = 0
for fd in glob.glob(os.path.join(src_filedefs, "filetypes.*")):
shutil.copy(fd, dst_filedefs)
fd_count += 1
if fd_count == 0:
p.error("No filedefs could be found, please use the 'substitute' script " +
"to generate them.")
cs_count = 0
for cs in glob.glob(os.path.join(src_colorschemes, "*.conf")):
shutil.copy(cs, dst_colorschemes)
cs_count += 1
print "Installed %d filedefs and %s colorschemes" % (fd_count, cs_count)