2 # -*- coding: utf-8 -*-
3 ##############################################################################
5 # OpenERP, Open Source Management Solution
6 # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
24 # taken from straw http://www.nongnu.org/straw/index.html
25 # taken from gnomolicious http://www.nongnu.org/gnomolicious/
26 # adapted by Nicolas Évrard <nicoe@altern.org>
28 # doc/migrate is not included since about 6.1-dev
29 # doc/tests is not included
30 # python25-compat/*py should be in the openerp (and imported appropriately)
34 from os.path import join, isfile
37 from setuptools import setup, find_packages
39 # Backports os.walk with followlinks from python 2.6.
40 # Needed to add all addons files to data_files for Windows packaging.
41 def walk_followlinks(top, topdown=True, onerror=None, followlinks=False):
42 from os.path import join, isdir, islink
43 from os import listdir, error
48 if onerror is not None:
52 dirs, nondirs = [], []
54 if isdir(join(top, name)):
60 yield top, dirs, nondirs
62 path = join(top, name)
63 if followlinks or not islink(path):
64 for x in walk_followlinks(path, topdown, onerror, followlinks):
67 yield top, dirs, nondirs
69 if sys.version_info < (2, 6):
70 os.walk = walk_followlinks
73 py2exe_data_files = []
76 py2exe_keywords['console'] = [
77 { "script": "openerp-server",
78 "icon_resources": [(1, join("pixmaps","openerp-icon.ico"))],
80 py2exe_keywords['options'] = {
86 "lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
87 "lxml.objectify", "decimal", "xml", "xml", "xml.dom", "xml.xpath",
88 "encodings", "dateutil", "pychart", "PIL", "pyparsing",
89 "pydot", "asyncore","asynchat", "reportlab", "vobject",
90 "HTMLParser", "select", "mako", "poplib",
91 "imaplib", "smtplib", "email", "yaml", "DAV",
92 "uuid", "commands", "openerp", "simplejson", "vatnumber"
94 "excludes" : ["Tkconstants","Tkinter","tcl"],
97 # TODO is it still necessary now that we don't use the library.zip file?
99 '''For Windows, we consider all the addons as data files.
100 It seems also that package_data below isn't honored by py2exe.'''
103 for (dp, dn, names) in os.walk('addons'):
104 files.append((join('openerp',dp), map(lambda x: join('openerp', dp, x), names)))
106 files.append(('openerp', [join('openerp', 'import_xml.rng'),]))
109 # TODO check if we have to also copy dateutil's timezone data.
111 # Make sure the layout of pytz hasn't changed
112 assert (pytz.__file__.endswith('__init__.pyc') or
113 pytz.__file__.endswith('__init__.py')), pytz.__file__
114 pytz_dir = os.path.dirname(pytz.__file__)
116 saved_dir = os.getcwd()
118 for dp, dn, names in os.walk('zoneinfo'):
119 files.append((join('pytz',dp), map(lambda x: join(pytz_dir, dp, x), names)))
123 py2exe_data_files = data_files()
125 execfile(join('openerp', 'release.py'))
129 description = description,
130 long_description = long_desc,
133 author_email = author_email,
134 classifiers = filter(None, classifiers.split("\n")),
137 (join('man', 'man1'), ['man/openerp-server.1']),
138 (join('man', 'man5'), ['man/openerp_serverrc.5']),
139 ('doc', filter(isfile, glob.glob('doc/*'))),
140 ] + py2exe_data_files,
141 scripts = ['openerp-server'],
142 packages = find_packages(),
143 include_package_data = True,
145 '': ['*.yml', '*.xml', '*.po', '*.pot', '*.csv'],
147 dependency_links = ['http://download.gna.org/pychart/'],
149 # We require the same version as caldav for lxml.
154 # TODO the pychart package we include in openerp corresponds to PyChart 1.37.
155 # It seems there is a single difference, which is a spurious print in generate_docs.py.
156 # It is probably safe to move to PyChart 1.39 (the latest one).
157 # (Let setup.py choose the latest one, and we should check we can remove pychart from
168 'vatnumber', # required by base_vat module
171 'SSL' : ['pyopenssl'],