-
Notifications
You must be signed in to change notification settings - Fork 16
/
setup.py
107 lines (95 loc) · 4.92 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
106
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import glob
from setuptools import setup
import DistUtilsExtra.command.build_extra
import DistUtilsExtra.command.build_i18n
import DistUtilsExtra.command.clean_i18n
from subprocess import call
#from DistUtilsExtra.command import build_extra
#import build_i18n_ext as build_i18n
PO_DIR = 'po'
for po in glob.glob(os.path.join(PO_DIR, '*.po')):
lang = os.path.basename(po[:-3])
mo = os.path.join(PO_DIR, 'ubuntu-kylin-software-center.mo')
target_dir = os.path.dirname(mo)
if not os.path.isdir(target_dir):
os.makedirs(target_dir)
try:
return_code = call(['msgfmt', '-o', mo, po])
except OSError:
print('Translation not available, please install gettext')
break
if return_code:
raise Warning('Error when building locales')
cmdclass ={
"build" : DistUtilsExtra.command.build_extra.build_extra,
"build_i18n" : DistUtilsExtra.command.build_i18n.build_i18n,
"clean": DistUtilsExtra.command.clean_i18n.clean_i18n,
}
data_files=[
('bin/', ['kylin-software-center']),
('../etc/dbus-1/system.d/', ['backend/aptdaemon/conf/com.kylin.softwarecenter.conf']),
('share/dbus-1/system-services/', ['backend/aptdaemon/conf/com.kylin.softwarecenter.service']),
('share/polkit-1/actions/', ['backend/aptdaemon/conf/com.kylin.softwarecenter.policy']),
('../etc/dbus-1/system.d/', ['backend/watchdog/com.kylin.watchdog.conf']),
('share/dbus-1/system-services/', ['backend/watchdog/com.kylin.watchdog.service']),
# ('lib/python3/dist-packages/ubuntu-kylin-software-center-daemon/', glob.glob('backend/aptdaemon/dbus_service')),
('share/applications/',['ubuntu-kylin-software-center.desktop']),
('share/pixmaps/',['ubuntu-kylin-software-center.svg']),
# ('share/ubuntu-kylin-software-center-daemon/', glob.glob('backend/aptdaemon/dbus_service/*.py')),
('share/ubuntu-kylin-software-center/backend/piston/', glob.glob('backend/piston/*.py')),
('share/ubuntu-kylin-software-center/backend/remote/', glob.glob('backend/remote/*.py')),
('share/ubuntu-kylin-software-center/backend/service/', glob.glob('backend/service/*.py')),
('share/ubuntu-kylin-software-center/backend/service/', glob.glob('backend/service/*.txt')),
('share/ubuntu-kylin-software-center/backend/login_impl/', glob.glob('backend/login_impl/*.py')),
('share/ubuntu-kylin-software-center/backend', glob.glob('backend/*.py')),
('share/ubuntu-kylin-software-center/data/ads/', glob.glob('data/ads/*.png')),
# ('share/ubuntu-kylin-software-center/data/category/', glob.glob('data/category/*')),
('share/ubuntu-kylin-software-center/data/icons/', glob.glob('data/icons/*.png')),
# ('share/ubuntu-kylin-software-center/data/screenshots/', glob.glob('data/screenshots/*')),
('share/ubuntu-kylin-software-center/data/tmpicons/', glob.glob('data/tmpicons/*')),
('share/ubuntu-kylin-software-center/data/winicons/', glob.glob('data/winicons/*')),
('share/ubuntu-kylin-software-center/data/screenshots/', glob.glob('data/screenshots/*')),
('share/ubuntu-kylin-software-center/data/', ['data/uksc.db']),
('share/ubuntu-kylin-software-center/data/xapiandb/', glob.glob('data/xapiandb/*')),
('share/ubuntu-kylin-software-center/models/', glob.glob('models/*')),
('share/ubuntu-kylin-software-center/res/', glob.glob('res/*.png')),
('share/ubuntu-kylin-software-center/res/', glob.glob('res/*.gif')),
('share/ubuntu-kylin-software-center/res/loading/', glob.glob('res/loading/*')),
('share/ubuntu-kylin-software-center/test/', glob.glob('test/*')),
('share/ubuntu-kylin-software-center/ui/', glob.glob('ui/*')),
('share/ubuntu-kylin-software-center/utils/', glob.glob('utils/*')),
('share/ubuntu-kylin-software-center/po/', glob.glob('po/*')),
('share/ubuntu-kylin-software-center/kydroid/', glob.glob('kydroid/*')),
('share/ubuntu-kylin-software-center/',['ubuntu-kylin-software-center.py']),
# ('../etc/xdg/autostart/',['ubuntu-kylin-software-center-autostart.desktop']),
]
#
# 函数名:找.mo文件
# Function: find .mo file
#
def find_mo_files():
data_files = []
for mo in glob.glob(os.path.join(PO_DIR, '*', 'ubuntu-kylin-software-center.mo')):
lang = os.path.basename(os.path.dirname(mo))
dest = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
data_files.append((dest, [mo]))
return data_files
data_files.extend(find_mo_files())
setup(name="ubuntu-kylin-software-center",
version="1.3.10",
author="Ubuntu Kylin Team",
author_email="ubuntukylin-members@list.launchpad.net",
url="https://launchpad.net/ubuntu-kylin-software-center",
license="GNU General Public License (GPL)",
packages = [ 'ubuntu_kylin_software_center_daemon', 'ubuntu_kylin_software_center_watchdog',],
package_dir = {
'': '.',
},
install_requires = [ 'setuptools', ],
cmdclass = cmdclass,
data_files=data_files,
)