[FIX] models: in onchange(), do not send a field value if it has not changed
[odoo/odoo.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import os
5 import re
6 from glob import glob
7 from setuptools import find_packages, setup
8 from os.path import join, dirname
9
10
11 execfile(join(dirname(__file__), 'openerp', 'release.py'))  # Load release variables
12 lib_name = 'openerp'
13
14
15 def py2exe_datafiles():
16     data_files = {}
17     data_files['Microsoft.VC90.CRT'] = glob('C:\Microsoft.VC90.CRT\*.*')
18
19     for root, dirnames, filenames in os.walk('openerp'):
20         for filename in filenames:
21             if not re.match(r'.*(\.pyc|\.pyo|\~)$', filename):
22                 data_files.setdefault(root, []).append(join(root, filename))
23
24     import babel
25     data_files['babel/localedata'] = glob(join(dirname(babel.__file__), 'localedata', '*'))
26     others = ['global.dat', 'numbers.py', 'support.py', 'plural.py']
27     data_files['babel'] = map(lambda f: join(dirname(babel.__file__), f), others)
28     others = ['frontend.py', 'mofile.py']
29     data_files['babel/messages'] = map(lambda f: join(dirname(babel.__file__), 'messages', f), others)
30
31     import pytz
32     tzdir = dirname(pytz.__file__)
33     for root, _, filenames in os.walk(join(tzdir, 'zoneinfo')):
34         base = join('pytz', root[len(tzdir) + 1:])
35         data_files[base] = [join(root, f) for f in filenames]
36
37     import docutils
38     dudir = dirname(docutils.__file__)
39     for root, _, filenames in os.walk(dudir):
40         base = join('docutils', root[len(dudir) + 1:])
41         data_files[base] = [join(root, f) for f in filenames if not f.endswith(('.py', '.pyc', '.pyo'))]
42
43     return data_files.items()
44
45
46 def py2exe_options():
47     if os.name == 'nt':
48         import py2exe
49         return {
50             'console': [
51                 {'script': 'odoo.py'},
52                 {'script': 'openerp-gevent'},
53                 {'script': 'openerp-server', 'icon_resources': [
54                     (1, join('setup', 'win32', 'static', 'pixmaps', 'openerp-icon.ico'))
55                 ]},
56             ],
57             'options': {
58                 'py2exe': {
59                     'skip_archive': 1,
60                     'optimize': 0,  # Keep the assert running as the integrated tests rely on them.
61                     'dist_dir': 'dist',
62                     'packages': [
63                         'asynchat', 'asyncore',
64                         'commands',
65                         'dateutil',
66                         'decimal',
67                         'decorator',
68                         'docutils',
69                         'email',
70                         'encodings',
71                         'HTMLParser',
72                         'imaplib',
73                         'jinja2',
74                         'lxml', 'lxml._elementpath', 'lxml.builder', 'lxml.etree', 'lxml.objectify',
75                         'mako',
76                         'markupsafe',
77                         'mock',
78                         'openerp',
79                         'openid',
80                         'PIL',
81                         'poplib',
82                         'psutil',
83                         'pychart',
84                         'pydot',
85                         'pyparsing',
86                         'pyPdf',
87                         'pytz',
88                         'reportlab',
89                         'requests',
90                         'select',
91                         'simplejson',
92                         'smtplib',
93                         'uuid',
94                         'vatnumber',
95                         'vobject',
96                         'win32service', 'win32serviceutil',
97                         'xlwt',
98                         'xml', 'xml.dom',
99                         'yaml',
100                     ],
101                     'excludes': ['Tkconstants', 'Tkinter', 'tcl'],
102                 }
103             },
104             'data_files': py2exe_datafiles()
105         }
106     else:
107         return {}
108
109
110 setup(
111     name='openerp',
112     version=version,
113     description=description,
114     long_description=long_desc,
115     url=url,
116     author=author,
117     author_email=author_email,
118     classifiers=filter(None, classifiers.split('\n')),
119     license=license,
120     scripts=['openerp-server', 'openerp-gevent', 'odoo.py'],
121     packages=find_packages(),
122     package_dir={'%s' % lib_name: 'openerp'},
123     include_package_data=True,
124     dependency_links=['http://download.gna.org/pychart/'],
125     install_requires=[
126         'babel >= 1.0',
127         'decorator',
128         'docutils',
129         'feedparser',
130         'gevent',
131         'Jinja2',
132         'lxml',  # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
133         'mako',
134         'mock',
135         'passlib',
136         'pillow',  # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
137         'psutil',  # windows binary code.google.com/p/psutil/downloads/list
138         'psycogreen',
139         'psycopg2 >= 2.2',
140         'pychart',  # not on pypi, use: pip install http://download.gna.org/pychart/PyChart-1.39.tar.gz
141         'pydot',
142         'pyparsing < 2',
143         'pypdf',
144         'pyserial',
145         'python-dateutil',
146         'python-ldap',  # optional
147         'python-openid',
148         'pytz',
149         'pyusb >= 1.0.0b1',
150         'pyyaml',
151         'qrcode',
152         'reportlab',  # windows binary pypi.python.org/pypi/reportlab
153         'requests',
154         'simplejson',
155         'unittest2',
156         'vatnumber',
157         'vobject',
158         'werkzeug',
159         'xlwt',
160     ],
161     extras_require={
162         'SSL': ['pyopenssl'],
163     },
164     tests_require=[
165         'unittest2',
166         'mock',
167     ],
168     **py2exe_options()
169 )