[FIX] setup.py: add pytz data files on windows
[odoo/odoo.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 ##############################################################################
4 #
5 #    OpenERP, Open Source Management Solution
6 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7 #
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.
12 #
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.
17 #
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/>.
20 #
21 ##############################################################################
22
23 import glob, os, re, setuptools, sys
24 from os.path import join, isfile
25
26 # List all data files
27 def data():
28     files = []
29     for root, dirnames, filenames in os.walk('openerp'):
30         for filename in filenames:
31             if not re.match(r'.*(\.pyc|\.pyo|\~)$',filename):
32                 files.append(os.path.join(root, filename))
33     d = {}
34     for v in files:
35         k=os.path.dirname(v)
36         if k in d:
37             d[k].append(v)
38         else:
39             d[k]=[v]
40     r = d.items()
41     if os.name == 'nt':
42         r.append(("Microsoft.VC90.CRT", glob.glob('C:\Microsoft.VC90.CRT\*.*')))
43
44         import babel
45         r.append(("localedata",
46                   glob.glob(os.path.join(os.path.dirname(babel.__file__), "localedata", '*'))))
47
48         import pytz
49         r.append((os.path.join("pytz", "zoneinfo"),
50                   glob.glob(os.path.join(os.path.dirname(pytz.__file__), "zoneinfo", '*'))))
51     return r
52
53 def gen_manifest():
54     file_list="\n".join(data())
55     open('MANIFEST','w').write(file_list)
56
57 if os.name == 'nt':
58     sys.path.append("C:\Microsoft.VC90.CRT")
59
60 def py2exe_options():
61     if os.name == 'nt':
62         import py2exe
63         return {
64             "console" : [ { "script": "openerp-server", "icon_resources": [(1, join("install","openerp-icon.ico"))], }],
65             'options' : {
66                 "py2exe": {
67                     "skip_archive": 1,
68                     "optimize": 2,
69                     "dist_dir": 'dist',
70                     "packages": [ "DAV", "HTMLParser", "PIL", "asynchat", "asyncore", "commands", "dateutil", "decimal", "docutils", "email", "encodings", "imaplib", "lxml", "lxml._elementpath", "lxml.builder", "lxml.etree", "lxml.objectify", "mako", "openerp", "poplib", "pychart", "pydot", "pyparsing", "pytz", "reportlab", "select", "simplejson", "smtplib", "uuid", "vatnumber", "vobject", "xml", "xml.dom", "yaml", ],
71                     "excludes" : ["Tkconstants","Tkinter","tcl"],
72                 }
73             }
74         }
75     else:
76         return {}
77
78 execfile(join(os.path.dirname(__file__), 'openerp', 'release.py'))
79
80 # Notes for OpenERP developer on windows:
81 #
82 # To setup a windows developer evironement install python2.7 then pip and use
83 # "pip install <depencey>" for every dependency listed below.
84 #
85 # Dependecies that requires DLLs are not installable with pip install, for
86 # them we added comments with links where you can find the installers.
87 #
88 # OpenERP on windows also require the pywin32, the binary can be found at
89 # http://pywin32.sf.net
90 #
91 # Both python2.7 32bits and 64bits are known to work.
92
93 setuptools.setup(
94       name             = 'openerp',
95       version          = version,
96       description      = description,
97       long_description = long_desc,
98       url              = url,
99       author           = author,
100       author_email     = author_email,
101       classifiers      = filter(None, classifiers.split("\n")),
102       license          = license,
103       scripts          = ['openerp-server'],
104       data_files       = data(),
105       packages         = setuptools.find_packages(),
106       dependency_links = ['http://download.gna.org/pychart/'],
107       #include_package_data = True,
108       install_requires = [
109           'pychart', # not on pypi, use: pip install http://download.gna.org/pychart/PyChart-1.39.tar.gz
110           'babel',
111           'docutils',
112           'feedparser',
113           'gdata',
114           'lxml < 3', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
115           'mako',
116           'PIL', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
117           'psutil', # windows binary code.google.com/p/psutil/downloads/list
118           'psycopg2',
119           'pydot',
120           'python-dateutil < 2',
121           'python-ldap', # optional
122           'python-openid',
123           'pytz',
124           'pywebdav',
125           'pyyaml',
126           'reportlab', # windows binary pypi.python.org/pypi/reportlab
127           'simplejson',
128           'vatnumber',
129           'vobject',
130           'werkzeug',
131           'xlwt',
132       ],
133       extras_require = {
134           'SSL' : ['pyopenssl'],
135       },
136       tests_require = ['unittest2'],
137       **py2exe_options()
138 )
139
140
141 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: