2 # -*- encoding: utf-8 -*-
3 ##############################################################################
5 # OpenERP, Open Source Management Solution
6 # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ##############################################################################
25 # taken from straw http://www.nongnu.org/straw/index.html
26 # taken from gnomolicious http://www.nongnu.org/gnomolicious/
27 # adapted by Nicolas Évrard <nicoe@altern.org>
35 from distutils.core import setup, Command
36 from distutils.command.install import install
41 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "bin"))
45 execfile(opj('bin', 'release.py'))
47 # get python short version
48 py_short_version = '%s.%s' % sys.version_info[:2]
51 ('psycopg2', 'PostgreSQL module'),
52 ('xml', 'XML Tools for python'),
53 ('libxml2', 'libxml2 python bindings'),
54 ('libxslt', 'libxslt python bindings'),
55 ('reportlab', 'reportlab module'),
56 ('pychart', 'pychart module'),
57 ('pydot', 'pydot module'),
62 for modname, desc in required_modules:
64 exec('import %s' % modname)
67 print 'Error: python module %s (%s) is required' % (modname, desc)
73 for (dp, dn, names) in os.walk(opj('bin', 'addons')):
74 if '__init__.py' in names:
75 modname = dp.replace(os.path.sep, '.').replace('bin', 'openerp-server', 1)
79 '''Build list of data files to be installed'''
83 for (dp,dn,names) in os.walk('addons'):
84 files.append((dp, map(lambda x: opj('bin', dp, x), names)))
86 for (dp,dn,names) in os.walk('doc'):
87 files.append((dp, map(lambda x: opj(dp, x), names)))
88 files.append(('.', [opj('bin', 'import_xml.rng'),
89 opj('bin', 'server.pkey'),
90 opj('bin', 'server.cert')]))
92 man_directory = opj('share', 'man')
93 files.append((opj(man_directory, 'man1'), ['man/openerp-server.1']))
94 files.append((opj(man_directory, 'man5'), ['man/openerp_serverrc.5']))
96 doc_directory = opj('share', 'doc', 'openerp-server-%s' % version)
97 files.append((doc_directory, [f for f in glob.glob('doc/*') if os.path.isfile(f)]))
98 files.append((opj(doc_directory, 'migrate', '3.3.0-3.4.0'), [f for f in glob.glob('doc/migrate/3.3.0-3.4.0/*') if os.path.isfile(f)]))
99 files.append((opj(doc_directory, 'migrate', '3.4.0-4.0.0'), [f for f in glob.glob('doc/migrate/3.4.0-4.0.0/*') if os.path.isfile(f)]))
101 openerp_site_packages = opj('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server')
103 for addon in find_addons():
104 add_path = addon.replace('.', os.path.sep).replace('openerp-server', 'bin', 1)
105 addon_path = opj('lib', 'python%s' % py_short_version, 'site-packages', add_path.replace('bin', 'openerp-server', 1))
107 for root, dirs, innerfiles in os.walk(add_path):
108 innerfiles = filter(lambda file: os.path.splitext(file)[1] not in ('.pyc', '.py', '.pyd', '.pyo'), innerfiles)
110 pathfiles.extend(((opj(addon_path, root.replace('bin/addons/', '')), map(lambda file: opj(root, file), innerfiles)),))
111 files.extend(pathfiles)
116 f = file('openerp-server','w')
117 start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage\n" """
118 f.write(start_script)
121 class openerp_server_install(install):
123 # create startup script
124 start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-server.py $@\n" % (opj(self.install_libbase, "openerp-server"), sys.executable)
126 f = open('openerp-server', 'w')
127 f.write(start_script)
135 "packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
136 "lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath",
137 "encodings","mx.DateTime","wizard","pychart","PIL", "pyparsing",
138 "pydot","asyncore","asynchat", "reportlab", "vobject",
139 "HTMLParser", "OpenSSL", "select"],
140 "excludes" : ["Tkconstants","Tkinter","tcl"],
146 description = description,
147 long_description = long_desc,
150 author_email = author_email,
151 classifiers = filter(None, classifiers.split("\n")),
153 data_files = data_files(),
155 'install' : openerp_server_install,
157 scripts = ['openerp-server'],
158 packages = ['openerp-server',
159 'openerp-server.addons',
161 'openerp-server.osv',
162 'openerp-server.service',
163 'openerp-server.tools',
164 'openerp-server.report',
165 'openerp-server.report.printscreen',
166 'openerp-server.report.render',
167 'openerp-server.report.render.rml2pdf',
168 'openerp-server.report.render.rml2html',
169 'openerp-server.wizard',
170 'openerp-server.workflow'] + \
172 package_dir = {'openerp-server': 'bin'},
173 console = [ { "script" : "bin\\openerp-server.py", "icon_resources" : [ (1,"pixmaps\\openerp-icon.ico") ] } ],
178 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: