from pprint import pprint as pp
-from setuptools import setup as official_setup, find_packages
+from setuptools import setup, find_packages
from setuptools.command.install import install
from distutils.sysconfig import get_python_lib
has_py2exe = False
+py2exe_keywords = {}
if os.name == 'nt':
import py2exe
has_py2exe = True
+ py2exe_keywords['console'] = [
+ { "script": join("bin", "openerp-server.py"),
+ "icon_resources": [(1, join("pixmaps","openerp-icon.ico"))]
+ }]
+ py2exe_keywords['options'] = {
+ "py2exe": {
+ "compressed": 1,
+ "optimize": 2,
+ "dist_dir": 'dist',
+ "packages": [
+ "lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
+ "lxml.objectify", "decimal", "xml", "xml", "xml.dom", "xml.xpath",
+ "encodings", "dateutil", "wizard", "pychart", "PIL", "pyparsing",
+ "pydot", "asyncore","asynchat", "reportlab", "vobject",
+ "HTMLParser", "select", "mako", "poplib",
+ "imaplib", "smtplib", "email", "yaml", "DAV",
+ "uuid", "commands",
+ ],
+ "excludes" : ["Tkconstants","Tkinter","tcl"],
+ }
+ }
sys.path.append(join(os.path.abspath(os.path.dirname(__file__)), "bin"))
for root, _, names in os.walk(join('bin', 'addons'), followlinks=True):
if '__openerp__.py' in names or '__terp__.py' in names:
yield basename(root), root
+ #look for extra modules
+ try:
+ empath = os.getenv('EXTRA_MODULES_PATH', '../addons/')
+ for mname in open(join(empath, 'server_modules.list')):
+ mname = mname.strip()
+ if not mname:
+ continue
+
+ terp = join(empath, mname, '__openerp__.py')
+ if not os.path.exists(terp):
+ terp = join(empath, mname, '__terp__.py')
+
+ if os.path.exists(terp):
+ yield mname, join(empath, mname)
+ else:
+ print "Module %s specified, but no valid path." % mname
+ except Exception:
+ pass
def data_files():
'''Build list of data files to be installed'''
-options = {
- "py2exe": {
- "compressed": 1,
- "optimize": 2,
- "dist_dir": 'dist',
- "packages": [
- "lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
- "lxml.objectify", "decimal", "xml", "xml", "xml.dom", "xml.xpath",
- "encodings", "dateutil", "wizard", "pychart", "PIL", "pyparsing",
- "pydot", "asyncore","asynchat", "reportlab", "vobject",
- "HTMLParser", "select", "mako", "poplib",
- "imaplib", "smtplib", "email", "yaml", "DAV",
- ],
- "excludes" : ["Tkconstants","Tkinter","tcl"],
- }
-}
-
-def setup(**kwargs):
- #pp(kwargs)
- return official_setup(**kwargs)
setup(name = name,
version = version,
'': ['*.yml', '*.xml', '*.po', '*.pot', '*.csv'],
},
package_dir = find_package_dirs(),
- console = [
- {
- "script": join("bin", "openerp-server.py"),
- "icon_resources": [(1, join("pixmaps","openerp-icon.ico"))]
- }
- ],
- options = options,
install_requires = [
'lxml',
'mako',
'reportlab',
'caldav',
'pyyaml',
- #'django',
- 'pywebdav'
- #'cx_Oracle',
- #'mysqldb',
+ 'pywebdav',
'feedparser',
- #'bsddb3',
- 'egenix-mx-base'
],
extras_require={
'SSL' : ['pyopenssl'],
- }
+ },
+ **py2exe_keywords
)
+if has_py2exe:
+ # Sometime between pytz-2008a and pytz-2008i common_timezones started to
+ # include only names of zones with a corresponding data file in zoneinfo.
+ # pytz installs the zoneinfo directory tree in the same directory
+ # as the pytz/__init__.py file. These data files are loaded using
+ # pkg_resources.resource_stream. py2exe does not copy this to library.zip so
+ # resource_stream can't find the files and common_timezones is empty when
+ # read in the py2exe executable.
+ # This manually copies zoneinfo into the zip. See also
+ # http://code.google.com/p/googletransitdatafeed/issues/detail?id=121
+ import pytz
+ import zipfile
+ # Make sure the layout of pytz hasn't changed
+ assert (pytz.__file__.endswith('__init__.pyc') or
+ pytz.__file__.endswith('__init__.py')), pytz.__file__
+ zoneinfo_dir = os.path.join(os.path.dirname(pytz.__file__), 'zoneinfo')
+ # '..\\Lib\\pytz\\__init__.py' -> '..\\Lib'
+ disk_basedir = os.path.dirname(os.path.dirname(pytz.__file__))
+ zipfile_path = os.path.join(py2exe_keywords['options']['py2exe']['dist_dir'], 'library.zip')
+ z = zipfile.ZipFile(zipfile_path, 'a')
+
+ for absdir, directories, filenames in os.walk(zoneinfo_dir):
+ assert absdir.startswith(disk_basedir), (absdir, disk_basedir)
+ zip_dir = absdir[len(disk_basedir):]
+ for f in filenames:
+ z.write(os.path.join(absdir, f), os.path.join(zip_dir, f))
+
+ z.close()