From 6b9e17589afd9c552cfe12d4c60fc4fa77963331 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 31 May 2024 15:34:33 +0900 Subject: [PATCH] [Tizen] Apply code formatter --- ci/tizen/check_symbols.py | 9 ++---- ci/tizen/generate_sysroot.py | 54 ++++++++++++++++++------------------ tools/gn | 8 ++---- 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/ci/tizen/check_symbols.py b/ci/tizen/check_symbols.py index 9f897ddadb830..94620dd654432 100755 --- a/ci/tizen/check_symbols.py +++ b/ci/tizen/check_symbols.py @@ -32,8 +32,7 @@ def check_symbol(sofile, allowlist): sys.exit('{} is not a valid file.'.format(allowlist)) try: - symbols_raw = subprocess.check_output( - ['nm', '-gDC', sofile]).decode('utf-8').splitlines() + symbols_raw = subprocess.check_output(['nm', '-gDC', sofile]).decode('utf-8').splitlines() symbols = [Symbol.parse(line) for line in symbols_raw] except subprocess.CalledProcessError as error: sys.exit('nm failed: {}'.format(error)) @@ -60,10 +59,8 @@ def check_symbol(sofile, allowlist): def main(): parser = argparse.ArgumentParser() - parser.add_argument('--allowlist', type=str, required=True, - help='Path to the allowlist file') - parser.add_argument('sofile', type=str, nargs='+', - help='Path to the .so file') + parser.add_argument('--allowlist', type=str, required=True, help='Path to the allowlist file') + parser.add_argument('sofile', type=str, nargs='+', help='Path to the .so file') args = parser.parse_args() for sofile in args.sofile: diff --git a/ci/tizen/generate_sysroot.py b/ci/tizen/generate_sysroot.py index 3eb3be9d98fd5..c40bc6a449eb7 100755 --- a/ci/tizen/generate_sysroot.py +++ b/ci/tizen/generate_sysroot.py @@ -13,21 +13,20 @@ import urllib.request from pathlib import Path - base_packages = [ - 'gcc', - 'glibc', - 'glibc-devel', - 'libgcc', - 'linux-glibc-devel', - 'zlib-devel', + 'gcc', + 'glibc', + 'glibc-devel', + 'libgcc', + 'linux-glibc-devel', + 'zlib-devel', ] unified_packages = [ - 'fontconfig', - 'fontconfig-devel', - 'freetype2-devel', - 'libpng-devel', + 'fontconfig', + 'fontconfig-devel', + 'freetype2-devel', + 'libpng-devel', ] @@ -42,16 +41,16 @@ def generate_sysroot(sysroot: Path, api_version: float, arch: str, quiet=False): sys.exit('Unknown arch: ' + arch) base_repo = 'http://download.tizen.org/snapshots/TIZEN/Tizen-{}/Tizen-{}-Base/latest/repos/standard/packages'.format( - api_version,api_version) + api_version, api_version + ) unified_repo = 'http://download.tizen.org/snapshots/TIZEN/Tizen-{}/Tizen-{}-Unified/latest/repos/standard/packages'.format( - api_version, api_version) + api_version, api_version + ) # Retrieve html documents. documents = {} - for url in ['{}/{}'.format(base_repo, tizen_arch), - '{}/{}'.format(base_repo, 'noarch'), - '{}/{}'.format(unified_repo, tizen_arch), - '{}/{}'.format(unified_repo, 'noarch')]: + for url in ['{}/{}'.format(base_repo, tizen_arch), '{}/{}'.format(base_repo, 'noarch'), + '{}/{}'.format(unified_repo, tizen_arch), '{}/{}'.format(unified_repo, 'noarch')]: request = urllib.request.Request(url) with urllib.request.urlopen(request) as response: documents[url] = response.read().decode('utf-8') @@ -99,8 +98,7 @@ def generate_sysroot(sysroot: Path, api_version: float, arch: str, quiet=False): libpath = sysroot / 'usr' / 'lib64' else: libpath = sysroot / 'usr' / 'lib' - subprocess.run('cp gcc/*/*/*.o gcc/*/*/*.a .', - shell=True, cwd=libpath, check=True) + subprocess.run('cp gcc/*/*/*.o gcc/*/*/*.a .', shell=True, cwd=libpath, check=True) # Apply a patch if applicable. patch = Path(__file__).parent / '{}.patch'.format(arch) @@ -118,14 +116,16 @@ def main(): # Parse arguments. parser = argparse.ArgumentParser(description='Tizen sysroot generator') - parser.add_argument('-o', '--out', metavar='PATH', type=str, - help='Path to the output directory') - parser.add_argument('-f', '--force', action='store_true', - help='Force re-downloading of packages') - parser.add_argument('-q', '--quiet', action='store_true', - help='Suppress log output') - parser.add_argument('--api-version', metavar='VER', default=5.5, type=float, - help='Target API version (defaults to 5.5)') + parser.add_argument('-o', '--out', metavar='PATH', type=str, help='Path to the output directory') + parser.add_argument('-f', '--force', action='store_true', help='Force re-downloading of packages') + parser.add_argument('-q', '--quiet', action='store_true', help='Suppress log output') + parser.add_argument( + '--api-version', + metavar='VER', + default=5.5, + type=float, + help='Target API version (defaults to 5.5)' + ) args = parser.parse_args() if args.out: diff --git a/tools/gn b/tools/gn index 805a20e9c84cc..5480e2f0d81fe 100755 --- a/tools/gn +++ b/tools/gn @@ -657,8 +657,7 @@ def to_gn_args(args): else: gn_args['skia_use_gl'] = args.target_os != 'fuchsia' - if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia', - 'linux']: + if sys.platform == 'darwin' and args.target_os not in ['android', 'fuchsia', 'linux']: # OpenGL is deprecated on macOS > 10.11. # This is not necessarily needed but enabling this until we have a way to # build a macOS metal only shell and a gl only shell. @@ -804,9 +803,8 @@ def to_gn_args(args): # gen_snapshot, but the build defines otherwise make it look like the build is # for a host Windows build and make GN think we will be building ANGLE. # Angle is not used on Mac hosts as there are no tests for the OpenGL backend. - if (is_host_build(args) and - gn_args['host_os'] != 'mac') or (args.target_os == 'linux' and - get_host_os() == 'win'): + if (is_host_build(args) and gn_args['host_os'] != 'mac') or (args.target_os == 'linux' and + get_host_os() == 'win'): # Do not build unnecessary parts of the ANGLE tree. gn_args['angle_build_all'] = False gn_args['angle_has_astc_encoder'] = False