2020-03-25 19:04:56 +11:00
|
|
|
import json
|
|
|
|
import yaml
|
|
|
|
|
2022-01-25 01:37:00 +11:00
|
|
|
with open("moment.flatpak.base.yaml") as f:
|
2020-03-25 19:04:56 +11:00
|
|
|
base = yaml.load(f, Loader=yaml.FullLoader)
|
|
|
|
|
2020-03-26 07:27:40 +11:00
|
|
|
with open("flatpak-pip.json") as f:
|
|
|
|
modules = json.load(f)["modules"]
|
2020-03-25 19:04:56 +11:00
|
|
|
|
|
|
|
# set some modules in front as dependencies and dropping matrix-nio
|
|
|
|
# which is declared separately
|
|
|
|
front = []
|
|
|
|
back = []
|
|
|
|
for m in modules:
|
2020-03-26 07:27:40 +11:00
|
|
|
n = m["name"]
|
|
|
|
if n.startswith("python3-") and \
|
|
|
|
n[len("python3-"):] in ["cffi", "importlib-metadata", "multidict", "pytest-runner", "setuptools-scm"]:
|
2020-03-25 19:04:56 +11:00
|
|
|
front.append(m)
|
|
|
|
else:
|
|
|
|
back.append(m)
|
|
|
|
|
|
|
|
# replace placeholder with modules
|
|
|
|
phold = None
|
2020-03-26 07:27:40 +11:00
|
|
|
for i in range(len(base["modules"])):
|
|
|
|
if base["modules"][i]["name"] == "PLACEHOLDER PYTHON DEPENDENCIES":
|
2020-03-25 19:04:56 +11:00
|
|
|
phold = i
|
|
|
|
break
|
|
|
|
|
2020-03-26 07:27:40 +11:00
|
|
|
base["modules"] = base["modules"][:i] + front + back + base["modules"][i+1:]
|
2020-03-25 19:04:56 +11:00
|
|
|
|
2022-01-25 01:37:00 +11:00
|
|
|
with open("moment.flatpak.yaml", "w") as f:
|
2020-03-25 19:04:56 +11:00
|
|
|
f.write(yaml.dump(base, sort_keys=False, indent=2))
|