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