From cc1dfc93739fc28a2af1ce906b450e5cc1c3ae62 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 1 Jun 2021 02:03:40 +0530 Subject: [PATCH] [cleanup] setup.py --- pyinst.py | 2 +- setup.py | 59 ++++++++++++++++++++++++++----------------------------- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/pyinst.py b/pyinst.py index f2edeb3d9e..b0b68e6c3d 100644 --- a/pyinst.py +++ b/pyinst.py @@ -17,7 +17,7 @@ print('Building %sbit version' % arch) _x86 = '_x86' if arch == '32' else '' -FILE_DESCRIPTION = 'Media Downloader%s' % (' (32 Bit)' if _x86 else '') +FILE_DESCRIPTION = 'yt-dlp%s' % (' (32 Bit)' if _x86 else '') # root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # print('Changing working directory to %s' % root_dir) diff --git a/setup.py b/setup.py index cebe556c99..7353f56997 100644 --- a/setup.py +++ b/setup.py @@ -9,45 +9,44 @@ # Get the version from yt_dlp/version.py without importing the package -exec(compile(open('yt_dlp/version.py').read(), - 'yt_dlp/version.py', 'exec')) +exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec')) DESCRIPTION = 'Command-line program to download videos from YouTube.com and many other other video platforms.' LONG_DESCRIPTION = '\n\n'.join(( 'Official repository: ', - '**PS**: Many links in this document will not work since this is a copy of the README.md from Github', + '**PS**: Some links in this document will not work since this is a copy of the README.md from Github', open('README.md', 'r', encoding='utf-8').read())) REQUIREMENTS = ['mutagen', 'pycryptodome'] +if sys.argv[1:2] == ['py2exe']: + raise NotImplementedError('py2exe is not currently supported; instead, use "pyinst.py" to build with pyinstaller') -if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe': - print('inv') -else: - files_spec = [ - ('share/bash-completion/completions', ['completions/bash/yt-dlp']), - ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']), - ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']), - ('share/doc/yt_dlp', ['README.txt']), - ('share/man/man1', ['yt-dlp.1']) - ] - root = os.path.dirname(os.path.abspath(__file__)) - data_files = [] - for dirname, files in files_spec: - resfiles = [] - for fn in files: - if not os.path.exists(fn): - warnings.warn('Skipping file %s since it is not present. Try running `make pypi-files` first.' % fn) - else: - resfiles.append(fn) - data_files.append((dirname, resfiles)) - params = { - 'data_files': data_files, - } - params['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']} +files_spec = [ + ('share/bash-completion/completions', ['completions/bash/yt-dlp']), + ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']), + ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']), + ('share/doc/yt_dlp', ['README.txt']), + ('share/man/man1', ['yt-dlp.1']) +] +root = os.path.dirname(os.path.abspath(__file__)) +data_files = [] +for dirname, files in files_spec: + resfiles = [] + for fn in files: + if not os.path.exists(fn): + warnings.warn('Skipping file %s since it is not present. Try running `make pypi-files` first' % fn) + else: + resfiles.append(fn) + data_files.append((dirname, resfiles)) + +params = { + 'data_files': data_files, +} +params['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']} class build_lazy_extractors(Command): @@ -61,10 +60,8 @@ def finalize_options(self): pass def run(self): - spawn( - [sys.executable, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], - dry_run=self.dry_run, - ) + spawn([sys.executable, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], + dry_run=self.dry_run) packages = find_packages(exclude=('youtube_dl', 'test', 'ytdlp_plugins'))