-
Notifications
You must be signed in to change notification settings - Fork 13
/
setup.py
executable file
·105 lines (81 loc) · 2.95 KB
/
setup.py
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/python3
import os
import shutil
import subprocess
import sys
import setuptools.command.build_py
from setuptools import setup
podir = "./po"
pext = ".po"
langs = sorted([x[:-3] for x in os.listdir(podir) if x[-3:] == pext])
def modir(lang):
return os.path.join("build/mo", lang)
def mkmo(lang):
outpath = modir(lang)
if os.path.exists(outpath):
shutil.rmtree(outpath)
os.makedirs(outpath)
inpath = os.path.join(podir, lang + pext)
cmd = "msgfmt %s -o %s/gnome-gmail.mo" % (inpath, outpath)
subprocess.call(cmd, shell=True) and sys.exit(1)
def merge_i18n():
cmd = "LC_ALL=C intltool-merge -u " +\
"-c %s/.intltool-merge-cache " % podir +\
podir
for infile in (x[:-3] for x in os.listdir('.') if x[-3:] == '.in'):
print("Processing %s.in to %s" % (infile, infile))
if 'desktop' in infile:
flag = '-d'
elif 'schema' in infile:
flag = '-s'
elif 'xml' in infile:
flag = '-x'
else:
flag = ''
if flag:
args = " %s %s.in %s" % (flag, infile, infile)
subprocess.call(cmd + args, shell=True) and sys.exit(1)
class my_build(setuptools.command.build_py.build_py):
def run(self):
setuptools.command.build_py.build_py.run(self)
for lang in langs:
mkmo(lang)
merge_i18n()
def polist():
dst_tmpl = "share/locale/%s/LC_MESSAGES/"
polist = [(dst_tmpl % x, ["%s/gnome-gmail.mo" % modir(x)]) for x in langs]
return polist
setup(
name='gnome-gmail',
version='3.2',
description='support for Gmail as the preferred GNOME email application',
author='David Steele',
author_email='dsteele@gmail.com',
url='https://davesteele.github.io/gnome-gmail/',
scripts=['gnome-gmail'],
requires=['gi', 'six'],
data_files=[
('share/icons/hicolor/16x16/apps', ['icons/16x16/gnome-gmail.png']),
('share/icons/hicolor/24x24/apps', ['icons/24x24/gnome-gmail.png']),
('share/icons/hicolor/32x32/apps', ['icons/32x32/gnome-gmail.png']),
('share/icons/hicolor/48x48/apps', ['icons/48x48/gnome-gmail.png']),
('share/icons/hicolor/256x256/apps',
['icons/256x256/gnome-gmail.png']),
('share/applications', ['gnome-gmail.desktop']),
('share/gnome/autostart', ['gnome-gmail-startup.desktop']),
('share/gnome-gmail', ['gnomegmail.glade', 'gnomegmail.py']),
('share/metainfo', ['gnome-gmail.appdata.xml']),
] + polist(),
classifiers=[
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Topic :: Communications :: Email',
'Topic :: Desktop Environment :: Gnome',
'License :: OSI Approved :: " \
"GNU General Public License v2 or later (GPLv2+)',
'Intended Audience :: End Users/Desktop',
],
cmdclass={
'build_py': my_build,
},
)