Skip to content

Commit a898e8f

Browse files
committed
Remove jinja and constants not in use
Signed-off-by: Vivek Reddy Karri <[email protected]>
1 parent 261a504 commit a898e8f

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

platform/mellanox/integration-scripts/hwmgmt_kernel_patches.py

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import argparse
77
import copy
88
import difflib
9-
import jinja2
109

1110
from helper import *
1211

@@ -15,23 +14,8 @@
1514
PATCH_TABLE_LOC = "platform/mellanox/hw-management/hw-mgmt/recipes-kernel/linux/"
1615
PATCH_TABLE_NAME = "Patch_Status_Table.txt"
1716
PATCH_TABLE_DELIMITER = "----------------------"
18-
PATCH_OS_SUBFOLDERS = {"default" : "./linux-{}",
19-
"sonic" : "./linux-{}/sonic",
20-
"opt" : "./linux-{}/sonic",
21-
"cumulus" : "./linux-{}/cumulus"}
2217
PATCH_NAME = "patch name"
23-
SUBVERSION = "subversion"
24-
PATCH_DST = "dst_type"
25-
PATCH_ACCEPTED = "accepted"
26-
PATCH_CANDIDATE = "candidate"
2718
COMMIT_ID = "Upstream commit id"
28-
COMMIT_TEMPLATE = """
29-
{% if changes %} ## Patch List:
30-
{% for key, value in changes.items() %}
31-
* {{key}} : {{value}}
32-
{%- endfor %}
33-
{% endif %}
34-
"""
3519

3620
def trim_array_str(str_list):
3721
ret = [elem.strip() for elem in str_list]
@@ -40,7 +24,7 @@ def trim_array_str(str_list):
4024
def get_line_elements(line):
4125
columns_raw = line.split("|")
4226
if len(columns_raw) < 3:
43-
return False\
27+
return False
4428
# remove empty firsta and last elem
4529
columns_raw = columns_raw[1:-1]
4630
columns = trim_array_str(columns_raw)
@@ -111,9 +95,12 @@ def load_patch_table(path, k_version):
11195
return table
11296

11397
def build_commit_description(changes):
114-
base_loader = jinja2.BaseLoader()
115-
template = jinja2.Environment(loader=base_loader).from_string(COMMIT_TEMPLATE)
116-
content = template.render(changes=changes)
98+
if not changes:
99+
return ""
100+
content = "\n"
101+
content = content + " ## Patch List\n"
102+
for key, value in changes.items():
103+
content = content + f"* {key} : {value}\n"
117104
return content
118105

119106
class Data:

platform/mellanox/integration-scripts/tests/test_hwmgmtaction.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636

3737
TEST_SLK_COMMIT = """\
3838
Intgerate HW-MGMT 7.0030.0937 Changes
39-
40-
## Patch List:
41-
39+
## Patch List
4240
* 0001-i2c-mlxcpld-Update-module-license.patch : https://github.com/gregkh/linux/commit/f069291bd5fc
4341
* 0002-i2c-mlxcpld-Decrease-polling-time-for-performance-im.patch : https://github.com/gregkh/linux/commit/cb9744178f33
4442
* 0003-i2c-mlxcpld-Add-support-for-I2C-bus-frequency-settin.patch : https://github.com/gregkh/linux/commit/66b0c2846ba8
@@ -50,6 +48,7 @@
5048
* 0009-i2c-mux-mlxcpld-Extend-driver-to-support-word-addres.patch : https://github.com/gregkh/linux/commit/c52a1c5f5db5
5149
* 0010-i2c-mux-mlxcpld-Extend-supported-mux-number.patch : https://github.com/gregkh/linux/commit/699c0506543e
5250
* 0011-i2c-mux-mlxcpld-Add-callback-to-notify-mux-creation-.patch : https://github.com/gregkh/linux/commit/a39bd92e92b9
51+
5352
"""
5453

5554

@@ -174,6 +173,8 @@ def test_write_series_diff(self, mock_write_lines):
174173
def test_commit_msg(self):
175174
table = load_patch_table(MOCK_INPUTS_DIR, "5.10.140")
176175
sb, slk = self.action.create_commit_msg(table)
176+
print(slk)
177+
print(TEST_SLK_COMMIT)
177178
assert slk.split() == TEST_SLK_COMMIT.split()
178179
assert sb.split() == TEST_SB_COMMIT.split()
179180

0 commit comments

Comments
 (0)