@@ -33,26 +33,24 @@ class AndroidBoard(Enum):
3333 def TargetCpuName (self ):
3434 if self == AndroidBoard .ARM or self == AndroidBoard .AndroidStudio_ARM :
3535 return "arm"
36- elif self == AndroidBoard .ARM64 or self == AndroidBoard .AndroidStudio_ARM64 :
36+ if self == AndroidBoard .ARM64 or self == AndroidBoard .AndroidStudio_ARM64 :
3737 return "arm64"
38- elif self == AndroidBoard .X64 or self == AndroidBoard .AndroidStudio_X64 :
38+ if self == AndroidBoard .X64 or self == AndroidBoard .AndroidStudio_X64 :
3939 return "x64"
40- elif self == AndroidBoard .X86 or self == AndroidBoard .AndroidStudio_X86 :
40+ if self == AndroidBoard .X86 or self == AndroidBoard .AndroidStudio_X86 :
4141 return "x86"
42- else :
43- raise Exception ("Unknown board type: %r" % self )
42+ raise Exception ("Unknown board type: %r" % self )
4443
4544 def AbiName (self ):
4645 if self .TargetCpuName () == "arm" :
4746 return "armeabi-v7a"
48- elif self .TargetCpuName () == "arm64" :
47+ if self .TargetCpuName () == "arm64" :
4948 return "arm64-v8a"
50- elif self .TargetCpuName () == "x64" :
49+ if self .TargetCpuName () == "x64" :
5150 return "x86_64"
52- elif self .TargetCpuName () == "x86" :
51+ if self .TargetCpuName () == "x86" :
5352 return "x86"
54- else :
55- raise Exception ("Unknown board type: %r" % self )
53+ raise Exception ("Unknown board type: %r" % self )
5654
5755 def IsIde (self ):
5856 if (
@@ -62,8 +60,7 @@ def IsIde(self):
6260 or self == AndroidBoard .AndroidStudio_X86
6361 ):
6462 return True
65- else :
66- return False
63+ return False
6764
6865
6966class AndroidApp (Enum ):
@@ -78,16 +75,15 @@ class AndroidApp(Enum):
7875 def AppName (self ):
7976 if self == AndroidApp .CHIP_TOOL :
8077 return "CHIPTool"
81- elif self == AndroidApp .CHIP_TEST :
78+ if self == AndroidApp .CHIP_TEST :
8279 return "CHIPTest"
83- elif self == AndroidApp .TV_SERVER :
80+ if self == AndroidApp .TV_SERVER :
8481 return "tv-server"
85- elif self == AndroidApp .TV_CASTING_APP :
82+ if self == AndroidApp .TV_CASTING_APP :
8683 return "tv-casting"
87- elif self == AndroidApp .VIRTUAL_DEVICE_APP :
84+ if self == AndroidApp .VIRTUAL_DEVICE_APP :
8885 return "virtual-device-app"
89- else :
90- raise Exception ("Unknown app type: %r" % self )
86+ raise Exception ("Unknown app type: %r" % self )
9187
9288 def AppGnArgs (self ):
9389 gn_args = {}
@@ -106,26 +102,23 @@ def AppGnArgs(self):
106102 def ExampleName (self ):
107103 if self == AndroidApp .TV_SERVER :
108104 return "tv-app"
109- elif self == AndroidApp .TV_CASTING_APP :
105+ if self == AndroidApp .TV_CASTING_APP :
110106 return "tv-casting-app"
111- elif self == AndroidApp .VIRTUAL_DEVICE_APP :
107+ if self == AndroidApp .VIRTUAL_DEVICE_APP :
112108 return "virtual-device-app"
113- elif self == AndroidApp .CHIP_TEST :
109+ if self == AndroidApp .CHIP_TEST :
114110 return "chip-test"
115- else :
116- return None
111+ return None
117112
118113 def Modules (self ):
119114 if self == AndroidApp .TV_SERVER :
120115 return ["platform-app" , "content-app" ]
121- else :
122- return None
116+ return None
123117
124118 def BuildRoot (self , root ):
125119 if self == AndroidApp .CHIP_TEST :
126120 return os .path .join (root , 'examples/android/CHIPTest' )
127- else :
128- return None
121+ return None
129122
130123
131124class AndroidProfile (Enum ):
@@ -136,10 +129,9 @@ class AndroidProfile(Enum):
136129 def ProfileName (self ):
137130 if self == AndroidProfile .RELEASE :
138131 return 'release'
139- elif self == AndroidProfile .DEBUG :
132+ if self == AndroidProfile .DEBUG :
140133 return 'debug'
141- else :
142- raise Exception ('Unknown profile type: %r' % self )
134+ raise Exception ('Unknown profile type: %r' % self )
143135
144136
145137class AndroidBuilder (Builder ):
@@ -190,17 +182,16 @@ def _find_sdk_manager(self, for_purpose="validation"):
190182 checked_details .append (f"{ path } (test environment - assumed valid)" )
191183 logging .info (f"Using SDK manager for { for_purpose } from test environment: { sdk_manager } " )
192184 break
193- else :
194- # Real environment - check actual file existence
195- exists = os .path .isfile (path )
196- executable = os .access (path , os .X_OK )
197- checked_details .append (f"{ path } (exists: { exists } , executable: { executable } )" )
198- logging .debug (f"Checking SDK manager path for { for_purpose } : { path } - exists: { exists } , executable: { executable } " )
185+ # Real environment - check actual file existence
186+ exists = os .path .isfile (path )
187+ executable = os .access (path , os .X_OK )
188+ checked_details .append (f"{ path } (exists: { exists } , executable: { executable } )" )
189+ logging .debug (f"Checking SDK manager path for { for_purpose } : { path } - exists: { exists } , executable: { executable } " )
199190
200- if exists and executable :
201- sdk_manager = path
202- logging .info (f"Found SDK manager for { for_purpose } at: { sdk_manager } " )
203- break
191+ if exists and executable :
192+ sdk_manager = path
193+ logging .info (f"Found SDK manager for { for_purpose } at: { sdk_manager } " )
194+ break
204195
205196 return sdk_manager , checked_details
206197
@@ -223,7 +214,7 @@ def validate_build_environment(self):
223214 android_ndk_home = os .environ .get ("ANDROID_NDK_HOME" , "" )
224215 android_home = os .environ .get ("ANDROID_HOME" , "" )
225216
226- logging .info (f "Android environment paths:" )
217+ logging .info ("Android environment paths:" )
227218 logging .info (f" ANDROID_NDK_HOME: { android_ndk_home } " )
228219 logging .info (f" ANDROID_HOME: { android_home } " )
229220
@@ -246,7 +237,7 @@ def validate_build_environment(self):
246237 possible_fixes = [
247238 f"1. Install Android SDK Command Line Tools in { android_home } " ,
248239 f"2. Fix permissions: chmod +x { android_home } /cmdline-tools/*/bin/sdkmanager" ,
249- f "3. Verify ANDROID_HOME points to correct SDK directory"
240+ "3. Verify ANDROID_HOME points to correct SDK directory"
250241 ]
251242
252243 raise Exception (
0 commit comments