~jfb-tempo-consulting/unifield-web/US-4786

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
4
5
from setuptools import setup
4680.3.4 by Xavier ALT
[AIO-45] win32: modidify package to not compile .py files
6
from setup_py2exe_custom import custom_py2exe, fixup_data_pytz_zoneinfo
3058 by Amit Mendapara
[FIX] Fixed setup.py
7
4842.4.10 by Jeff Allen
Use a more stable version of formencode. Fix a validator problem found by testfield. Fix pyflakes complaints.
8
# To make pyflakes happy
9
version = None
10
name = None
11
description = None
12
long_description = None
13
author = None
14
author_email = None
15
url = None
16
download_url = None
17
3761 by Xavier Morel
[FIX] first pass on fixing the web client's packaging
18
execfile(os.path.join("openobject", "release.py"))
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
19
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
20
version_dash_incompatible = False
3065 by Amit Mendapara
[FIX] Fixed the setup.py script (pip, easy_install issue of installing data files).
21
if 'bdist_rpm' in sys.argv:
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
22
    version_dash_incompatible = True
23
try:
24
    import py2exe
4842.4.10 by Jeff Allen
Use a more stable version of formencode. Fix a validator problem found by testfield. Fix pyflakes complaints.
25
    assert py2exe
26
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
27
    from py2exe_utils import opts
4680.3.2 by Xavier ALT
[FIX] win32: prevent web from shutting down itself on user logout
28
    opts['options'].setdefault('py2exe',{})
29
    opts['options']['py2exe'].setdefault('includes',[])
30
    opts['options']['py2exe']['includes'].extend([
31
        'win32api',
32
        'win32con',
33
        'win32event',
34
        'win32service',
35
        'win32serviceutil',
36
    ])
4680.3.4 by Xavier ALT
[AIO-45] win32: modidify package to not compile .py files
37
    opts['options']['py2exe'].update(
4827.9.6 by Jeff Allen
[IMP] US-2080: Reverse proxy to implement TLS
38
        skip_archive=1,
39
        compressed=0,
40
        bundle_files=3,
41
        optimize=0,
42
        collected_libs_dir='libs',
43
        collected_libs_data_relocate='babel,pytz',
4842.4.2 by Jeff R. Allen
Checkpoint from work on laptop.
44
        packages=[
45
            "Queue",
4842.5.1 by Jeff R. Allen
Add missing package.
46
            "appdirs",
4842.4.2 by Jeff R. Allen
Checkpoint from work on laptop.
47
            "pkg_resources._vendor.packaging",
48
            "pyparsing",
49
            "email.mime.application",
50
            "email.mime.audio",
51
            "email.mime.base",
52
            "email.mime.image",
53
            "email.mime.message",
54
            "email.mime.multipart",
55
            "email.mime.nonmultipart",
56
            "email.mime.text",
57
        ],
4680.3.4 by Xavier ALT
[AIO-45] win32: modidify package to not compile .py files
58
    )
59
    opts.setdefault('data_files', []).extend(fixup_data_pytz_zoneinfo())
60
    opts.update(cmdclass={'py2exe': custom_py2exe},)
4680.3.2 by Xavier ALT
[FIX] win32: prevent web from shutting down itself on user logout
61
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
62
    version_dash_incompatible = True
63
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
64
    opts = {}
3714.1.3 by Xavier Morel
[IMP] try to introduce py2exe in the core setup.py file
65
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.
66
    version = version.split('-')[0]
2031.1.5 by Amit Mendapara
* Restructured data files.
67
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)
68
FILE_PATTERNS = \
69
    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
70
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)
71
    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
72
    out = []
73
    for base, _, files in os.walk(source):
74
        cur_files = []
75
        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)
76
            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
77
                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
78
        if cur_files:
79
            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
80
                (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
81
82
    return out
83
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
84
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.
85
    name=name,
86
    version=version,
87
    description=description,
88
    long_description=long_description,
89
    author=author,
90
    author_email=author_email,
91
    url=url,
92
    download_url=download_url,
93
    license=license,
4850.3.1 by Jeff Allen
[IMP] Fix character encoding of installer. Other cleanup as well.
94
    python_requires = ">=2.7.12",
3317 by Amit Mendapara
[FIX] win32 installer
95
    install_requires=[
4890.2.4 by jf
[FIX] Try win dep
96
        "pypiwin32==219;platform_system=='Windows'",
4890.1.1 by jf
US-4005 [FIX] Lib version
97
        "cheroot==6.0.0",
98
        "MarkupSafe==1.0",
99
        "more-itertools==4.0.1",
100
        "portend==2.2",
101
        "six==1.11.0",
102
        "tempora==1.10",
4842.4.1 by Jeff Allen
Update for Python 2.7
103
        "CherryPy==10.2.1",
104
        "Mako==1.0.6",
105
        "Babel==2.4.0",
4842.4.10 by Jeff Allen
Use a more stable version of formencode. Fix a validator problem found by testfield. Fix pyflakes complaints.
106
        "formencode==1.3.1",
4842.4.1 by Jeff Allen
Update for Python 2.7
107
        "simplejson==3.10.0",
108
        "python-dateutil==2.6.0",
4842.5.1 by Jeff R. Allen
Add missing package.
109
        "pytz==2017.2",
110
        "appdirs==1.4.3",
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
111
    ],
3058 by Amit Mendapara
[FIX] Fixed setup.py
112
    zip_safe=False,
113
    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
114
        'openobject',
115
        'openobject.admin',
116
        'openobject.admin.i18n',
117
        'openobject.controllers',
118
        'openobject.i18n',
119
        'openobject.test',
120
        'openobject.tools',
121
        'openobject.widgets'
122
    ],
3058 by Amit Mendapara
[FIX] Fixed setup.py
123
    classifiers=[
2280 by ame (Tiny/Axelor)
* Updated egg dev status to stable.
124
        'Development Status :: 5 - Production/Stable',
3 by Amit Mendapara
* Merging local source on tinyerp svn server.
125
        'Operating System :: OS Independent',
126
        'Programming Language :: Python',
2676 by ame (Tiny/Axelor)
[UPD] PyPI info.
127
        'Environment :: Web Environment',
128
        'Topic :: Office/Business :: Financial',
4827.9.6 by Jeff Allen
[IMP] US-2080: Reverse proxy to implement TLS
129
    ],
3714.1.6 by Xavier Morel
[IMP] use the release module directly rather than exec'ing it
130
    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
131
    data_files=(find_data_files('addons/openerp')
4827.9.6 by Jeff Allen
[IMP] US-2080: Reverse proxy to implement TLS
132
                + find_data_files('addons/view_calendar')
133
                + find_data_files('addons/view_diagram')
134
                + find_data_files('addons/view_graph')
135
                + find_data_files('addons/widget_ckeditor')
4888.1.3 by jf
AIO: Add sync_client_web module
136
                + find_data_files('addons/sync_client_web')
4827.9.6 by Jeff Allen
[IMP] US-2080: Reverse proxy to implement TLS
137
                + find_data_files('doc', patterns='')
138
                + find_data_files('openobject', patterns=r'.+\.(cfg|css|js|mako|gif|png|jpg|ico)')
139
                + find_data_files('revprox', patterns='')
140
                + opts.pop('data_files', [])
141
                ),
3714.1.10 by Xavier Morel
[IMP] bundle media files in py2exe archives, or try to anyway, and bundle addons directory as well
142
    **opts
3058 by Amit Mendapara
[FIX] Fixed setup.py
143
)