[FIX] survey: display labels in the right order in survey reporting views
[odoo/odoo.git] / setup.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21
22 import glob, os, re, setuptools, sys
23 from os.path import join
24
25 # List all data files
26 def data():
27     r = {}
28     for root, dirnames, filenames in os.walk('openerp'):
29         for filename in filenames:
30             if not re.match(r'.*(\.pyc|\.pyo|\~)$', filename):
31                 r.setdefault(root, []).append(os.path.join(root, filename))
32
33     if os.name == 'nt':
34         r["Microsoft.VC90.CRT"] = glob.glob('C:\Microsoft.VC90.CRT\*.*')
35
36         import babel
37         # Add data, but also some .py files py2exe won't include automatically.
38         # TODO This should probably go under `packages`, instead of `data`,
39         # but this will work fine (especially since we don't use the ZIP file
40         # approach).
41         r["babel/localedata"] = glob.glob(os.path.join(os.path.dirname(babel.__file__), "localedata", '*'))
42         others = ['global.dat', 'numbers.py', 'support.py', 'plural.py']
43         r["babel"] = map(lambda f: os.path.join(os.path.dirname(babel.__file__), f), others)
44         others = ['frontend.py', 'mofile.py']
45         r["babel/messages"] = map(lambda f: os.path.join(os.path.dirname(babel.__file__), "messages", f), others)
46
47         import pytz
48         tzdir = os.path.dirname(pytz.__file__)
49         for root, _, filenames in os.walk(os.path.join(tzdir, "zoneinfo")):
50             base = os.path.join('pytz', root[len(tzdir) + 1:])
51             r[base] = [os.path.join(root, f) for f in filenames]
52
53         import docutils
54         dudir = os.path.dirname(docutils.__file__)
55         for root, _, filenames in os.walk(dudir):
56             base = os.path.join('docutils', root[len(dudir) + 1:])
57             r[base] = [os.path.join(root, f) for f in filenames if not f.endswith(('.py', '.pyc', '.pyo'))]
58
59     return r.items()
60
61 def gen_manifest():
62     file_list="\n".join(data())
63     open('MANIFEST','w').write(file_list)
64
65 if os.name == 'nt':
66     sys.path.append("C:\Microsoft.VC90.CRT")
67
68 def py2exe_options():
69     if os.name == 'nt':
70         import py2exe
71         return {
72             "console" : [ { "script": "openerp-server", "icon_resources": [(1, join("install","openerp-icon.ico"))], },
73                           { "script": "openerp-gevent" },
74                           { "script": "odoo.py" },
75             ],
76             'options' : {
77                 "py2exe": {
78                     "skip_archive": 1,
79                     "optimize": 0, # keep the assert running, because the integrated tests rely on them.
80                     "dist_dir": 'dist',
81                     "packages": [
82                         "HTMLParser",
83                         "PIL",
84                         "asynchat", "asyncore",
85                         "commands",
86                         "dateutil",
87                         "decimal",
88                         "docutils",
89                         "email",
90                         "encodings",
91                         "imaplib",
92                         "jinja2",
93                         "lxml", "lxml._elementpath", "lxml.builder", "lxml.etree", "lxml.objectify",
94                         "mako",
95                         "markupsafe",   # dependence of jinja2 and mako
96                         "mock",
97                         "openerp",
98                         "passlib",
99                         "poplib",
100                         "psutil",
101                         "pychart",
102                         "pydot",
103                         "pyparsing",
104                         "pytz",
105                         "reportlab",
106                         "requests",
107                         "select",
108                         "simplejson",
109                         "smtplib",
110                         "uuid",
111                         "vatnumber",
112                         "vobject",
113                         "win32service", "win32serviceutil",
114                         "xlwt",
115                         "xml", "xml.dom",
116                         "yaml",
117                     ],
118                     "excludes" : ["Tkconstants","Tkinter","tcl"],
119                 }
120             }
121         }
122     else:
123         return {}
124
125 execfile(join(os.path.dirname(__file__), 'openerp', 'release.py'))
126
127 # Notes for OpenERP developer on windows:
128 #
129 # To setup a windows developer evironement install python2.7 then pip and use
130 # "pip install <depencey>" for every dependency listed below.
131 #
132 # Dependecies that requires DLLs are not installable with pip install, for
133 # them we added comments with links where you can find the installers.
134 #
135 # OpenERP on windows also require the pywin32, the binary can be found at
136 # http://pywin32.sf.net
137 #
138 # Both python2.7 32bits and 64bits are known to work.
139
140 setuptools.setup(
141       name             = 'openerp',
142       version          = version,
143       description      = description,
144       long_description = long_desc,
145       url              = url,
146       author           = author,
147       author_email     = author_email,
148       classifiers      = filter(None, classifiers.split("\n")),
149       license          = license,
150       scripts          = ['openerp-server', 'openerp-gevent', 'odoo.py'],
151       data_files       = data(),
152       packages         = setuptools.find_packages(),
153       dependency_links = ['http://download.gna.org/pychart/'],
154       #include_package_data = True,
155       install_requires = [
156           'pychart', # not on pypi, use: pip install http://download.gna.org/pychart/PyChart-1.39.tar.gz
157           'babel >= 1.0',
158           'docutils',
159           'feedparser',
160           'gdata',
161           'gevent',
162           'psycogreen',
163           'Jinja2',
164           'lxml', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
165           'mako',
166           'mock',
167           'passlib',
168           'pillow', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
169           'psutil', # windows binary code.google.com/p/psutil/downloads/list
170           'psycopg2 >= 2.2',
171           'pydot',
172           'pyparsing < 2',
173           'pyserial',
174           'python-dateutil < 2',
175           'python-ldap', # optional
176           'python-openid',
177           'pytz',
178           'pyusb >= 1.0.0b1',
179           'pyyaml',
180           'qrcode',
181           'reportlab', # windows binary pypi.python.org/pypi/reportlab
182           'requests',
183           'simplejson',
184           'unittest2',
185           'vatnumber',
186           'vobject',
187           'werkzeug',
188           'xlwt',
189       ],
190       extras_require = {
191           'SSL' : ['pyopenssl'],
192       },
193       tests_require = ['unittest2', 'mock'],
194       **py2exe_options()
195 )
196
197
198 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: