~unifield-team/unifield-web/jfb-uf-2332

3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
1
import os
2
import re
3058 by Amit Mendapara
[FIX] Fixed setup.py
3
import sys
4680.3.3 by Xavier ALT
[FIX] win32: package Microsoft.VC90.CRT as it is required for python >= 2.6
4
import glob
3058 by Amit Mendapara
[FIX] Fixed setup.py
5
6
from setuptools import setup
4680.3.4 by Xavier ALT
[AIO-45] win32: modidify package to not compile .py files
7
from setup_py2exe_custom import custom_py2exe, fixup_data_pytz_zoneinfo
3058 by Amit Mendapara
[FIX] Fixed setup.py
8
3761 by Xavier Morel
[FIX] first pass on fixing the web client's packaging
9
execfile(os.path.join("openobject", "release.py"))
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
10
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
11
version_dash_incompatible = False
3065 by Amit Mendapara
[FIX] Fixed the setup.py script (pip, easy_install issue of installing data files).
12
if 'bdist_rpm' in sys.argv:
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
13
    version_dash_incompatible = True
14
try:
15
    import py2exe
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
16
    from py2exe_utils import opts
4680.3.2 by Xavier ALT
[FIX] win32: prevent web from shutting down itself on user logout
17
    opts['options'].setdefault('py2exe',{})
18
    opts['options']['py2exe'].setdefault('includes',[])
19
    opts['options']['py2exe']['includes'].extend([
20
        'win32api',
21
        'win32con',
22
        'win32event',
23
        'win32service',
24
        'win32serviceutil',
25
    ])
4680.3.4 by Xavier ALT
[AIO-45] win32: modidify package to not compile .py files
26
    opts['options']['py2exe'].update(
27
            skip_archive=1,
28
            compressed=0,
29
            bundle_files=3,
30
            optimize=0,
31
            collected_libs_dir='libs',
32
            collected_libs_data_relocate='babel,pytz',
33
    )
34
    opts.setdefault('data_files', []).extend(fixup_data_pytz_zoneinfo())
35
    opts.update(cmdclass={'py2exe': custom_py2exe},)
4680.3.2 by Xavier ALT
[FIX] win32: prevent web from shutting down itself on user logout
36
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
37
    version_dash_incompatible = True
38
except ImportError:
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
39
    opts = {}
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
40
if version_dash_incompatible:
3714.1.19 by Xavier Morel
[IMP] manage openobject's static files as data files so it's possible for cherrypy and mako to get at them even in a py2exe environment, once the pathfinding is fixed.
41
    version = version.split('-')[0]
2031.1.5 by Amit Mendapara
* Restructured data files.
42
3714.1.11 by Xavier Morel
[IMP] bundle docs in py2exe dist as well as in sdist, remove win32 directory from sdist (for now anyway)
43
FILE_PATTERNS = \
44
    r'.+\.(py|cfg|po|pot|mo|txt|rst|gif|png|jpg|ico|mako|html|js|css|htc|swf)$'
3714.1.31 by Xavier Morel
[IMP] simplify find_data_file (yagni dammit), remove Python 2.5-incompatible relpath call in the process
45
def find_data_files(source, patterns=FILE_PATTERNS):
3714.1.11 by Xavier Morel
[IMP] bundle docs in py2exe dist as well as in sdist, remove win32 directory from sdist (for now anyway)
46
    file_matcher = re.compile(patterns, re.I)
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
47
    out = []
48
    for base, _, files in os.walk(source):
49
        cur_files = []
50
        for f in files:
3714.1.11 by Xavier Morel
[IMP] bundle docs in py2exe dist as well as in sdist, remove win32 directory from sdist (for now anyway)
51
            if file_matcher.match(f):
3714.1.31 by Xavier Morel
[IMP] simplify find_data_file (yagni dammit), remove Python 2.5-incompatible relpath call in the process
52
                cur_files.append(os.path.join(base, f))
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
53
        if cur_files:
54
            out.append(
3714.1.31 by Xavier Morel
[IMP] simplify find_data_file (yagni dammit), remove Python 2.5-incompatible relpath call in the process
55
                (base, cur_files))
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
56
57
    return out
