mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	- Use `manylinux-shared` images for Linux builds - Discontinue `yt-dlp_linux_armv7l`/`linux_armv7l_exe` release binary - Add `yt-dlp_linux_armv7l.zip`/`linux_armv7l_dir` release binary - Add `yt-dlp_musllinux` and `yt-dlp_musllinux_aarch64` release binaries - Migrate `linux_exe` build strategy from staticx+musl to manylinux2014/glibc2.17 - Rewrite release.yml's "unholy bash monstrosity" as devscripts/setup_variables.py Closes #10072, Closes #10630, Closes #10578, Closes #13976, Closes #13977, Closes #14106 Authored by: bashonly
		
			
				
	
	
		
			66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
#!/usr/bin/env python3
 | 
						|
 | 
						|
# Allow direct execution
 | 
						|
import os
 | 
						|
import sys
 | 
						|
 | 
						|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 | 
						|
 | 
						|
 | 
						|
import argparse
 | 
						|
import contextlib
 | 
						|
import sys
 | 
						|
 | 
						|
from devscripts.utils import calculate_version, run_process, write_file
 | 
						|
 | 
						|
 | 
						|
def get_git_head():
 | 
						|
    with contextlib.suppress(Exception):
 | 
						|
        return run_process('git', 'rev-parse', 'HEAD').stdout.strip()
 | 
						|
 | 
						|
 | 
						|
VERSION_TEMPLATE = '''\
 | 
						|
# Autogenerated by devscripts/update-version.py
 | 
						|
 | 
						|
__version__ = {version!r}
 | 
						|
 | 
						|
RELEASE_GIT_HEAD = {git_head!r}
 | 
						|
 | 
						|
VARIANT = None
 | 
						|
 | 
						|
UPDATE_HINT = None
 | 
						|
 | 
						|
CHANNEL = {channel!r}
 | 
						|
 | 
						|
ORIGIN = {origin!r}
 | 
						|
 | 
						|
_pkg_version = {package_version!r}
 | 
						|
'''
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    parser = argparse.ArgumentParser(description='Update the version.py file')
 | 
						|
    parser.add_argument(
 | 
						|
        '-c', '--channel', default='stable',
 | 
						|
        help='Select update channel (default: %(default)s)')
 | 
						|
    parser.add_argument(
 | 
						|
        '-r', '--origin', default='local',
 | 
						|
        help='Select origin/repository (default: %(default)s)')
 | 
						|
    parser.add_argument(
 | 
						|
        '-s', '--suffix', default='',
 | 
						|
        help='Add an alphanumeric suffix to the package version, e.g. "dev"')
 | 
						|
    parser.add_argument(
 | 
						|
        '-o', '--output', default='yt_dlp/version.py',
 | 
						|
        help='The output file to write to (default: %(default)s)')
 | 
						|
    parser.add_argument(
 | 
						|
        'version', nargs='?', default=None,
 | 
						|
        help='A version or revision to use instead of generating one')
 | 
						|
    args = parser.parse_args()
 | 
						|
 | 
						|
    git_head = get_git_head()
 | 
						|
    version = calculate_version(args.version)
 | 
						|
    write_file(args.output, VERSION_TEMPLATE.format(
 | 
						|
        version=version, git_head=git_head, channel=args.channel, origin=args.origin,
 | 
						|
        package_version=f'{version}{args.suffix}'))
 | 
						|
 | 
						|
    print(f'version={version} ({args.channel}), head={git_head}')
 |