2 # -*- coding: utf-8 -*-
4 # taken from straw http://www.nongnu.org/straw/index.html
5 # taken from gnomolicious http://www.nongnu.org/gnomolicious/
6 # adapted by Nicolas Évrard <nicoe@altern.org>
13 from stat
import ST_MODE
15 from distutils
.file_util
import copy_file
16 from distutils
.core
import setup
17 from mydistutils
import L10nAppDistribution
22 sys
.path
.append(os
.path
.join(os
.path
.abspath(os
.path
.dirname(__file__
)), "bin"))
26 execfile(opj('bin', 'release.py'))
29 # get python short version
30 py_short_version
= '%s.%s' % sys
.version_info
[:2]
32 required_modules
= [('gtk', 'gtk python bindings'),
33 ('gtk.glade', 'glade python bindings'),
34 ('mx.DateTime', 'date and time handling routines for Python')]
38 for modname
, desc
in required_modules
:
40 exec('import %s' % modname
)
43 print 'Error: python module %s (%s) is required' % (modname
, desc
)
49 '''Build list of data files to be installed'''
53 datafiles
= matplotlib
.get_py2exe_datafiles()
54 if isinstance(datafiles
, list):
55 files
.extend(datafiles
)
57 files
.append(datafiles
)
59 for (dp
,dn
,names
) in os
.walk('themes'):
62 files
.append((dp
, map(lambda x
: opj('bin', dp
,x
), names
)))
63 for (dp
, dn
, names
) in os
.walk('share\\locale'):
66 files
.append((dp
, map(lambda x
: opj('bin', dp
, x
), names
)))
68 files
.append((".",["bin\\terp.glade", 'bin\\tipoftheday.txt', 'doc\\README.txt']))
69 files
.append(("pixmaps", glob
.glob("bin\\pixmaps\\*.*")))
70 files
.append(("po", glob
.glob("bin\\po\\*.*")))
71 files
.append(("icons", glob
.glob("bin\\icons\\*.png")))
72 files
.append(("share\\locale", glob
.glob("bin\\share\\locale\\*.*")))
74 files
.append((opj('share','man','man1',''),['man/tinyerp-client.1']))
75 files
.append((opj('share','doc', 'tinyerp-client-%s' % version
), [f
for
76 f
in glob
.glob('doc/*') if os
.path
.isfile(f
)]))
77 files
.append((opj('share', 'pixmaps', 'tinyerp-client'),
78 glob
.glob('bin/pixmaps/*.png')))
79 files
.append((opj('share', 'pixmaps', 'tinyerp-client', 'icons'),
80 glob
.glob('bin/icons/*.png')))
81 files
.append((opj('share', 'tinyerp-client'), ['bin/terp.glade',
82 'bin/tipoftheday.txt']))
85 included_plugins
= ['workflow_print']
88 for plugin
in included_plugins
:
89 path
=opj('bin', 'plugins', plugin
)
90 for dirpath
, dirnames
, filenames
in os
.walk(path
):
91 if '__init__.py' in filenames
:
92 modname
= dirpath
.replace(os
.path
.sep
, '.')
93 yield modname
.replace('bin', 'tinyerp-client', 1)
97 dest
= 'share/locale/%s/LC_MESSAGES/%s.mo'
98 for po
in glob
.glob('bin/po/*.po'):
99 lang
= os
.path
.splitext(os
.path
.basename(po
))[0]
100 trans
.append((dest
% (lang
, name
), po
))
105 # create startup script
108 cd %s/lib/python%s/site-packages/tinyerp-client\n\
109 exec %s ./tinyerp-client.py $@" % (sys
.prefix
, py_short_version
, sys
.executable
)
111 f
= open('tinyerp-client', 'w')
112 f
.write(start_script
)
115 if os
.name
<> 'nt' and sys
.argv
[1] == 'build_po':
116 os
.system('(cd bin ; find . -name \*.py && find . -name \*.glade | xargs xgettext -o po/%s.pot)' % name
)
117 for file in ([ os
.path
.join('bin', 'po', fname
) for fname
in os
.listdir('bin/po') ]):
118 if os
.path
.isfile(file):
119 os
.system('msgmerge --update --backup=off %s bin/po/%s.pot' % (file, name
))
122 options
= {"py2exe": {"compressed": 1,
124 "packages": ["encodings","gtk", "matplotlib", "pytz"],
125 "includes": "pango,atk,gobject,cairo,atk,pangocairo",
126 "excludes": ["Tkinter", "tcl", "TKconstants"],
128 "iconv.dll","intl.dll","libatk-1.0-0.dll",
129 "libgdk_pixbuf-2.0-0.dll","libgdk-win32-2.0-0.dll",
130 "libglib-2.0-0.dll","libgmodule-2.0-0.dll",
131 "libgobject-2.0-0.dll","libgthread-2.0-0.dll",
132 "libgtk-win32-2.0-0.dll","libpango-1.0-0.dll",
133 "libpangowin32-1.0-0.dll",
134 "wxmsw26uh_vc.dll",],
140 description
= description
,
141 long_description
= long_desc
,
144 author_email
= author_email
,
145 classifiers
= filter(None, classifiers
.splitlines()),
147 data_files
= data_files(),
148 translations
= translations(),
149 scripts
= ['tinyerp-client'],
150 packages
= ['tinyerp-client', 'tinyerp-client.common',
151 'tinyerp-client.modules', 'tinyerp-client.modules.action',
152 'tinyerp-client.modules.gui',
153 'tinyerp-client.modules.gui.window',
154 'tinyerp-client.modules.gui.window.view_sel',
155 'tinyerp-client.modules.gui.window.view_tree',
156 'tinyerp-client.modules.spool',
157 'tinyerp-client.printer', 'tinyerp-client.tools',
158 'tinyerp-client.tinygraph',
159 'tinyerp-client.widget',
160 'tinyerp-client.widget.model',
161 'tinyerp-client.widget.screen',
162 'tinyerp-client.widget.view',
163 'tinyerp-client.widget.view.form_gtk',
164 'tinyerp-client.widget.view.tree_gtk',
165 'tinyerp-client.widget.view.graph_gtk',
166 'tinyerp-client.widget.view.calendar_gtk',
167 'tinyerp-client.widget_search',
168 'tinyerp-client.plugins'] + list(find_plugins()),
169 package_dir
= {'tinyerp-client': 'bin'},
170 distclass
= os
.name
<> 'nt' and L10nAppDistribution
or None,
171 windows
=[{"script":"bin\\tinyerp-client.py", "icon_resources":[(1,"bin\\pixmaps\\tinyerp.ico")]}],
176 # vim:expandtab:tw=80