Skip to content

Commit f6e291a

Browse files
some fixes
- code look - update `StoPdict = arch.translated_arch()` - use getfilesR
1 parent 4900c9a commit f6e291a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

gen_data/gen-update-json.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ def update_json_conf(file) -> None:
1313
data = strip_info(file)
1414
jdata = json.load(open(JSON_CONF, 'r'))
1515

16+
# resolv data
17+
jdata = utils.resolv_data(jdata, data[0], data[1], [data[2]])
18+
1619
# update url
17-
jdata[data[0]][data[1]][f"{data[2]}url"] = get_release_url(
18-
RELEASE_TAG, data[3])
20+
jdata[data[0]] \
21+
[data[1]] \
22+
[f"{data[2]}url"] = get_release_url(RELEASE_TAG, data[3])
1923

2024
# update sha
21-
jdata[data[0]][data[1]][f"{data[2]}sha"] = os.popen(
22-
f"sha256sum {DIR}/{data[3]}").read().split()[0]
25+
jdata[data[0]] \
26+
[data[1]] \
27+
[f"{data[2]}sha"] = os.popen(f"sha256sum {file}").read().split()[0]
2328

2429
# update JSON_CONF
2530
file = open(JSON_CONF, 'w')
@@ -31,7 +36,7 @@ def strip_info(file):
3136
name = os.path.splitext(name)[0]
3237

3338
sp = name.split("-")
34-
StoPdict = arch.translate()
39+
StoPdict = arch.translated_arch()
3540

3641
suite = sp[0]
3742
variant = sp[1]
@@ -40,8 +45,8 @@ def strip_info(file):
4045
return [suite, variant, packageArchitecture, basename]
4146

4247
def get_release_url(release_tag, file) -> str:
43-
repo="https://github.com/RandomCoderOrg/udroid-download"
44-
url="{}/releases/download/{}/{}".format(repo, release_tag, file)
48+
repo ="https://github.com/RandomCoderOrg/udroid-download"
49+
url ="{}/releases/download/{}/{}".format(repo, release_tag, file)
4550
return url
4651

4752
if __name__ == '__main__':
@@ -54,8 +59,10 @@ def get_release_url(release_tag, file) -> str:
5459
options, args = parser.parse_args()
5560
# get release tag
5661

62+
from utils import getfilesR
63+
5764
RELEASE_TAG = options.release_tag
58-
for file in os.listdir(DIR):
65+
for file in getfilesR(DIR):
5966
if file.endswith(".tar.gz"):
6067
update_json_conf(file)
6168

0 commit comments

Comments
 (0)