From 4efe62a0167a0e82e8aaf25b00294dd281b555c9 Mon Sep 17 00:00:00 2001 From: gcmalloc <gcmalloc@gmail.com> Date: Wed, 28 Nov 2012 18:24:16 +0100 Subject: moving to setup.py --- setup.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 setup.py (limited to 'setup.py') diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..3eccf50d8 --- /dev/null +++ b/setup.py @@ -0,0 +1,52 @@ +from distutils.core import setup +import sys +try: + import py2exe +except ImportError: + sys.stderr.write("Cannot import py2exe") +import os + +"""This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package""" + +# If run without args, build executables +if len(sys.argv) == 1: + sys.argv.append("py2exe") + +# os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh +sys.path.append('./youtube_dl') + +options = { + "bundle_files": 1, + "compressed": 1, + "optimize": 2, + "dist_dir": '.', + "dll_excludes": ['w9xpopen.exe'] +} + +console = [{ + "script":"./youtube_dl/__main__.py", + "dest_base": "youtube-dl", +}] + +init_file = open('./youtube_dl/__init__.py') +for line in init_file.readlines(): + if line.startswith('__version__'): + version = line[11:].strip(" ='\n") + break +else: + version = '' + +setup(name='youtube-dl', + version=version, + description='Small command-line program to download videos from YouTube.com and other video sites', + url='https://github.com/rg3/youtube-dl', + packages=['youtube_dl'], + + console = console, + options = {"py2exe": options}, + zipfile = None, +) + +import shutil +shutil.rmtree("build") + -- cgit v1.2.3 From 87bec4c7155d390c3f6e716c87616ce8cdf1450a Mon Sep 17 00:00:00 2001 From: gcmalloc <gcmalloc@gmail.com> Date: Wed, 28 Nov 2012 18:49:56 +0100 Subject: getting version from git or failing --- setup.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 3eccf50d8..d90856b9d 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,22 @@ try: except ImportError: sys.stderr.write("Cannot import py2exe") import os +import subprocess -"""This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package""" +"""The p2exe option will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package. + python setup.py py2exe + You can also build a zip executable with + python setup.py bdist --format=zip + + +""" # If run without args, build executables if len(sys.argv) == 1: sys.argv.append("py2exe") # os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh -sys.path.append('./youtube_dl') +#sys.path.append('./youtube_dl') options = { "bundle_files": 1, @@ -29,11 +36,10 @@ console = [{ }] init_file = open('./youtube_dl/__init__.py') -for line in init_file.readlines(): - if line.startswith('__version__'): - version = line[11:].strip(" ='\n") - break -else: + +try: + version = subprocess.checkoutput(["git", "describe", "--abbrev=0", "--tags"]) +except: version = '' setup(name='youtube-dl', -- cgit v1.2.3 From caaa47d37215f498c033afb42972c135be8138d4 Mon Sep 17 00:00:00 2001 From: gcmalloc <gcmalloc@gmail.com> Date: Thu, 29 Nov 2012 14:12:06 +0100 Subject: adding the script hook --- setup.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index d90856b9d..ec63bedde 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,9 @@ -from distutils.core import setup +from distutils.core import setup, Command import sys try: import py2exe except ImportError: sys.stderr.write("Cannot import py2exe") -import os import subprocess """The p2exe option will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package. @@ -12,12 +11,16 @@ import subprocess You can also build a zip executable with python setup.py bdist --format=zip + The test suite can be run with + python setup.py test + + The actual version is defined by the last git tag """ # If run without args, build executables -if len(sys.argv) == 1: - sys.argv.append("py2exe") +#if len(sys.argv) == 1: +# sys.argv.append("py2exe") # os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh #sys.path.append('./youtube_dl') @@ -38,21 +41,25 @@ console = [{ init_file = open('./youtube_dl/__init__.py') try: + #return the last tag name version = subprocess.checkoutput(["git", "describe", "--abbrev=0", "--tags"]) except: version = '' setup(name='youtube-dl', version=version, - description='Small command-line program to download videos from YouTube.com and other video sites', + long_description='Small command-line program to download videos from YouTube.com and other video sites', url='https://github.com/rg3/youtube-dl', packages=['youtube_dl'], - - console = console, - options = {"py2exe": options}, - zipfile = None, + #test suite + test_suite='nose.collector', + test_requires=['nosetest'], + console=console, + options={"py2exe": options}, + scripts=['bin/youtube-dl'], + zipfile=None, ) -import shutil -shutil.rmtree("build") +#import shutil +#shutil.rmtree("build") -- cgit v1.2.3 From cc51a7d4e030646a5d7075934f11036ad52a3f1f Mon Sep 17 00:00:00 2001 From: Filippo Valsorda <filippo.valsorda@gmail.com> Date: Thu, 29 Nov 2012 16:51:55 +0100 Subject: New repo skeleton, getting ready for PyPi --- setup.py | 68 ++++++++++++++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 45 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ec63bedde..5dfbbc72d 100644 --- a/setup.py +++ b/setup.py @@ -1,31 +1,13 @@ -from distutils.core import setup, Command +from distutils.core import setup +import pkg_resources import sys + try: import py2exe except ImportError: - sys.stderr.write("Cannot import py2exe") -import subprocess - -"""The p2exe option will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package. - python setup.py py2exe - You can also build a zip executable with - python setup.py bdist --format=zip - - The test suite can be run with - python setup.py test - - - The actual version is defined by the last git tag -""" + print >> sys.stderr, "Cannot import py2exe" -# If run without args, build executables -#if len(sys.argv) == 1: -# sys.argv.append("py2exe") - -# os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh -#sys.path.append('./youtube_dl') - -options = { +py2exe_options = { "bundle_files": 1, "compressed": 1, "optimize": 2, @@ -33,33 +15,29 @@ options = { "dll_excludes": ['w9xpopen.exe'] } -console = [{ +py2exe_console = [{ "script":"./youtube_dl/__main__.py", "dest_base": "youtube-dl", }] -init_file = open('./youtube_dl/__init__.py') +execfile('youtube_dl/version.py') -try: - #return the last tag name - version = subprocess.checkoutput(["git", "describe", "--abbrev=0", "--tags"]) -except: - version = '' +setup( + name = 'youtube_dl', + version = __version__, + description = 'Small command-line program to download videos from YouTube.com and other video sites', + url = 'https://github.com/rg3/youtube-dl', + author = 'Ricardo Garcia', + maintainer = 'Philipp Hagemeister', + maintainer_email = 'phihag@phihag.de', + packages = ['youtube_dl'], -setup(name='youtube-dl', - version=version, - long_description='Small command-line program to download videos from YouTube.com and other video sites', - url='https://github.com/rg3/youtube-dl', - packages=['youtube_dl'], - #test suite - test_suite='nose.collector', - test_requires=['nosetest'], - console=console, - options={"py2exe": options}, - scripts=['bin/youtube-dl'], - zipfile=None, -) + test_suite = 'nose.collector', + test_requires = ['nosetest'], -#import shutil -#shutil.rmtree("build") + console = py2exe_console, + options = { "py2exe": py2exe_options }, + scripts = ['bin/youtube-dl'], + zipfile = None, +) -- cgit v1.2.3 From 2f1765c4eaeeee58c1711aaf5757c1fb731c7f9b Mon Sep 17 00:00:00 2001 From: Filippo Valsorda <filippo.valsorda@gmail.com> Date: Thu, 29 Nov 2012 19:21:19 +0100 Subject: setup.py Python3 fix, PyPi classifiers --- setup.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 5dfbbc72d..ba051f7de 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,7 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from __future__ import print_function from distutils.core import setup import pkg_resources import sys @@ -5,7 +9,7 @@ import sys try: import py2exe except ImportError: - print >> sys.stderr, "Cannot import py2exe" + print("Cannot import py2exe", file=sys.stderr) py2exe_options = { "bundle_files": 1, @@ -20,7 +24,7 @@ py2exe_console = [{ "dest_base": "youtube-dl", }] -execfile('youtube_dl/version.py') +exec(compile(open('youtube_dl/version.py').read(), 'youtube_dl/version.py', 'exec')) setup( name = 'youtube_dl', @@ -40,4 +44,15 @@ setup( scripts = ['bin/youtube-dl'], zipfile = None, + + classifiers = [ + "Topic :: Multimedia :: Video", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "License :: Public Domain", + "Programming Language :: Python :: 2.6", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.3" + ] ) -- cgit v1.2.3 From a5741a3f5e8f2f92951d3d32f0a1badb3028c32f Mon Sep 17 00:00:00 2001 From: Filippo Valsorda <filippo.valsorda@gmail.com> Date: Fri, 7 Dec 2012 11:39:08 +0100 Subject: pip installs fine! --- setup.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ba051f7de..45ccf432e 100644 --- a/setup.py +++ b/setup.py @@ -6,11 +6,6 @@ from distutils.core import setup import pkg_resources import sys -try: - import py2exe -except ImportError: - print("Cannot import py2exe", file=sys.stderr) - py2exe_options = { "bundle_files": 1, "compressed": 1, @@ -20,30 +15,46 @@ py2exe_options = { } py2exe_console = [{ - "script":"./youtube_dl/__main__.py", + "script": "./youtube_dl/__main__.py", "dest_base": "youtube-dl", }] +try: + import py2exe + """This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package""" + py2exe_params = { + 'console': py2exe_console, + 'options': { "py2exe": py2exe_options }, + 'zipfile': None + } +except ImportError: + if 'py2exe' in sys.argv: + print("Cannot import py2exe", file=sys.stderr) + exit(1) + py2exe_params = {} + +# Get the version from youtube_dl/version.py without importing the package exec(compile(open('youtube_dl/version.py').read(), 'youtube_dl/version.py', 'exec')) setup( name = 'youtube_dl', version = __version__, - description = 'Small command-line program to download videos from YouTube.com and other video sites', + description = 'YouTube video downloader', + long_description = 'Small command-line program to download videos from YouTube.com and other video sites.', url = 'https://github.com/rg3/youtube-dl', author = 'Ricardo Garcia', maintainer = 'Philipp Hagemeister', maintainer_email = 'phihag@phihag.de', packages = ['youtube_dl'], - test_suite = 'nose.collector', - test_requires = ['nosetest'], - - console = py2exe_console, - options = { "py2exe": py2exe_options }, + # Provokes warning on most systems (why?!) + #test_suite = 'nose.collector', + #test_requires = ['nosetest'], scripts = ['bin/youtube-dl'], - zipfile = None, + data_files = [('etc/bash_completion.d', ['youtube-dl.bash-completion']), # Installing system-wide would require sudo... + ('share/doc/youtube_dl', ['README.txt']), + ('share/man/man1/', ['youtube-dl.1']) ], classifiers = [ "Topic :: Multimedia :: Video", @@ -54,5 +65,7 @@ setup( "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3" - ] + ], + + **py2exe_params ) -- cgit v1.2.3 From fec89790b19d804eecb7318e5da64dbb1445c7f0 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda <filippo.valsorda@gmail.com> Date: Fri, 7 Dec 2012 12:04:52 +0100 Subject: and now, also py2exe compiles fine :) (on Windows) --- setup.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 45ccf432e..6d019dcbb 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,14 @@ from distutils.core import setup import pkg_resources import sys +try: + import py2exe + """This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package""" +except ImportError: + if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe': + print("Cannot import py2exe", file=sys.stderr) + exit(1) + py2exe_options = { "bundle_files": 1, "compressed": 1, @@ -13,25 +21,25 @@ py2exe_options = { "dist_dir": '.', "dll_excludes": ['w9xpopen.exe'] } - py2exe_console = [{ "script": "./youtube_dl/__main__.py", "dest_base": "youtube-dl", }] +py2exe_params = { + 'console': py2exe_console, + 'options': { "py2exe": py2exe_options }, + 'zipfile': None +} -try: - import py2exe - """This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package""" - py2exe_params = { - 'console': py2exe_console, - 'options': { "py2exe": py2exe_options }, - 'zipfile': None +if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe': + params = py2exe_params +else: + params = { + 'scripts': ['bin/youtube-dl'], + 'data_files': [('etc/bash_completion.d', ['youtube-dl.bash-completion']), # Installing system-wide would require sudo... + ('share/doc/youtube_dl', ['README.txt']), + ('share/man/man1/', ['youtube-dl.1'])] } -except ImportError: - if 'py2exe' in sys.argv: - print("Cannot import py2exe", file=sys.stderr) - exit(1) - py2exe_params = {} # Get the version from youtube_dl/version.py without importing the package exec(compile(open('youtube_dl/version.py').read(), 'youtube_dl/version.py', 'exec')) @@ -51,11 +59,6 @@ setup( #test_suite = 'nose.collector', #test_requires = ['nosetest'], - scripts = ['bin/youtube-dl'], - data_files = [('etc/bash_completion.d', ['youtube-dl.bash-completion']), # Installing system-wide would require sudo... - ('share/doc/youtube_dl', ['README.txt']), - ('share/man/man1/', ['youtube-dl.1']) ], - classifiers = [ "Topic :: Multimedia :: Video", "Development Status :: 5 - Production/Stable", @@ -67,5 +70,5 @@ setup( "Programming Language :: Python :: 3.3" ], - **py2exe_params + **params ) -- cgit v1.2.3