summaryrefslogtreecommitdiffstats
path: root/bundle/py2exe.py
blob: 5b7f4883bcee56c76bcbc0f474ba03c5c379c0eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3

# Allow execution from anywhere
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import warnings

from py2exe import freeze

from devscripts.utils import read_version

VERSION = read_version()


def main():
    warnings.warn(
        'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
        'It is recommended to run "pyinst.py" to build using pyinstaller instead')

    freeze(
        console=[{
            'script': './yt_dlp/__main__.py',
            'dest_base': 'yt-dlp',
            'icon_resources': [(1, 'devscripts/logo.ico')],
        }],
        version_info={
            'version': VERSION,
            'description': 'A feature-rich command-line audio/video downloader',
            'comments': 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
            'product_name': 'yt-dlp',
            'product_version': VERSION,
        },
        options={
            'bundle_files': 0,
            'compressed': 1,
            'optimize': 2,
            'dist_dir': './dist',
            'excludes': [
                # py2exe cannot import Crypto
                'Crypto',
                'Cryptodome',
                # requests >=2.32.0 breaks py2exe builds due to certifi dependency
                'requests',
                'urllib3',
            ],
            'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
            # Modules that are only imported dynamically must be added here
            'includes': ['yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated',
                         'yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated'],
        },
        zipfile=None,
    )


if __name__ == '__main__':
    main()