58
4680.3.3 by Xavier ALT
[FIX] win32: package Microsoft.VC90.CRT as it is required for python >= 2.6
59
if os.name == 'nt':
60
    sys.path.append("C:\Microsoft.VC90.CRT")
61
    opts.setdefault('data_files',[]).extend([
62
        ("Microsoft.VC90.CRT", glob.glob('C:\Microsoft.VC90.CRT\*.*')),
63
        (os.path.join('service', "Microsoft.VC90.CRT"), glob.glob('C:\Microsoft.VC90.CRT\*.*')),
64
    ])
65
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
66
setup(
3714.1.19 by Xavier Morel
[IMP] manage openobject's static files as data files so it's possible for cherrypy and mako to get at them even in a py2exe environment, once the pathfinding is fixed.
67
    name=name,
68
    version=version,
69
    description=description,
70
    long_description=long_description,
71
    author=author,
72
    author_email=author_email,
73
    url=url,
74
    download_url=download_url,
75
    license=license,
3317 by Amit Mendapara
[FIX] win32 installer
76
    install_requires=[
4529.2.1 by Xavier Morel
[FIX] CherryPy requirement to 3.1.2 as there are apparently issues with 3.2 that we have to resolve
77
        "CherryPy == 3.1.2",
2379 by ame (Tiny/Axelor)
* Updated setup.py
78
        "Mako >= 0.2.4",
79
        "Babel >= 0.9.4",
80
        "FormEncode >= 1.2.2",
81
        "simplejson >= 2.0.9",
3532.1.1 by Xavier Morel
[FIX] add direct dependency on pytz, remove dependency on pyparsing (doesn't seem directly used so transitive dependency?)
82
        "python-dateutil >= 1.4.1",
83
        "pytz >= 2009j"
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
84
    ],
3058 by Amit Mendapara
[FIX] Fixed setup.py
85
    zip_safe=False,
86
    packages=[
3714.1.2 by Xavier Morel
[IMP] attempt to make setup.py and MANIFEST.in more 'normal' (as per distutils/packaging guidelines) and more logical
87
        'openobject',
88
        'openobject.admin',
89
        'openobject.admin.i18n',
90
        'openobject.controllers',
91
        'openobject.i18n',
92
        'openobject.test',
93
        'openobject.tools',
94
        'openobject.widgets'
95
    ],
3058 by Amit Mendapara
[FIX] Fixed setup.py
96
    classifiers=[
2280 by ame (Tiny/Axelor)
* Updated egg dev status to stable.
97
        'Development Status :: 5 - Production/Stable',
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
98
        'Operating System :: OS Independent',
99
        'Programming Language :: Python',
2676 by ame (Tiny/Axelor)
[UPD] PyPI info.
100
        'Environment :: Web Environment',
101
        'Topic :: Office/Business :: Financial',
2280 by ame (Tiny/Axelor)
* Updated egg dev status to stable.
102
        ],
3714.1.6 by Xavier Morel
[IMP] use the release module directly rather than exec'ing it
103
    scripts=['scripts/openerp-web'],
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
104
    data_files=(find_data_files('addons/openerp')
105
              + find_data_files('addons/view_calendar')
106
              + find_data_files('addons/view_diagram')
107
              + find_data_files('addons/view_graph')
108
              + find_data_files('addons/widget_ckeditor')
3714.1.11 by Xavier Morel
[IMP] bundle docs in py2exe dist as well as in sdist, remove win32 directory from sdist (for now anyway)
109
              + find_data_files('doc', patterns='')
3714.1.19 by Xavier Morel
[IMP] manage openobject's static files as data files so it's possible for cherrypy and mako to get at them even in a py2exe environment, once the pathfinding is fixed.
110
              + find_data_files('openobject', patterns=r'.+\.(cfg|css|js|mako|gif|png|jpg|ico)')
3714.1.27 by Xavier Morel
[FIX] packaging of babel locale data
111
              + opts.pop('data_files', [])
3714.1.19 by Xavier Morel
[IMP] manage openobject's static files as data files so it's possible for cherrypy and mako to get at them even in a py2exe environment, once the pathfinding is fixed.
112
    ),
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
113
    **opts
3058 by Amit Mendapara
[FIX] Fixed setup.py
114
)