Skip to content

Commit

Permalink
tools/check_pacakage_size.py: Declare 'global' keyword once
Browse files Browse the repository at this point in the history
In python, 'global' keyword is needed for usage of global variable.
It is enough to declare 'global' keyword once in a function because 'if' context doesn't make new scope.
With this change, the below build warning is fixed.

========== Verification of partition settings ==========
=> Partition verification SUCCESS!! The setting of all partitions is OK.
./tools/../tools/check_package_size.py:72: SyntaxWarning: name 'FAIL_TO_BUILD' is assigned to before global declaration
  global FAIL_TO_BUILD
  • Loading branch information
jeongarmy authored and sunghan-chang committed Nov 29, 2023
1 parent 882dba7 commit eff33e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions os/tools/check_package_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,23 @@ def check_binary_size(bin_type, part_size):

# Compare the partition size and its binary size
used_ratio = round(float(BINARY_SIZE) / float(PARTITION_SIZE) * 100, 2)

global FAIL_TO_BUILD

if bin_type == "BOOTPARAM" :
if PARTITION_SIZE == BINARY_SIZE :
check_result = "PASS"
result_mark = ":heavy_check_mark:"
else :
fail_type_list.append(bin_type)
os.remove(output_path)
global FAIL_TO_BUILD
FAIL_TO_BUILD = True
check_result = "FAIL"
result_mark = ""
else :
if PARTITION_SIZE < int(BINARY_SIZE) :
fail_type_list.append(bin_type)
os.remove(output_path)
global FAIL_TO_BUILD
FAIL_TO_BUILD = True
check_result = "FAIL"
result_mark = ""
Expand Down

0 comments on commit eff33e5

Please sign in to comment.