1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/bash
- #
- #Copyright (C) 2017 avideo authors (see AUTHORS)
- #
- # This file is part of AVideo.
- #
- # AVideo is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # AVideo is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with AVideo. If not, see <http://www.gnu.org/licenses/>.
- zip 2&> /dev/null
- if [ $? == 127 ]; then
- #The zip command isn't available; default to a Python re-implementation of the task to be performed
- python -c "`cat $0 | tail -15`"
- else
- zip --quiet youtube-dl youtube_dl/*.py youtube_dl/*/*.py
- zip --quiet --junk-paths youtube-dl youtube_dl/__main__.py
- fi
- exit
- #A python re-implementation of the 'zips'
- import os, zipfile
- with zipfile.ZipFile('youtube-dl.zip', mode='w', compression=zipfile.ZIP_DEFLATED) as exezip:
- for pkgel in os.listdir('youtube_dl'):
- path = 'youtube_dl/'+pkgel
- if os.path.isfile(path):
- exezip.write(path)
- else:
- for pkgfile in os.listdir(path):
- exezip.write(path+'/'+pkgfile)
- exezip.write('youtube_dl/__main__.py', arcname='__main__.py')\
|