mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 06:00:00 +00:00
[build] Add homebrew taps (#827)
https://github.com/yt-dlp/homebrew-taps Closes: #754, #770 Authored by: nao20010128nao
This commit is contained in:
parent
05664a2f7b
commit
b8773e63f0
3 changed files with 58 additions and 0 deletions
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
|
@ -84,6 +84,19 @@ jobs:
|
||||||
rm -rf dist/*
|
rm -rf dist/*
|
||||||
python setup.py sdist bdist_wheel
|
python setup.py sdist bdist_wheel
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
|
- name: Install SSH private key
|
||||||
|
if: ${{ secrets.BREW_TOKEN }}
|
||||||
|
uses: webfactory/ssh-agent@v0.5.3
|
||||||
|
with:
|
||||||
|
ssh-private-key: ${{ secrets.BREW_TOKEN }}
|
||||||
|
- name: Update Homebrew Formulae
|
||||||
|
# can't use secrets.GITHUB_TOKEN because it's outside yt-dlp repository
|
||||||
|
if: ${{ secrets.BREW_TOKEN }}
|
||||||
|
run: |
|
||||||
|
git clone git@github.com:yt-dlp/homebrew-taps taps/
|
||||||
|
python3 devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ steps.bump_version.outputs.ytdlp_version }}"
|
||||||
|
git -C taps/ commit -am 'yt-dlp: ${{ steps.bump_version.outputs.ytdlp_version }}'
|
||||||
|
git -C taps/ push
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
|
@ -151,6 +151,7 @@ # INSTALLATION
|
||||||
|
|
||||||
You can install yt-dlp using one of the following methods:
|
You can install yt-dlp using one of the following methods:
|
||||||
* Download the binary from the [latest release](https://github.com/yt-dlp/yt-dlp/releases/latest) (recommended method)
|
* Download the binary from the [latest release](https://github.com/yt-dlp/yt-dlp/releases/latest) (recommended method)
|
||||||
|
* With Homebrew, `brew install yt-dlp/taps/yt-dlp`
|
||||||
* Use [PyPI package](https://pypi.org/project/yt-dlp): `python3 -m pip install --upgrade yt-dlp`
|
* Use [PyPI package](https://pypi.org/project/yt-dlp): `python3 -m pip install --upgrade yt-dlp`
|
||||||
* Use pip+git: `python3 -m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp.git@release`
|
* Use pip+git: `python3 -m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp.git@release`
|
||||||
* Install master branch: `python3 -m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp`
|
* Install master branch: `python3 -m pip install --upgrade git+https://github.com/yt-dlp/yt-dlp`
|
||||||
|
@ -174,9 +175,16 @@ # INSTALLATION
|
||||||
sudo chmod a+rx /usr/local/bin/yt-dlp
|
sudo chmod a+rx /usr/local/bin/yt-dlp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
macOS or Linux users that are using Homebrew (formerly known as Linuxbrew for Linux users) can also install it by:
|
||||||
|
|
||||||
|
```
|
||||||
|
brew install yt-dlp/taps/yt-dlp
|
||||||
|
```
|
||||||
|
|
||||||
### UPDATE
|
### UPDATE
|
||||||
You can use `yt-dlp -U` to update if you are using the provided release.
|
You can use `yt-dlp -U` to update if you are using the provided release.
|
||||||
If you are using `pip`, simply re-run the same command that was used to install the program.
|
If you are using `pip`, simply re-run the same command that was used to install the program.
|
||||||
|
If you have installed using Homebrew, run `brew upgrade yt-dlp/taps/yt-dlp`
|
||||||
|
|
||||||
### DEPENDENCIES
|
### DEPENDENCIES
|
||||||
Python versions 3.6+ (CPython and PyPy) are supported. Other versions and implementations may or may not work correctly.
|
Python versions 3.6+ (CPython and PyPy) are supported. Other versions and implementations may or may not work correctly.
|
||||||
|
|
37
devscripts/update-formulae.py
Normal file
37
devscripts/update-formulae.py
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
from yt_dlp.compat import compat_urllib_request
|
||||||
|
|
||||||
|
|
||||||
|
# usage: python3 ./devscripts/update-formulae.py <path-to-formulae-rb> <version>
|
||||||
|
# version can be either 0-aligned (yt-dlp version) or normalized (PyPl version)
|
||||||
|
|
||||||
|
filename, version = sys.argv[1:]
|
||||||
|
|
||||||
|
normalized_version = '.'.join(str(int(x)) for x in version.split('.'))
|
||||||
|
|
||||||
|
pypi_release = json.loads(compat_urllib_request.urlopen(
|
||||||
|
'https://pypi.org/pypi/yt-dlp/%s/json' % normalized_version
|
||||||
|
).read().decode('utf-8'))
|
||||||
|
|
||||||
|
tarball_file = next(x for x in pypi_release['urls'] if x['filename'].endswith('.tar.gz'))
|
||||||
|
|
||||||
|
sha256sum = tarball_file['digests']['sha256']
|
||||||
|
url = tarball_file['url']
|
||||||
|
|
||||||
|
with open(filename, 'r') as r:
|
||||||
|
formulae_text = r.read()
|
||||||
|
|
||||||
|
formulae_text = re.sub(r'sha256 "[0-9a-f]*?"', 'sha256 "%s"' % sha256sum, formulae_text)
|
||||||
|
formulae_text = re.sub(r'url "[^"]*?"', 'url "%s"' % url, formulae_text)
|
||||||
|
|
||||||
|
with open(filename, 'w') as w:
|
||||||
|
w.write(formulae_text)
|
Loading…
Reference in a new issue