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