mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Cleanup build scripts
This commit is contained in:
parent
518e04cab7
commit
f546a7ab20
@ -11,25 +11,26 @@ def is_apple_silicon():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_clean_env():
|
def get_clean_env(use_clean_env):
|
||||||
clean_env = os.environ.copy()
|
clean_env = os.environ.copy()
|
||||||
clean_env['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin'
|
if use_clean_env:
|
||||||
|
clean_env['PATH'] = '/usr/bin:/bin:/usr/sbin:/sbin'
|
||||||
return clean_env
|
return clean_env
|
||||||
|
|
||||||
|
|
||||||
def resolve_executable(program):
|
def resolve_executable(program, use_clean_env=True):
|
||||||
def is_executable(fpath):
|
def is_executable(fpath):
|
||||||
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
for path in get_clean_env()["PATH"].split(os.pathsep):
|
for path in get_clean_env(use_clean_env=use_clean_env)["PATH"].split(os.pathsep):
|
||||||
executable_file = os.path.join(path, program)
|
executable_file = os.path.join(path, program)
|
||||||
if is_executable(executable_file):
|
if is_executable(executable_file):
|
||||||
return executable_file
|
return executable_file
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def run_executable_with_output(path, arguments, decode=True, input=None, stderr_to_stdout=True, print_command=False, check_result=False):
|
def run_executable_with_output(path, arguments, use_clean_env=True, decode=True, input=None, stderr_to_stdout=True, print_command=False, check_result=False):
|
||||||
executable_path = resolve_executable(path)
|
executable_path = resolve_executable(path, use_clean_env=use_clean_env)
|
||||||
if executable_path is None:
|
if executable_path is None:
|
||||||
raise Exception('Could not resolve {} to a valid executable file'.format(path))
|
raise Exception('Could not resolve {} to a valid executable file'.format(path))
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ def run_executable_with_output(path, arguments, decode=True, input=None, stderr_
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=stderr_assignment,
|
stderr=stderr_assignment,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
env=get_clean_env()
|
env=get_clean_env(use_clean_env=use_clean_env)
|
||||||
)
|
)
|
||||||
if input is not None:
|
if input is not None:
|
||||||
output_data, _ = process.communicate(input=input)
|
output_data, _ = process.communicate(input=input)
|
||||||
|
@ -2,8 +2,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
from BuildEnvironment import check_run_system
|
from BuildEnvironment import run_executable_with_output
|
||||||
|
|
||||||
def deploy_to_firebase(args):
|
def deploy_to_firebase(args):
|
||||||
if not os.path.exists(args.configuration):
|
if not os.path.exists(args.configuration):
|
||||||
@ -26,18 +27,26 @@ def deploy_to_firebase(args):
|
|||||||
if key not in configuration_dict:
|
if key not in configuration_dict:
|
||||||
print('Configuration at {} does not contain {}'.format(args.configuration, key))
|
print('Configuration at {} does not contain {}'.format(args.configuration, key))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
debug_flag = "--debug" if args.debug else ""
|
|
||||||
command = 'firebase appdistribution:distribute --app {app_id} --groups "{group}" {debug_flag}'.format(
|
|
||||||
app_id=configuration_dict['app_id'],
|
|
||||||
group=configuration_dict['group'],
|
|
||||||
debug_flag=debug_flag
|
|
||||||
)
|
|
||||||
|
|
||||||
command += ' "{ipa_path}"'.format(ipa_path=args.ipa)
|
|
||||||
|
|
||||||
check_run_system(command)
|
firebase_arguments = [
|
||||||
|
'appdistribution:distribute',
|
||||||
|
'--app', configuration_dict['app_id'],
|
||||||
|
'--groups', configuration_dict['group'],
|
||||||
|
args.ipa
|
||||||
|
]
|
||||||
|
|
||||||
|
output = run_executable_with_output(
|
||||||
|
'firebase',
|
||||||
|
firebase_arguments,
|
||||||
|
use_clean_env=False,
|
||||||
|
check_result=True
|
||||||
|
)
|
||||||
|
|
||||||
|
sharing_link_match = re.search(r'Share this release with testers who have access: (https://\S+)', output)
|
||||||
|
if sharing_link_match:
|
||||||
|
print(f"Sharing link: {sharing_link_match.group(1)}")
|
||||||
|
else:
|
||||||
|
print("No sharing link found in the output.")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(prog='deploy-firebase')
|
parser = argparse.ArgumentParser(prog='deploy-firebase')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user