-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
183 lines (161 loc) · 6.35 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2005-2011 Async Open Source
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU Lesser General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., or visit: http://www.gnu.org/.
##
##
## Author(s): Stoq Team <stoq-devel@async.com.br>
##
#
# Dependency checking
#
from stoq.lib.dependencies import DependencyChecker
dc = DependencyChecker()
dc.text_mode = True
# We don't need latest kiwi in here
dc.check_kiwi([1, 9, 26])
#
# Package installation
#
import sys
from kiwi.dist import setup, listfiles, listpackages
from stoq import website, version
building_egg = 'bdist_egg' in sys.argv
if building_egg:
python_dir = ''
plugin_dir = 'stoq/data'
else:
python_dir = 'lib/stoqlib/'
plugin_dir = python_dir
def listplugins(plugins, exts):
dirs = []
for package in listpackages('plugins'):
# strip plugins
dirs.append(package.replace('.', '/'))
files = []
for directory in dirs:
install_dir = 'lib/stoqlib/%s' % directory
files.append((install_dir, listfiles(directory, '*.py')))
files.append((install_dir, listfiles(directory, '*.plugin')))
for plugin in plugins:
for kind, suffix in exts:
x = listfiles('plugins', plugin, kind, suffix)
if x:
path = python_dir + '/plugins/%s/%s'
files.append((path % (plugin, kind), x))
files.append((python_dir + 'plugins/' + plugin,
listfiles('plugins', plugin, '*.py')))
return files
packages = listpackages('stoq')
packages.extend(listpackages('stoqlib', exclude='stoqlib.tests'))
scripts = [
'bin/stoq',
'bin/stoqdbadmin',
# FIXME: move these to /usr/lib/stoq/
'bin/stoqcreatedbuser',
'bin/stoq-daemon',
]
templates = []
install_requires = []
data_files = [
('$datadir/csv', listfiles('data', 'csv', '*.csv')),
('$datadir/glade', listfiles('data', 'glade', '*.ui')),
('$datadir/misc', listfiles('data/misc', '*.*')),
('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.png')),
('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.svg')),
('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.jpg')),
('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.gif')),
('$datadir/pixmaps', listfiles('data', 'pixmaps', '*.bmp')),
('$datadir/sql', listfiles('data', 'sql', '*.sql')),
('$datadir/sql', listfiles('data', 'sql', '*.py')),
('$datadir/template', listfiles('data', 'template', '*.html')),
('$datadir/template', listfiles('data', 'template', '*.css')),
('$datadir/template/base', listfiles('data', 'template', 'base', '*.html')),
('$datadir/template/base', listfiles('data', 'template', 'base', '*.css')),
('$datadir/template/loan', listfiles('data', 'template', 'loan', '*.html')),
('$datadir/template/loan', listfiles('data', 'template', 'loan', '*.css')),
('$datadir/template/booklet', listfiles('data', 'template', 'booklet', '*.html')),
('$datadir/template/booklet', listfiles('data', 'template', 'booklet', '*.css')),
('$datadir/template/transfer', listfiles('data', 'template', 'transfer', '*.html')),
('$datadir/template/transfer', listfiles('data', 'template', 'transfer', '*.css')),
('$datadir/uixml', listfiles('data', 'uixml', '*.xml')),
('$datadir/html', listfiles('data', 'html', '*.html')),
('$datadir/html/css', listfiles('data', 'html', 'css', '*.css')),
('$datadir/html/images', listfiles('data', 'html', 'images', '*.png')),
('$datadir/html/js', listfiles('data', 'html', 'js', '*.js')),
]
if building_egg:
data_files.append(
('stoq/data/docs',
['AUTHORS', 'CONTRIBUTORS', 'COPYING', 'COPYING.pt_BR',
'COPYING.stoqlib', 'README', 'docs/copyright']))
install_requires.append('stoqdrivers')
else:
data_files.extend([
('share/applications', ['stoq.desktop']),
('share/doc/stoq', ['AUTHORS', 'CONTRIBUTORS', 'COPYING', 'COPYING.pt_BR',
'COPYING.stoqlib', 'README', 'docs/copyright']),
('share/gnome/help/stoq/C', listfiles('docs/manual/pt_BR', '*.page')),
('share/gnome/help/stoq/C', listfiles('docs/manual/pt_BR', '*.xml')),
('share/gnome/help/stoq/C/figures',
listfiles('docs/manual/pt_BR/figures', '*.png')),
('share/gnome/help/stoq/C/figures',
listfiles('docs/manual/pt_BR/figures', '*.svg')),
('share/icons/hicolor/48x48/apps', ['data/pixmaps/stoq.png']),
('share/polkit-1/actions', ['data/br.com.stoq.createdatabase.policy']),
('$sysconfdir/stoq', '')])
resources = dict(
locale='$prefix/share/locale',
plugin='$prefix/lib/stoqlib/plugins',
)
global_resources = dict(
config='$sysconfdir/stoq',
csv='$datadir/csv',
docs='$prefix/share/doc/stoq',
glade='$datadir/glade',
uixml='$datadir/uixml',
html='$datadir/html',
misc='$datadir/misc',
pixmaps='$datadir/pixmaps',
sql='$datadir/sql',
template='$datadir/template',
)
PLUGINS = ['ecf', 'nfe', 'books', 'magento']
PLUGIN_EXTS = [('csv', '*csv'),
('glade', '*.ui'),
('sql', '*.sql'),
('sql', '*.py')]
data_files += listplugins(PLUGINS, PLUGIN_EXTS)
setup(name='stoq',
version=version,
author="Async Open Source",
author_email="stoq-devel@async.com.br",
description="A powerful retail system",
long_description="""
Stoq is an advanced retails system which has as main goals the
usability, good devices support, and useful features for retails.
""",
url=website,
license="GNU GPL 2.0 and GNU LGPL 2.1 (see COPYING and COPYING.stoqlib)",
packages=packages,
data_files=data_files,
scripts=scripts,
resources=resources,
install_requires=install_requires,
global_resources=global_resources,
templates=templates,
zip_safe=True)