Add included files for Windows build
[youtube-dl] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 from __future__ import print_function
5
6 from glob import glob
7 import pkg_resources
8 import sys
9
10 try:
11     from setuptools import setup
12 except ImportError:
13     from distutils.core import setup
14
15 try:
16     import py2exe
17     """This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package"""
18 except ImportError:
19     if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
20         print("Cannot import py2exe", file=sys.stderr)
21         exit(1)
22
23 py2exe_options = {
24     "bundle_files": 1,
25     "compressed": 1,
26     "optimize": 2,
27     "dist_dir": '.',
28     "dll_excludes": ['w9xpopen.exe'],
29     "includes": [m.replace('\\', '.').replace('/', '.')[:-3]
30                  for m in glob('youtube_dl/*/*.py')]
31 }
32 py2exe_console = [{
33     "script": "./youtube_dl/__main__.py",
34     "dest_base": "youtube-dl",
35 }]
36 py2exe_params = {
37     'console': py2exe_console,
38     'options': { "py2exe": py2exe_options },
39     'zipfile': None
40 }
41
42 if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
43     params = py2exe_params
44 else:
45     params = {
46         'scripts': ['bin/youtube-dl'],
47         'data_files': [('etc/bash_completion.d', ['youtube-dl.bash-completion']), # Installing system-wide would require sudo...
48                        ('share/doc/youtube_dl', ['README.txt']),
49                        ('share/man/man1/', ['youtube-dl.1'])]
50     }
51
52 # Get the version from youtube_dl/version.py without importing the package
53 exec(compile(open('youtube_dl/version.py').read(), 'youtube_dl/version.py', 'exec'))
54
55 setup(
56     name = 'youtube_dl',
57     version = __version__,
58     description = 'YouTube video downloader',
59     long_description = 'Small command-line program to download videos from YouTube.com and other video sites.',
60     url = 'https://github.com/rg3/youtube-dl',
61     author = 'Ricardo Garcia',
62     maintainer = 'Philipp Hagemeister',
63     maintainer_email = 'phihag@phihag.de',
64     packages = ['youtube_dl'],
65
66     # Provokes warning on most systems (why?!)
67     #test_suite = 'nose.collector',
68     #test_requires = ['nosetest'],
69
70     classifiers = [
71         "Topic :: Multimedia :: Video",
72         "Development Status :: 5 - Production/Stable",
73         "Environment :: Console",
74         "License :: Public Domain",
75         "Programming Language :: Python :: 2.6",
76         "Programming Language :: Python :: 2.7",
77         "Programming Language :: Python :: 3",
78         "Programming Language :: Python :: 3.3"
79     ],
80
81     **params
82 )