mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-10-03 15:51:25 +02:00
Compare commits
No commits in common. "b6db88516793004a0d47bc6948a66ee90be0d9db" and "d6bf35001d8de6902f87d7457e621f5a7ec8dfa4" have entirely different histories.
b6db885167
...
d6bf35001d
10
MANIFEST.in
Normal file
10
MANIFEST.in
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
include AUTHORS
|
||||||
|
include Changelog.md
|
||||||
|
include LICENSE
|
||||||
|
include README.md
|
||||||
|
include completions/*/*
|
||||||
|
include supportedsites.md
|
||||||
|
include yt-dlp.1
|
||||||
|
include pyproject.toml
|
||||||
|
recursive-include devscripts *
|
||||||
|
recursive-include test *
|
26
Makefile
26
Makefile
|
@ -1,16 +1,25 @@
|
||||||
all: lazy-extractors yt-dlp doc pypi-files
|
all: lazy-extractors yt-dlp doc pypi-files
|
||||||
clean: clean-test clean-dist
|
clean: clean-test clean-dist clean-pyproject
|
||||||
clean-all: clean clean-cache
|
clean-all: clean clean-cache
|
||||||
completions: completion-bash completion-fish completion-zsh
|
completions: completion-bash completion-fish completion-zsh
|
||||||
doc: README.md CONTRIBUTING.md issuetemplates supportedsites
|
doc: README.md CONTRIBUTING.md issuetemplates supportedsites
|
||||||
ot: offlinetest
|
ot: offlinetest
|
||||||
tar: yt-dlp.tar.gz
|
tar: yt-dlp.tar.gz
|
||||||
|
|
||||||
# Keep this list in sync with pyproject.toml includes/artifacts
|
PREFIX ?= /usr/local
|
||||||
|
BINDIR ?= $(PREFIX)/bin
|
||||||
|
MANDIR ?= $(PREFIX)/man
|
||||||
|
SHAREDIR ?= $(PREFIX)/share
|
||||||
|
PYTHON ?= /usr/bin/env python3
|
||||||
|
|
||||||
|
# Keep this list in sync with MANIFEST.in
|
||||||
# intended use: when building a source distribution,
|
# intended use: when building a source distribution,
|
||||||
# make pypi-files && python3 -m build -sn .
|
# make pypi-files && python3 -m build -sn .
|
||||||
pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
|
pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
|
||||||
completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*
|
completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*
|
||||||
|
-mv -f pyproject.toml.old pyproject.toml
|
||||||
|
cp -f pyproject.toml pyproject.toml.old
|
||||||
|
$(PYTHON) devscripts/include_data_files.py pyproject.toml
|
||||||
|
|
||||||
.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
|
.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
|
||||||
|
|
||||||
|
@ -22,6 +31,8 @@ clean-test:
|
||||||
clean-dist:
|
clean-dist:
|
||||||
rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ \
|
rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ \
|
||||||
yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS
|
yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS
|
||||||
|
clean-pyproject:
|
||||||
|
-mv -f pyproject.toml.old pyproject.toml
|
||||||
clean-cache:
|
clean-cache:
|
||||||
find . \( \
|
find . \( \
|
||||||
-type d -name .pytest_cache -o -type d -name __pycache__ -o -name "*.pyc" -o -name "*.class" \
|
-type d -name .pytest_cache -o -type d -name __pycache__ -o -name "*.pyc" -o -name "*.class" \
|
||||||
|
@ -32,12 +43,6 @@ completion-fish: completions/fish/yt-dlp.fish
|
||||||
completion-zsh: completions/zsh/_yt-dlp
|
completion-zsh: completions/zsh/_yt-dlp
|
||||||
lazy-extractors: yt_dlp/extractor/lazy_extractors.py
|
lazy-extractors: yt_dlp/extractor/lazy_extractors.py
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
BINDIR ?= $(PREFIX)/bin
|
|
||||||
MANDIR ?= $(PREFIX)/man
|
|
||||||
SHAREDIR ?= $(PREFIX)/share
|
|
||||||
PYTHON ?= /usr/bin/env python3
|
|
||||||
|
|
||||||
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
||||||
SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
|
SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
|
||||||
|
|
||||||
|
@ -144,8 +149,9 @@ yt-dlp.tar.gz: all
|
||||||
-- \
|
-- \
|
||||||
README.md supportedsites.md Changelog.md LICENSE \
|
README.md supportedsites.md Changelog.md LICENSE \
|
||||||
CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \
|
CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \
|
||||||
Makefile yt-dlp.1 README.txt completions .gitignore \
|
Makefile MANIFEST.in yt-dlp.1 README.txt completions \
|
||||||
setup.cfg yt-dlp yt_dlp pyproject.toml devscripts test
|
setup.cfg yt-dlp yt_dlp pyproject.toml \
|
||||||
|
devscripts test
|
||||||
|
|
||||||
AUTHORS:
|
AUTHORS:
|
||||||
git shortlog -s -n HEAD | cut -f2 | sort > AUTHORS
|
git shortlog -s -n HEAD | cut -f2 | sort > AUTHORS
|
||||||
|
|
|
@ -362,6 +362,7 @@ py -m bundle.py2exe
|
||||||
* **`devscripts/set-variant.py`** - Set the build variant of the executable.
|
* **`devscripts/set-variant.py`** - Set the build variant of the executable.
|
||||||
* **`devscripts/make_changelog.py`** - Create a markdown changelog using short commit messages and update `CONTRIBUTORS` file.
|
* **`devscripts/make_changelog.py`** - Create a markdown changelog using short commit messages and update `CONTRIBUTORS` file.
|
||||||
* **`devscripts/make_lazy_extractors.py`** - Create lazy extractors. Running this before building the binaries (any variant) will improve their startup performance. Set the environment variable `YTDLP_NO_LAZY_EXTRACTORS=1` if you wish to forcefully disable lazy extractor loading.
|
* **`devscripts/make_lazy_extractors.py`** - Create lazy extractors. Running this before building the binaries (any variant) will improve their startup performance. Set the environment variable `YTDLP_NO_LAZY_EXTRACTORS=1` if you wish to forcefully disable lazy extractor loading.
|
||||||
|
* **`devscripts/include_data_files.py`** - Running this before building a wheel will ensure any generated documentation and/or shell completions will be included in the wheel.
|
||||||
|
|
||||||
Note: See their `--help` for more info.
|
Note: See their `--help` for more info.
|
||||||
|
|
||||||
|
|
54
devscripts/include_data_files.py
Executable file
54
devscripts/include_data_files.py
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Allow execution from anywhere
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from devscripts.utils import get_filename_args, read_file
|
||||||
|
|
||||||
|
TABLE_HEADER = '[tool.setuptools.data-files]'
|
||||||
|
|
||||||
|
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'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def build_data_files(input_file):
|
||||||
|
project_root = Path(input_file).resolve().parent
|
||||||
|
|
||||||
|
for dirname, files in FILES_SPEC.items():
|
||||||
|
resfiles = [fn for fn in files if (project_root / fn).is_file()]
|
||||||
|
if resfiles:
|
||||||
|
yield f'"{dirname}" = {resfiles!r}\n'
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
tomlfile = get_filename_args(default_outfile='pyproject.toml')
|
||||||
|
|
||||||
|
if TABLE_HEADER in read_file(tomlfile):
|
||||||
|
print(
|
||||||
|
f'{tomlfile!r} already contains a data-files table. '
|
||||||
|
+ 'Try running "make clean-pyproject" or "git restore pyproject.toml"',
|
||||||
|
file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
data_files = list(build_data_files(tomlfile))
|
||||||
|
if not data_files:
|
||||||
|
print('No data files to include. Try running "make pypi-files"', file=sys.stderr)
|
||||||
|
return # `make` should not error here
|
||||||
|
|
||||||
|
with open(tomlfile, 'a', encoding='utf-8') as f:
|
||||||
|
f.write(f'\n{TABLE_HEADER}\n')
|
||||||
|
f.writelines(data_files)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
|
@ -1,6 +1,6 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
build-backend = "setuptools.build_meta"
|
||||||
build-backend = "hatchling.build"
|
requires = ["setuptools>=61", "wheel"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "yt-dlp"
|
name = "yt-dlp"
|
||||||
|
@ -56,8 +56,8 @@ pyinstaller = ["pyinstaller>=6.3"]
|
||||||
py2exe = ["py2exe>=0.12"]
|
py2exe = ["py2exe>=0.12"]
|
||||||
build = [
|
build = [
|
||||||
"build",
|
"build",
|
||||||
"hatchling",
|
|
||||||
"pip",
|
"pip",
|
||||||
|
"setuptools>=61",
|
||||||
"wheel",
|
"wheel",
|
||||||
]
|
]
|
||||||
dev = [
|
dev = [
|
||||||
|
@ -78,38 +78,10 @@ yt-dlp = "yt_dlp:main"
|
||||||
[project.entry-points.pyinstaller40]
|
[project.entry-points.pyinstaller40]
|
||||||
hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
|
hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
|
||||||
|
|
||||||
[tool.hatch.build.targets.sdist]
|
[tool.setuptools.packages.find]
|
||||||
include = [
|
include = ["yt_dlp*"]
|
||||||
"/yt_dlp",
|
exclude = ["youtube_dl*", "youtube_dlc*", "test*", "ytdlp_plugins*", "devscripts*", "bundle*"]
|
||||||
"/devscripts",
|
namespaces = false # to disable scanning PEP 420 namespaces (true by default)
|
||||||
"/test",
|
|
||||||
"/.gitignore", # included by default, needed for auto-excludes
|
|
||||||
"/Changelog.md",
|
|
||||||
"/LICENSE", # included as license
|
|
||||||
"/pyproject.toml", # included by default
|
|
||||||
"/README.md", # included as readme
|
|
||||||
"/setup.cfg",
|
|
||||||
"/supportedsites.md",
|
|
||||||
]
|
|
||||||
artifacts = [
|
|
||||||
"/yt_dlp/extractor/lazy_extractors.py",
|
|
||||||
"/completions",
|
|
||||||
"/AUTHORS", # included by default
|
|
||||||
"/README.txt",
|
|
||||||
"/yt-dlp.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.setuptools.dynamic]
|
||||||
packages = ["yt_dlp"]
|
version = {attr = "yt_dlp.version._pkg_version"}
|
||||||
artifacts = ["/yt_dlp/extractor/lazy_extractors.py"]
|
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel.shared-data]
|
|
||||||
"completions/bash/yt-dlp" = "share/bash-completion/completions/yt-dlp"
|
|
||||||
"completions/zsh/_yt-dlp" = "share/zsh/site-functions/_yt-dlp"
|
|
||||||
"completions/fish/yt-dlp.fish" = "share/fish/vendor_completions.d/yt-dlp.fish"
|
|
||||||
"README.txt" = "share/doc/yt_dlp/README.txt"
|
|
||||||
"yt-dlp.1" = "share/man/man1/yt-dlp.1"
|
|
||||||
|
|
||||||
[tool.hatch.version]
|
|
||||||
path = "yt_dlp/version.py"
|
|
||||||
pattern = "_pkg_version = '(?P<version>[^']+)'"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user