py2exe.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # requests >=2.32.0 breaks py2exe builds due to certifi dependency
  37. 'requests',
  38. 'urllib3',
  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()