2 ##############################################################################
4 # Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
15 # This program is Free Software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 ###############################################################################
29 # -*- coding: utf-8 -*-
31 # taken from straw http://www.nongnu.org/straw/index.html
32 # taken from gnomolicious http://www.nongnu.org/gnomolicious/
33 # adapted by Nicolas Évrard <nicoe@altern.org>
40 from stat
import ST_MODE
42 from distutils
.file_util
import copy_file
43 from distutils
.core
import setup
44 from mydistutils
import L10nAppDistribution
49 sys
.path
.append(os
.path
.join(os
.path
.abspath(os
.path
.dirname(__file__
)), "bin"))
53 execfile(opj('bin', 'release.py'))
56 # get python short version
57 py_short_version
= '%s.%s' % sys
.version_info
[:2]
59 required_modules
= [('gtk', 'gtk python bindings'),
60 ('gtk.glade', 'glade python bindings'),
61 ('mx.DateTime', 'date and time handling routines for Python')]
65 for modname
, desc
in required_modules
:
67 exec('import %s' % modname
)
70 print 'Error: python module %s (%s) is required' % (modname
, desc
)
76 '''Build list of data files to be installed'''
80 datafiles
= matplotlib
.get_py2exe_datafiles()
81 if isinstance(datafiles
, list):
82 files
.extend(datafiles
)
84 files
.append(datafiles
)
86 for (dp
,dn
,names
) in os
.walk('themes'):
89 files
.append((dp
, map(lambda x
: opj('bin', dp
,x
), names
)))
90 for (dp
, dn
, names
) in os
.walk('share\\locale'):
93 files
.append((dp
, map(lambda x
: opj('bin', dp
, x
), names
)))
95 files
.append((".",["bin\\terp.glade", 'bin\\tipoftheday.txt', 'doc\\README.txt']))
96 files
.append(("pixmaps", glob
.glob("bin\\pixmaps\\*.*")))
97 files
.append(("po", glob
.glob("bin\\po\\*.*")))
98 files
.append(("icons", glob
.glob("bin\\icons\\*.png")))
99 files
.append(("share\\locale", glob
.glob("bin\\share\\locale\\*.*")))
101 files
.append((opj('share','man','man1',''),['man/tinyerp-client.1']))
102 files
.append((opj('share','doc', 'tinyerp-client-%s' % version
), [f
for
103 f
in glob
.glob('doc/*') if os
.path
.isfile(f
)]))
104 files
.append((opj('share', 'pixmaps', 'tinyerp-client'),
105 glob
.glob('bin/pixmaps/*.png')))
106 files
.append((opj('share', 'pixmaps', 'tinyerp-client', 'icons'),
107 glob
.glob('bin/icons/*.png')))
108 files
.append((opj('share', 'tinyerp-client'), ['bin/terp.glade',
109 'bin/tipoftheday.txt']))
112 included_plugins
= ['workflow_print']
115 for plugin
in included_plugins
:
116 path
=opj('bin', 'plugins', plugin
)
117 for dirpath
, dirnames
, filenames
in os
.walk(path
):
118 if '__init__.py' in filenames
:
119 modname
= dirpath
.replace(os
.path
.sep
, '.')
120 yield modname
.replace('bin', 'tinyerp-client', 1)
124 dest
= 'share/locale/%s/LC_MESSAGES/%s.mo'
125 for po
in glob
.glob('bin/po/*.po'):
126 lang
= os
.path
.splitext(os
.path
.basename(po
))[0]
127 trans
.append((dest
% (lang
, name
), po
))
132 # create startup script
135 cd %s/lib/python%s/site-packages/tinyerp-client\n\
136 exec %s ./tinyerp-client.py $@" % (sys
.prefix
, py_short_version
, sys
.executable
)
138 f
= open('tinyerp-client', 'w')
139 f
.write(start_script
)
142 if os
.name
<> 'nt' and sys
.argv
[1] == 'build_po':
143 os
.system('(cd bin ; find . -name \*.py && find . -name \*.glade | xargs xgettext -o po/%s.pot)' % name
)
144 for file in ([ os
.path
.join('bin', 'po', fname
) for fname
in os
.listdir('bin/po') ]):
145 if os
.path
.isfile(file):
146 os
.system('msgmerge --update --backup=off %s bin/po/%s.pot' % (file, name
))
149 options
= {"py2exe": {"compressed": 1,
151 "packages": ["encodings","gtk", "matplotlib", "pytz"],
152 "includes": "pango,atk,gobject,cairo,atk,pangocairo",
153 "excludes": ["Tkinter", "tcl", "TKconstants"],
155 "iconv.dll","intl.dll","libatk-1.0-0.dll",
156 "libgdk_pixbuf-2.0-0.dll","libgdk-win32-2.0-0.dll",
157 "libglib-2.0-0.dll","libgmodule-2.0-0.dll",
158 "libgobject-2.0-0.dll","libgthread-2.0-0.dll",
159 "libgtk-win32-2.0-0.dll","libpango-1.0-0.dll",
160 "libpangowin32-1.0-0.dll",
161 "wxmsw26uh_vc.dll",],
167 description
= description
,
168 long_description
= long_desc
,
171 author_email
= author_email
,
172 classifiers
= filter(None, classifiers
.splitlines()),
174 data_files
= data_files(),
175 translations
= translations(),
176 scripts
= ['tinyerp-client'],
177 packages
= ['tinyerp-client', 'tinyerp-client.common',
178 'tinyerp-client.modules', 'tinyerp-client.modules.action',
179 'tinyerp-client.modules.gui',
180 'tinyerp-client.modules.gui.window',
181 'tinyerp-client.modules.gui.window.view_sel',
182 'tinyerp-client.modules.gui.window.view_tree',
183 'tinyerp-client.modules.spool',
184 'tinyerp-client.printer', 'tinyerp-client.tools',
185 'tinyerp-client.tinygraph',
186 'tinyerp-client.widget',
187 'tinyerp-client.widget.model',
188 'tinyerp-client.widget.screen',
189 'tinyerp-client.widget.view',
190 'tinyerp-client.widget.view.form_gtk',
191 'tinyerp-client.widget.view.tree_gtk',
192 'tinyerp-client.widget.view.graph_gtk',
193 'tinyerp-client.widget.view.calendar_gtk',
194 'tinyerp-client.widget_search',
195 'tinyerp-client.plugins'] + list(find_plugins()),
196 package_dir
= {'tinyerp-client': 'bin'},
197 distclass
= os
.name
<> 'nt' and L10nAppDistribution
or None,
198 windows
=[{"script":"bin\\tinyerp-client.py", "icon_resources":[(1,"bin\\pixmaps\\tinyerp.ico")]}],
203 # vim:expandtab:tw=80