Commit 73d3bd58 authored by Zen Fu's avatar Zen Fu
Browse files

[weblate] Improve doc (tails#17377)

parent 8b01cda5
# Manage Weblate dependencies that are in not in Debian
#
# **WARNING**
# This file was generated automatically, do not manually modify it.
#
class tails::weblate::python_modules () {
$$pip_packages = [
......@@ -8,10 +12,7 @@ class tails::weblate::python_modules () {
ensure_packages($$pip_packages)
# The following deps are in Debian Stretch but with a version that is older
# than needed by Weblate $WEBLATE_VERSION. The versions noted as comments are the
# requirements for the current Weblate version we are running (check
# manifests/weblate.pp to know which version it is).
# Dependencies for Weblate $WEBLATE_VERSION
$PIP_DEPENDS
}
......@@ -63,6 +63,7 @@ import apt_pkg
apt_cache = apt_pkg.Cache()
class Dependency:
def __init__(self, line, config, split=True):
self.line = line
self.config = config
......@@ -371,6 +372,18 @@ def main():
suite_name = args.debian_suite
suite = getattr(DebianSuite, suite_name)
# Find Python version
a_pkg = apt_cache['python3']
for v in a_pkg.version_list:
archive = suite(v)
if not archive:
continue
running_python = Version(v.ver_str)
break
# Get requirements from Weblate Git repository
repo = git.Repo(args.weblate_repo)
output = io.BytesIO()
......@@ -387,14 +400,6 @@ def main():
deps = [Dependency(i, config['pip']) for i in output.getvalue().decode().splitlines()]
a_pkg = apt_cache['python3']
for v in a_pkg.version_list:
archive = suite(v)
if not archive:
continue
running_python = Version(v.ver_str)
break
def in_debian(dep):
try:
debversions = list(deb_versions(dep.name, suite))
......@@ -426,6 +431,9 @@ def main():
else:
pip_needs.add(dep)
# Traverse dependency many times adding new deps until no new dep is
# added
add = True
while add:
add = False
......@@ -457,6 +465,8 @@ def main():
pass
pip_needs |= pip_adds
# Write Puppet manifest for Debian packages
template_file = pathlib.Path(__file__).with_name("debian_packages.pp").read_text()
template = Template(template_file)
debian_depends = template.substitute(
......@@ -465,6 +475,8 @@ def main():
)
pathlib.Path("manifests/weblate/debian_packages.pp").write_text(debian_depends)
# Write Puppet manifest for Python packages
template_file = pathlib.Path(__file__).with_name("python_modules.pp").read_text()
template = Template(template_file)
via_pip = set((i.name for i in pip_needs))
......@@ -481,5 +493,6 @@ def main():
)
pathlib.Path("manifests/weblate/python_modules.pp").write_text(python_modules)
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment