mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 22:55:18 +00:00 
			
		
		
		
	[devscripts] Create utils and refactor
				
					
				
			This commit is contained in:
		
							
								
								
									
										18
									
								
								pyinst.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								pyinst.py
									
									
									
									
									
								
							| @@ -1,11 +1,17 @@ | ||||
| #!/usr/bin/env python3 | ||||
| 
 | ||||
| # Allow direct execution | ||||
| import os | ||||
| import platform | ||||
| import sys | ||||
| 
 | ||||
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | ||||
| 
 | ||||
| import platform | ||||
| 
 | ||||
| from PyInstaller.__main__ import run as run_pyinstaller | ||||
| 
 | ||||
| from devscripts.utils import read_version | ||||
| 
 | ||||
| OS_NAME, MACHINE, ARCH = sys.platform, platform.machine(), platform.architecture()[0][:2] | ||||
| if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): | ||||
|     # NB: Windows x86 has MACHINE = AMD64 irrespective of bitness | ||||
| @@ -13,8 +19,7 @@ if MACHINE in ('x86_64', 'AMD64') or ('i' in MACHINE and '86' in MACHINE): | ||||
| 
 | ||||
| 
 | ||||
| def main(): | ||||
|     opts = parse_options() | ||||
|     version = read_version('yt_dlp/version.py') | ||||
|     opts, version = parse_options(), read_version() | ||||
| 
 | ||||
|     onedir = '--onedir' in opts or '-D' in opts | ||||
|     if not onedir and '-F' not in opts and '--onefile' not in opts: | ||||
| @@ -53,13 +58,6 @@ def parse_options(): | ||||
|     return opts | ||||
| 
 | ||||
| 
 | ||||
| # Get the version from yt_dlp/version.py without importing the package | ||||
| def read_version(fname): | ||||
|     with open(fname, encoding='utf-8') as f: | ||||
|         exec(compile(f.read(), fname, 'exec')) | ||||
|         return locals()['__version__'] | ||||
| 
 | ||||
| 
 | ||||
| def exe(onedir): | ||||
|     """@returns (name, path)""" | ||||
|     name = '_'.join(filter(None, ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan