2006-12-07 13:41:40 +00:00
|
|
|
#!/usr/bin/env python
|
2008-07-23 15:01:27 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
2008-06-16 11:00:21 +00:00
|
|
|
##############################################################################
|
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
|
|
|
# $Id$
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# 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 General Public License for more details.
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
##############################################################################
|
2008-11-03 18:20:13 +00:00
|
|
|
|
2006-12-07 13:41:40 +00:00
|
|
|
# setup from TinERP
|
|
|
|
# taken from straw http://www.nongnu.org/straw/index.html
|
|
|
|
# taken from gnomolicious http://www.nongnu.org/gnomolicious/
|
|
|
|
# adapted by Nicolas Évrard <nicoe@altern.org>
|
|
|
|
#
|
|
|
|
|
|
|
|
import imp
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import glob
|
|
|
|
|
|
|
|
from distutils.core import setup, Command
|
2008-11-25 13:23:25 +00:00
|
|
|
from distutils.command.install import install
|
2006-12-07 13:41:40 +00:00
|
|
|
|
2007-06-13 14:15:32 +00:00
|
|
|
if os.name == 'nt':
|
|
|
|
import py2exe
|
|
|
|
|
|
|
|
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "bin"))
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
opj = os.path.join
|
|
|
|
|
2007-06-13 14:15:32 +00:00
|
|
|
execfile(opj('bin', 'release.py'))
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
# get python short version
|
|
|
|
py_short_version = '%s.%s' % sys.version_info[:2]
|
|
|
|
|
2008-11-13 10:29:37 +00:00
|
|
|
required_modules = [
|
2008-12-08 14:04:45 +00:00
|
|
|
('psycopg2', 'PostgreSQL module'),
|
2008-11-13 10:29:37 +00:00
|
|
|
('xml', 'XML Tools for python'),
|
|
|
|
('libxml2', 'libxml2 python bindings'),
|
2008-11-14 15:09:32 +00:00
|
|
|
('libxslt', 'libxslt python bindings'),
|
|
|
|
('reportlab', 'reportlab module'),
|
|
|
|
('pychart', 'pychart module'),
|
|
|
|
('pydot', 'pydot module'),
|
2008-11-13 10:29:37 +00:00
|
|
|
]
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
def check_modules():
|
|
|
|
ok = True
|
|
|
|
for modname, desc in required_modules:
|
|
|
|
try:
|
|
|
|
exec('import %s' % modname)
|
|
|
|
except ImportError:
|
|
|
|
ok = False
|
|
|
|
print 'Error: python module %s (%s) is required' % (modname, desc)
|
|
|
|
|
|
|
|
if not ok:
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
def find_addons():
|
2007-06-13 14:15:32 +00:00
|
|
|
for (dp, dn, names) in os.walk(opj('bin', 'addons')):
|
2008-12-01 11:38:48 +00:00
|
|
|
if '__init__.py' in names:
|
|
|
|
modname = dp.replace(os.path.sep, '.').replace('bin', 'openerp-server', 1)
|
|
|
|
yield modname
|
2006-12-07 13:41:40 +00:00
|
|
|
|
|
|
|
def data_files():
|
|
|
|
'''Build list of data files to be installed'''
|
2007-06-13 14:15:32 +00:00
|
|
|
files = []
|
|
|
|
if os.name == 'nt':
|
|
|
|
os.chdir('bin')
|
|
|
|
for (dp,dn,names) in os.walk('addons'):
|
2008-11-13 10:29:37 +00:00
|
|
|
files.append((dp, map(lambda x: opj('bin', dp, x), names)))
|
2007-06-13 14:15:32 +00:00
|
|
|
os.chdir('..')
|
|
|
|
for (dp,dn,names) in os.walk('doc'):
|
2008-11-13 10:29:37 +00:00
|
|
|
files.append((dp, map(lambda x: opj(dp, x), names)))
|
2008-12-19 12:49:07 +00:00
|
|
|
files.append(('.', [opj('bin', 'import_xml.rng'),
|
|
|
|
opj('bin', 'server.pkey'),
|
|
|
|
opj('bin', 'server.cert')]))
|
2007-06-13 14:15:32 +00:00
|
|
|
else:
|
2008-11-13 10:29:37 +00:00
|
|
|
man_directory = opj('share', 'man')
|
|
|
|
files.append((opj(man_directory, 'man1'), ['man/openerp-server.1']))
|
|
|
|
files.append((opj(man_directory, 'man5'), ['man/openerp_serverrc.5']))
|
|
|
|
|
|
|
|
doc_directory = opj('share', 'doc', 'openerp-server-%s' % version)
|
|
|
|
files.append((doc_directory, [f for f in glob.glob('doc/*') if os.path.isfile(f)]))
|
|
|
|
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)]))
|
|
|
|
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)]))
|
|
|
|
|
|
|
|
openerp_site_packages = opj('lib', 'python%s' % py_short_version, 'site-packages', 'openerp-server')
|
|
|
|
|
2008-12-22 19:18:22 +00:00
|
|
|
files.append((openerp_site_packages, [opj('bin', 'import_xml.rng'),
|
|
|
|
opj('bin', 'server.pkey'),
|
|
|
|
opj('bin', 'server.cert')]))
|
|
|
|
|
2007-06-13 14:15:32 +00:00
|
|
|
for addon in find_addons():
|
2008-11-13 10:29:37 +00:00
|
|
|
add_path = addon.replace('.', os.path.sep).replace('openerp-server', 'bin', 1)
|
|
|
|
addon_path = opj('lib', 'python%s' % py_short_version, 'site-packages', add_path.replace('bin', 'openerp-server', 1))
|
2008-12-01 11:38:48 +00:00
|
|
|
pathfiles = []
|
|
|
|
for root, dirs, innerfiles in os.walk(add_path):
|
|
|
|
innerfiles = filter(lambda file: os.path.splitext(file)[1] not in ('.pyc', '.py', '.pyd', '.pyo'), innerfiles)
|
|
|
|
if innerfiles:
|
|
|
|
pathfiles.extend(((opj(addon_path, root.replace('bin/addons/', '')), map(lambda file: opj(root, file), innerfiles)),))
|
2007-06-13 14:15:32 +00:00
|
|
|
files.extend(pathfiles)
|
2006-12-07 13:41:40 +00:00
|
|
|
return files
|
|
|
|
|
|
|
|
check_modules()
|
|
|
|
|
2008-11-29 07:54:39 +00:00
|
|
|
f = file('openerp-server','w')
|
2008-12-15 10:10:13 +00:00
|
|
|
start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage\n" """
|
2008-11-29 07:54:39 +00:00
|
|
|
f.write(start_script)
|
|
|
|
f.close()
|
2008-11-28 14:09:52 +00:00
|
|
|
|
2008-11-25 13:23:25 +00:00
|
|
|
class openerp_server_install(install):
|
|
|
|
def run(self):
|
|
|
|
# create startup script
|
|
|
|
start_script = "#!/bin/sh\ncd %s\nexec %s ./openerp-server.py $@\n" % (opj(self.install_libbase, "openerp-server"), sys.executable)
|
|
|
|
# write script
|
|
|
|
f = open('openerp-server', 'w')
|
|
|
|
f.write(start_script)
|
|
|
|
f.close()
|
|
|
|
install.run(self)
|
2006-12-07 13:41:40 +00:00
|
|
|
|
2008-11-13 10:29:37 +00:00
|
|
|
options = {
|
|
|
|
"py2exe": {
|
2008-11-21 14:04:46 +00:00
|
|
|
"compressed": 1,
|
2008-11-13 10:29:37 +00:00
|
|
|
"optimize": 2,
|
|
|
|
"packages": ["lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
|
|
|
|
"lxml.objectify", "decimal", "xml", "xml.dom", "xml.xpath",
|
|
|
|
"encodings","mx.DateTime","wizard","pychart","PIL", "pyparsing",
|
2008-12-19 12:49:07 +00:00
|
|
|
"pydot","asyncore","asynchat", "reportlab", "vobject",
|
|
|
|
"HTMLParser", "OpenSSL", "select"],
|
2008-11-13 10:29:37 +00:00
|
|
|
"excludes" : ["Tkconstants","Tkinter","tcl"],
|
|
|
|
}
|
|
|
|
}
|
2007-06-13 14:15:32 +00:00
|
|
|
|
2006-12-07 13:41:40 +00:00
|
|
|
setup(name = name,
|
|
|
|
version = version,
|
2007-06-13 14:15:32 +00:00
|
|
|
description = description,
|
2006-12-07 13:41:40 +00:00
|
|
|
long_description = long_desc,
|
2007-06-13 14:15:32 +00:00
|
|
|
url = url,
|
|
|
|
author = author,
|
|
|
|
author_email = author_email,
|
2006-12-07 13:41:40 +00:00
|
|
|
classifiers = filter(None, classifiers.split("\n")),
|
2007-06-13 14:15:32 +00:00
|
|
|
license = license,
|
2006-12-07 13:41:40 +00:00
|
|
|
data_files = data_files(),
|
2008-11-29 07:54:39 +00:00
|
|
|
cmdclass = {
|
|
|
|
'install' : openerp_server_install,
|
|
|
|
},
|
2008-09-10 08:46:40 +00:00
|
|
|
scripts = ['openerp-server'],
|
2008-11-13 10:29:37 +00:00
|
|
|
packages = ['openerp-server',
|
|
|
|
'openerp-server.addons',
|
2008-09-10 08:46:40 +00:00
|
|
|
'openerp-server.ir',
|
|
|
|
'openerp-server.osv',
|
2008-11-13 10:29:37 +00:00
|
|
|
'openerp-server.service',
|
|
|
|
'openerp-server.tools',
|
2008-09-10 08:46:40 +00:00
|
|
|
'openerp-server.report',
|
|
|
|
'openerp-server.report.printscreen',
|
|
|
|
'openerp-server.report.render',
|
|
|
|
'openerp-server.report.render.rml2pdf',
|
|
|
|
'openerp-server.report.render.rml2html',
|
2008-11-13 10:29:37 +00:00
|
|
|
'openerp-server.wizard',
|
|
|
|
'openerp-server.workflow'] + \
|
2006-12-07 13:41:40 +00:00
|
|
|
list(find_addons()),
|
2008-09-10 08:46:40 +00:00
|
|
|
package_dir = {'openerp-server': 'bin'},
|
2008-12-15 10:10:13 +00:00
|
|
|
console = [ { "script" : "bin\\openerp-server.py", "icon_resources" : [ (1,"pixmaps\\openerp-icon.ico") ] } ],
|
2007-06-13 14:15:32 +00:00
|
|
|
options = options,
|
2006-12-07 13:41:40 +00:00
|
|
|
)
|
|
|
|
|
2008-07-23 15:01:27 +00:00
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|