Merge remote-tracking branch 'origin/master' into fork_master
[youtube-dl] / setup.py
1 from distutils.core import setup, Command
2 import sys
3 try:
4     import py2exe
5 except ImportError:
6     sys.stderr.write("Cannot import py2exe")
7 import subprocess
8
9 """The p2exe option will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package.
10     python setup.py py2exe
11    You can also build a zip executable with
12     python setup.py bdist --format=zip
13
14    The test suite can be run with
15     python setup.py test
16
17
18     The actual version is defined by the last git tag
19 """
20
21 # If run without args, build executables
22 #if len(sys.argv) == 1:
23 #    sys.argv.append("py2exe")
24
25 # os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh
26 #sys.path.append('./youtube_dl')
27
28 options = {
29     "bundle_files": 1,
30     "compressed": 1,
31     "optimize": 2,
32     "dist_dir": '.',
33     "dll_excludes": ['w9xpopen.exe']
34 }
35
36 console = [{
37     "script":"./youtube_dl/__main__.py",
38     "dest_base": "youtube-dl",
39 }]
40
41 init_file = open('./youtube_dl/__init__.py')
42
43 try:
44     #return the last tag name
45     version = subprocess.checkoutput(["git", "describe", "--abbrev=0", "--tags"])
46 except:
47     version = ''
48
49 setup(name='youtube-dl',
50       version=version,
51       long_description='Small command-line program to download videos from YouTube.com and other video sites',
52       url='https://github.com/rg3/youtube-dl',
53       packages=['youtube_dl'],
54       #test suite
55       test_suite='nose.collector',
56       test_requires=['nosetest'],
57       console=console,
58       options={"py2exe": options},
59       scripts=['bin/youtube-dl'],
60       zipfile=None,
61 )
62
63 #import shutil
64 #shutil.rmtree("build")
65