diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-08-09 01:08:47 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-08-09 01:08:47 +0530 |
commit | 115add43876964956917bf596c1d0b148c5b3c26 (patch) | |
tree | 3274c61d8d9440b414394c34b1ac76a8cb300116 /pyinst.py | |
parent | c4b6c5c7c9eb0aa448d03c1540580cdd92737aa8 (diff) | |
download | hypervideo-pre-115add43876964956917bf596c1d0b148c5b3c26.tar.lz hypervideo-pre-115add43876964956917bf596c1d0b148c5b3c26.tar.xz hypervideo-pre-115add43876964956917bf596c1d0b148c5b3c26.zip |
[devscripts] Create `utils` and refactor
Diffstat (limited to 'pyinst.py')
-rw-r--r-- | pyinst.py | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -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, ( |