mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 14:41:44 +00:00
parent
cb61e20c26
commit
58dd0f8d1e
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@ -125,11 +125,12 @@ jobs:
|
|||||||
sudo apt -y install zip pandoc man sed
|
sudo apt -y install zip pandoc man sed
|
||||||
cat > ./requirements.txt << EOF
|
cat > ./requirements.txt << EOF
|
||||||
python=3.10.*
|
python=3.10.*
|
||||||
|
pyinstaller
|
||||||
brotli-python
|
brotli-python
|
||||||
EOF
|
EOF
|
||||||
python devscripts/install_deps.py --print \
|
python devscripts/install_deps.py --print \
|
||||||
--exclude brotli --exclude brotlicffi \
|
--exclude brotli --exclude brotlicffi \
|
||||||
--include secretstorage --include pyinstaller >> ./requirements.txt
|
--include secretstorage >> ./requirements.txt
|
||||||
mamba create -n build --file ./requirements.txt
|
mamba create -n build --file ./requirements.txt
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
@ -247,7 +248,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
brew install coreutils
|
brew install coreutils
|
||||||
python3 devscripts/install_deps.py --user -o --include build
|
python3 devscripts/install_deps.py --user -o --include build
|
||||||
python3 devscripts/install_deps.py --print --include pyinstaller_macos > requirements.txt
|
python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt
|
||||||
# We need to ignore wheels otherwise we break universal2 builds
|
# We need to ignore wheels otherwise we break universal2 builds
|
||||||
python3 -m pip install -U --user --no-binary :all: -r requirements.txt
|
python3 -m pip install -U --user --no-binary :all: -r requirements.txt
|
||||||
# We need to fuse our own universal2 wheels for curl_cffi
|
# We need to fuse our own universal2 wheels for curl_cffi
|
||||||
@ -319,7 +320,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
brew install coreutils
|
brew install coreutils
|
||||||
python3 devscripts/install_deps.py --user -o --include build
|
python3 devscripts/install_deps.py --user -o --include build
|
||||||
python3 devscripts/install_deps.py --user --include pyinstaller_macos --include curl_cffi
|
python3 devscripts/install_deps.py --user --include pyinstaller --include curl_cffi
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: |
|
run: |
|
||||||
|
@ -10,6 +10,8 @@ import argparse
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from devscripts.tomlparse import parse_toml
|
from devscripts.tomlparse import parse_toml
|
||||||
from devscripts.utils import read_file
|
from devscripts.utils import read_file
|
||||||
|
|
||||||
@ -17,17 +19,23 @@ from devscripts.utils import read_file
|
|||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser(description='Install dependencies for yt-dlp')
|
parser = argparse.ArgumentParser(description='Install dependencies for yt-dlp')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'input', nargs='?', metavar='TOMLFILE', default='pyproject.toml', help='Input file (default: %(default)s)')
|
'input', nargs='?', metavar='TOMLFILE', default=Path(__file__).parent.parent / 'pyproject.toml',
|
||||||
|
help='input file (default: %(default)s)')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-e', '--exclude', metavar='DEPENDENCY', action='append', help='Exclude a dependency')
|
'-e', '--exclude', metavar='DEPENDENCY', action='append',
|
||||||
|
help='exclude a dependency')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-i', '--include', metavar='GROUP', action='append', help='Include an optional dependency group')
|
'-i', '--include', metavar='GROUP', action='append',
|
||||||
|
help='include an optional dependency group')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-o', '--only-optional', action='store_true', help='Only install optional dependencies')
|
'-o', '--only-optional', action='store_true',
|
||||||
|
help='only install optional dependencies')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-p', '--print', action='store_true', help='Only print a requirements.txt to stdout')
|
'-p', '--print', action='store_true',
|
||||||
|
help='only print requirements to stdout')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-u', '--user', action='store_true', help='Install with pip as --user')
|
'-u', '--user', action='store_true',
|
||||||
|
help='install with pip as --user')
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -37,24 +45,16 @@ def main():
|
|||||||
optional_groups = project_table['optional-dependencies']
|
optional_groups = project_table['optional-dependencies']
|
||||||
excludes = args.exclude or []
|
excludes = args.exclude or []
|
||||||
|
|
||||||
deps = []
|
targets = []
|
||||||
if not args.only_optional: # `-o` should exclude 'dependencies' and the 'default' group
|
if not args.only_optional: # `-o` should exclude 'dependencies' and the 'default' group
|
||||||
deps.extend(project_table['dependencies'])
|
targets.extend(project_table['dependencies'])
|
||||||
if 'default' not in excludes: # `--exclude default` should exclude entire 'default' group
|
if 'default' not in excludes: # `--exclude default` should exclude entire 'default' group
|
||||||
deps.extend(optional_groups['default'])
|
targets.extend(optional_groups['default'])
|
||||||
|
|
||||||
def name(dependency):
|
|
||||||
return re.match(r'[\w-]+', dependency)[0].lower()
|
|
||||||
|
|
||||||
target_map = {name(dep): dep for dep in deps}
|
|
||||||
|
|
||||||
for include in filter(None, map(optional_groups.get, args.include or [])):
|
for include in filter(None, map(optional_groups.get, args.include or [])):
|
||||||
target_map.update(zip(map(name, include), include))
|
targets.extend(include)
|
||||||
|
|
||||||
for exclude in map(name, excludes):
|
targets = [t for t in targets if re.match(r'[\w-]+', t).group(0).lower() not in excludes]
|
||||||
target_map.pop(exclude, None)
|
|
||||||
|
|
||||||
targets = list(target_map.values())
|
|
||||||
|
|
||||||
if args.print:
|
if args.print:
|
||||||
for target in targets:
|
for target in targets:
|
||||||
|
@ -69,8 +69,10 @@ dev = [
|
|||||||
"isort",
|
"isort",
|
||||||
"pytest",
|
"pytest",
|
||||||
]
|
]
|
||||||
pyinstaller = ["pyinstaller>=6.3"]
|
pyinstaller = [
|
||||||
pyinstaller_macos = ["pyinstaller==5.13.2"] # needed for curl_cffi builds
|
"pyinstaller>=6.3; sys_platform!='darwin'",
|
||||||
|
"pyinstaller==5.13.2; sys_platform=='darwin'", # needed for curl_cffi
|
||||||
|
]
|
||||||
py2exe = ["py2exe>=0.12"]
|
py2exe = ["py2exe>=0.12"]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
Loading…
Reference in New Issue
Block a user