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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#!/usr/bin/python
from __future__ import print_function
import os
import glob
import subprocess
from distutils.core import Extension
from distutils import version
try:
import DistUtilsExtra.auto
except ImportError:
import sys
print('To build Onboard you need https://launchpad.net/python-distutils-extra', file=sys.stderr)
sys.exit(1)
try:
# try python 3
from subprocess import getstatusoutput
except:
# python 2 fallback
from commands import getstatusoutput
current_ver = version.StrictVersion(DistUtilsExtra.auto.__version__)
required_ver = version.StrictVersion('2.12')
assert current_ver >= required_ver , 'needs DistUtilsExtra.auto >= 2.12'
def pkgconfig(*packages, **kw):
# print command and ouput to console to aid in debugging
command = "pkg-config --libs --cflags %s" % ' '.join(packages)
print("setup.py: running pkg-config:", command)
status, output = getstatusoutput(command)
print("setup.py:", output)
if status != 0:
import sys
print('setup.py: pkg-config returned exit code %d' % status, file=sys.stderr)
sys.exit(1)
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
for token in output.split():
if token[:2] in flag_map:
kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
else:
kw.setdefault('extra_link_args', []).append(token)
for k, v in kw.items():
kw[k] = list(set(v))
return kw
# Make xgettext extract translatable strings from _format() calls too.
var = "XGETTEXT_ARGS"
os.environ[var] = os.environ.get(var, "") + " --keyword=_format"
##### private extension 'osk' #####
OSK_EXTENSION = 'Onboard.osk'
SOURCES = ['osk_module.c',
'osk_devices.c',
'osk_util.c',
]
SOURCES = ['Onboard/osk/' + x for x in SOURCES]
DEPENDS = ['osk_module.h',
'osk_devices.h',
'osk_util.h',
]
module = Extension(
OSK_EXTENSION,
# even MINOR numbers for stable versions
define_macros = [('MAJOR_VERSION', '0'),
('MINOR_VERSION', '2'),
('MICRO_VERSION', '0')],
sources = SOURCES,
depends = DEPENDS, # trigger rebuild on changes to these
**pkgconfig('gdk-3.0', 'x11', 'xi', 'xtst', 'dconf')
)
##### setup #####
DistUtilsExtra.auto.setup(
name = 'onboard',
version = '0.97.2',
author = 'Chris Jones',
author_email = 'chris.e.jones@gmail.com',
maintainer = 'Ubuntu Core Developers',
maintainer_email = 'ubuntu-devel-discuss@lists.ubuntu.com',
url = 'http://launchpad.net/onboard/',
license = 'gpl',
description = 'Simple On-screen Keyboard',
packages = ['Onboard'],
data_files = [('share/glib-2.0/schemas', glob.glob('data/*.gschema.xml')),
('share/GConf/gsettings', glob.glob('data/*.convert')),
('share/onboard', glob.glob('AUTHORS')),
('share/onboard', glob.glob('CHANGELOG')),
('share/onboard', glob.glob('COPYING')),
('share/onboard', glob.glob('NEWS')),
('share/onboard', glob.glob('README')),
('share/onboard', glob.glob('onboard-defaults.conf.example')),
('share/icons/hicolor/scalable/apps', glob.glob('icons/hicolor/*')),
('share/icons/ubuntu-mono-dark/status/22', glob.glob('icons/ubuntu-mono-dark/*')),
('share/icons/ubuntu-mono-light/status/22', glob.glob('icons/ubuntu-mono-light/*')),
('share/onboard/data', glob.glob('data/*.gif')),
('share/onboard/docs', glob.glob('docs/*')),
('share/onboard/layouts', glob.glob('layouts/*.*')),
('share/onboard/layouts/images', glob.glob('layouts/images/*')),
('share/onboard/themes', glob.glob('themes/*')),
('share/onboard/scripts', glob.glob('scripts/*')),
('/etc/xdg/autostart', glob.glob('data/onboard-autostart.desktop'))],
scripts = ['onboard', 'onboard-settings'],
requires = [OSK_EXTENSION],
ext_modules = [module]
)
|