338c10f66e6f73fde1f2dcec6cdc1710c8cd2caf
[youtube-dl] / build_exe.py
1 from distutils.core import setup
2 import py2exe
3 import sys, os
4
5 # If run without args, build executables
6 if len(sys.argv) == 1:
7     sys.argv.append("py2exe")
8
9 os.chdir(os.path.dirname(sys.argv[0]))
10 sys.path.append('./youtube_dl')
11
12 options = {
13     "bundle_files": 1,
14     "compressed": 1,
15     "optimize": 2,
16     "dist_dir": '.',
17     "dll_excludes": ['w9xpopen.exe']
18 }
19
20 console = [{
21     "script":"./youtube_dl/__main__.py",
22     "dest_base": "youtube-dl",
23 }]
24
25 init_file = open('./youtube_dl/__init__.py')
26 for line in init_file.readlines():
27     if line.startswith('__version__'):
28         version = line[11:].strip(" ='\n")
29         break
30 else:
31     version = ''
32
33 setup(name='youtube-dl',
34       version=version,
35       description='Small command-line program to download videos from YouTube.com and other video sites',
36       url='https://github.com/rg3/youtube-dl',
37       packages=['youtube_dl'],
38       
39       console = console,
40       options = {"py2exe": options},
41       zipfile = None,
42 )
43
44 import shutil
45 shutil.rmtree("build")
46