py2exe.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env python3
  2. # Allow execution from anywhere
  3. import os
  4. import sys
  5. sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  6. import warnings
  7. from py2exe import freeze
  8. from devscripts.utils import read_version
  9. VERSION = read_version()
  10. def main():
  11. warnings.warn(
  12. 'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
  13. 'It is recommended to run "pyinst.py" to build using pyinstaller instead')
  14. freeze(
  15. console=[{
  16. 'script': './yt_dlp/__main__.py',
  17. 'dest_base': 'yt-dlp',
  18. 'icon_resources': [(1, 'devscripts/logo.ico')],
  19. }],
  20. version_info={
  21. 'version': VERSION,
  22. 'description': 'A feature-rich command-line audio/video downloader',
  23. 'comments': 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
  24. 'product_name': 'yt-dlp',
  25. 'product_version': VERSION,
  26. },
  27. options={
  28. 'bundle_files': 0,
  29. 'compressed': 1,
  30. 'optimize': 2,
  31. 'dist_dir': './dist',
  32. 'excludes': [
  33. # py2exe cannot import Crypto
  34. 'Crypto',
  35. 'Cryptodome',
  36. # py2exe appears to confuse this with our socks library.
  37. # We don't use pysocks and urllib3.contrib.socks would fail to import if tried.
  38. 'urllib3.contrib.socks'
  39. ],
  40. 'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
  41. # Modules that are only imported dynamically must be added here
  42. 'includes': ['yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated',
  43. 'yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated'],
  44. },
  45. zipfile=None,
  46. )
  47. if __name__ == '__main__':
  48. main()