1313import urllib .request
1414from pathlib import Path
1515
16-
1716base_packages = [
18- 'gcc' ,
19- 'glibc' ,
20- 'glibc-devel' ,
21- 'libgcc' ,
22- 'linux-glibc-devel' ,
23- 'zlib-devel' ,
17+ 'gcc' ,
18+ 'glibc' ,
19+ 'glibc-devel' ,
20+ 'libgcc' ,
21+ 'linux-glibc-devel' ,
22+ 'zlib-devel' ,
2423]
2524
2625unified_packages = [
27- 'fontconfig' ,
28- 'fontconfig-devel' ,
29- 'freetype2-devel' ,
30- 'libpng-devel' ,
26+ 'fontconfig' ,
27+ 'fontconfig-devel' ,
28+ 'freetype2-devel' ,
29+ 'libpng-devel' ,
3130]
3231
3332
@@ -42,16 +41,16 @@ def generate_sysroot(sysroot: Path, api_version: float, arch: str, quiet=False):
4241 sys .exit ('Unknown arch: ' + arch )
4342
4443 base_repo = 'http://download.tizen.org/snapshots/TIZEN/Tizen-{}/Tizen-{}-Base/latest/repos/standard/packages' .format (
45- api_version ,api_version )
44+ api_version , api_version
45+ )
4646 unified_repo = 'http://download.tizen.org/snapshots/TIZEN/Tizen-{}/Tizen-{}-Unified/latest/repos/standard/packages' .format (
47- api_version , api_version )
47+ api_version , api_version
48+ )
4849
4950 # Retrieve html documents.
5051 documents = {}
51- for url in ['{}/{}' .format (base_repo , tizen_arch ),
52- '{}/{}' .format (base_repo , 'noarch' ),
53- '{}/{}' .format (unified_repo , tizen_arch ),
54- '{}/{}' .format (unified_repo , 'noarch' )]:
52+ for url in ['{}/{}' .format (base_repo , tizen_arch ), '{}/{}' .format (base_repo , 'noarch' ),
53+ '{}/{}' .format (unified_repo , tizen_arch ), '{}/{}' .format (unified_repo , 'noarch' )]:
5554 request = urllib .request .Request (url )
5655 with urllib .request .urlopen (request ) as response :
5756 documents [url ] = response .read ().decode ('utf-8' )
@@ -99,8 +98,7 @@ def generate_sysroot(sysroot: Path, api_version: float, arch: str, quiet=False):
9998 libpath = sysroot / 'usr' / 'lib64'
10099 else :
101100 libpath = sysroot / 'usr' / 'lib'
102- subprocess .run ('cp gcc/*/*/*.o gcc/*/*/*.a .' ,
103- shell = True , cwd = libpath , check = True )
101+ subprocess .run ('cp gcc/*/*/*.o gcc/*/*/*.a .' , shell = True , cwd = libpath , check = True )
104102
105103 # Apply a patch if applicable.
106104 patch = Path (__file__ ).parent / '{}.patch' .format (arch )
@@ -118,14 +116,16 @@ def main():
118116
119117 # Parse arguments.
120118 parser = argparse .ArgumentParser (description = 'Tizen sysroot generator' )
121- parser .add_argument ('-o' , '--out' , metavar = 'PATH' , type = str ,
122- help = 'Path to the output directory' )
123- parser .add_argument ('-f' , '--force' , action = 'store_true' ,
124- help = 'Force re-downloading of packages' )
125- parser .add_argument ('-q' , '--quiet' , action = 'store_true' ,
126- help = 'Suppress log output' )
127- parser .add_argument ('--api-version' , metavar = 'VER' , default = 5.5 , type = float ,
128- help = 'Target API version (defaults to 5.5)' )
119+ parser .add_argument ('-o' , '--out' , metavar = 'PATH' , type = str , help = 'Path to the output directory' )
120+ parser .add_argument ('-f' , '--force' , action = 'store_true' , help = 'Force re-downloading of packages' )
121+ parser .add_argument ('-q' , '--quiet' , action = 'store_true' , help = 'Suppress log output' )
122+ parser .add_argument (
123+ '--api-version' ,
124+ metavar = 'VER' ,
125+ default = 5.5 ,
126+ type = float ,
127+ help = 'Target API version (defaults to 5.5)'
128+ )
129129 args = parser .parse_args ()
130130
131131 if args .out :
0 commit comments