X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=setup.py;h=ae349d4241dc7aaf872f4e9be103bbfc68ef4027;hb=3bd2d837767f01f821f45e99d23bc056303cae33;hp=42d01418b6efac475fea2e547dc30f9ac96dc735;hpb=bba009f639b7c7c1681c6045585bc59b62e39cc3;p=odoo%2Fodoo.git diff --git a/setup.py b/setup.py index 42d0141..ae349d4 100755 --- a/setup.py +++ b/setup.py @@ -1,157 +1,106 @@ #!/usr/bin/env python -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). # # 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. +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. # # 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. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ############################################################################## -# 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 -# +import glob, os, re, setuptools, sys +from os.path import join -import imp -import sys -import os -import glob +# List all data files +def data(): + r = {} + for root, dirnames, filenames in os.walk('openerp'): + for filename in filenames: + if not re.match(r'.*(\.pyc|\.pyo|\~)$', filename): + r.setdefault(root, []).append(os.path.join(root, filename)) -from distutils.core import setup, Command -from distutils.command.install import install + if os.name == 'nt': + r["Microsoft.VC90.CRT"] = glob.glob('C:\Microsoft.VC90.CRT\*.*') + + import babel + # Add data, but also some .py files py2exe won't include automatically. + # TODO This should probably go under `packages`, instead of `data`, + # but this will work fine (especially since we don't use the ZIP file + # approach). + r["babel/localedata"] = glob.glob(os.path.join(os.path.dirname(babel.__file__), "localedata", '*')) + others = ['global.dat', 'numbers.py', 'support.py'] + r["babel"] = map(lambda f: os.path.join(os.path.dirname(babel.__file__), f), others) + others = ['frontend.py', 'mofile.py'] + r["babel/messages"] = map(lambda f: os.path.join(os.path.dirname(babel.__file__), "messages", f), others) + + import pytz + tzdir = os.path.dirname(pytz.__file__) + for root, _, filenames in os.walk(os.path.join(tzdir, "zoneinfo")): + base = os.path.join('pytz', root[len(tzdir) + 1:]) + r[base] = [os.path.join(root, f) for f in filenames] + + import docutils + dudir = os.path.dirname(docutils.__file__) + for root, _, filenames in os.walk(dudir): + base = os.path.join('docutils', root[len(dudir) + 1:]) + r[base] = [os.path.join(root, f) for f in filenames if not f.endswith(('.py', '.pyc', '.pyo'))] + + return r.items() + +def gen_manifest(): + file_list="\n".join(data()) + open('MANIFEST','w').write(file_list) if os.name == 'nt': - import py2exe - -sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), "bin")) - -opj = os.path.join - -execfile(opj('bin', 'release.py')) - -if sys.argv[1] != 'bdist_rpm': - version = version + '-' + release - -# get python short version -py_short_version = '%s.%s' % sys.version_info[:2] + sys.path.append("C:\Microsoft.VC90.CRT") -required_modules = [ - ('psycopg2', 'PostgreSQL module'), - ('xml', 'XML Tools for python'), - ('libxml2', 'libxml2 python bindings'), - ('libxslt', 'libxslt python bindings'), - ('reportlab', 'reportlab module'), - ('pychart', 'pychart module'), - ('pydot', 'pydot module'), -] - -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(): - for (dp, dn, names) in os.walk(opj('bin', 'addons')): - if '__terp__.py' in names: - modname = dp.replace(os.path.sep, '.').replace('bin', 'openerp-server', 1) - yield modname - -def data_files(): - '''Build list of data files to be installed''' - files = [] +def py2exe_options(): if os.name == 'nt': - os.chdir('bin') - for (dp,dn,names) in os.walk('addons'): - files.append((dp, map(lambda x: opj('bin', dp, x), names))) - os.chdir('..') - for (dp,dn,names) in os.walk('doc'): - files.append((dp, map(lambda x: opj(dp, x), names))) - files.append(('.', [opj('bin', 'import_xml.rng'), - opj('bin', 'server.pkey'), - opj('bin', 'server.cert')])) + import py2exe + return { + "console" : [ { "script": "openerp-server", "icon_resources": [(1, join("install","openerp-icon.ico"))], }], + 'options' : { + "py2exe": { + "skip_archive": 1, + "optimize": 0, # keep the assert running, because the integrated tests rely on them. + "dist_dir": 'dist', + "packages": [ "DAV", "HTMLParser", "PIL", "asynchat", "asyncore", "commands", "dateutil", "decimal", "docutils", "email", "encodings", "imaplib", "jinja2", "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", ], + "excludes" : ["Tkconstants","Tkinter","tcl"], + } + } + } else: - 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') + return {} - files.append((openerp_site_packages, [opj('bin', 'import_xml.rng'), - opj('bin', 'server.pkey'), - opj('bin', 'server.cert')])) +execfile(join(os.path.dirname(__file__), 'openerp', 'release.py')) - for addon in find_addons(): - addonname = addon.split('.')[-1] - 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)) - 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: - res = os.path.normpath(opj(addon_path, root.replace(opj('bin','addons', addonname), '.'))) - pathfiles.extend(((res, map(lambda file: opj(root, file), innerfiles)),)) - files.extend(pathfiles) - - return files - -check_modules() - -f = file('openerp-server','w') -start_script = """#!/bin/sh\necho "OpenERP Setup - The content of this file is generated at the install stage\n" """ -f.write(start_script) -f.close() - -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) - -options = { - "py2exe": { - "compressed": 1, - "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", - "pydot","asyncore","asynchat", "reportlab", "vobject", - "HTMLParser", "select"], - "excludes" : ["Tkconstants","Tkinter","tcl"], - } -} +# Notes for OpenERP developer on windows: +# +# To setup a windows developer evironement install python2.7 then pip and use +# "pip install " for every dependency listed below. +# +# Dependecies that requires DLLs are not installable with pip install, for +# them we added comments with links where you can find the installers. +# +# OpenERP on windows also require the pywin32, the binary can be found at +# http://pywin32.sf.net +# +# Both python2.7 32bits and 64bits are known to work. -setup(name = name, +setuptools.setup( + name = 'openerp', version = version, description = description, long_description = long_desc, @@ -160,31 +109,45 @@ setup(name = name, author_email = author_email, classifiers = filter(None, classifiers.split("\n")), license = license, - data_files = data_files(), - cmdclass = { - 'install' : openerp_server_install, - }, scripts = ['openerp-server'], - packages = ['openerp-server', - 'openerp-server.addons', - 'openerp-server.ir', - 'openerp-server.osv', - 'openerp-server.service', - 'openerp-server.tools', - 'openerp-server.report', - 'openerp-server.report.printscreen', - 'openerp-server.report.render', - 'openerp-server.report.render.rml2pdf', - 'openerp-server.report.render.rml2html', - 'openerp-server.report.render.rml2txt', - 'openerp-server.wizard', - 'openerp-server.workflow'] + \ - list(find_addons()), - package_dir = {'openerp-server': 'bin'}, - console = [ { "script" : "bin\\openerp-server.py", "icon_resources" : [ (1,"pixmaps\\openerp-icon.ico") ] } ], - options = options, - ) + data_files = data(), + packages = setuptools.find_packages(), + dependency_links = ['http://download.gna.org/pychart/'], + #include_package_data = True, + install_requires = [ + 'pychart', # not on pypi, use: pip install http://download.gna.org/pychart/PyChart-1.39.tar.gz + 'babel', + 'docutils', + 'feedparser', + 'gdata', + 'Jinja2', + 'lxml', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/ + 'mako', + 'mock', + 'PIL', # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/ + 'psutil', # windows binary code.google.com/p/psutil/downloads/list + 'psycopg2 >= 2.2', + 'pydot', + 'python-dateutil < 2', + 'python-ldap', # optional + 'python-openid', + 'pytz', + 'pywebdav', + 'pyyaml', + 'reportlab', # windows binary pypi.python.org/pypi/reportlab + 'simplejson', + 'unittest2', + 'vatnumber', + 'vobject', + 'werkzeug', + 'xlwt', + ], + extras_require = { + 'SSL' : ['pyopenssl'], + }, + tests_require = ['unittest2'], + **py2exe_options() +) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -