mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
standardize config on ruamel.yaml with a YAML 1.2 config
This is a key piece of the ongoing `PUBLISH` _config.yml_ migration. There was uneven implementation of which YAML parser to use, and that could lead to bugs where one parser might read a value one way, and a different parser will read the value a different way. I wanted to be sure that YAML 1.2 would always work. This makes all code that handles config files use the same `ruamel.yaml` parsers. This only touches other usages of YAML parsers when there is overlap. This does not port all of _fdroidserver_ to `ruamel.yaml` and YAML 1.2. The metadata files should already be YAML 1.2 anyway. # Conflicts: # fdroidserver/lint.py
This commit is contained in:
parent
53b62415d3
commit
2f47938dbf
15 changed files with 116 additions and 48 deletions
|
@ -11,13 +11,12 @@ from datetime import datetime, timezone
|
|||
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
try:
|
||||
from androguard.core.bytecodes.apk import get_apkid # androguard <4
|
||||
except ModuleNotFoundError:
|
||||
from androguard.core.apk import get_apkid
|
||||
|
||||
from fdroidserver._yaml import yaml, yaml_dumper
|
||||
from .shared_test_code import mkdir_testfiles
|
||||
|
||||
# TODO: port generic tests that use index.xml to index-v2 (test that
|
||||
|
@ -81,7 +80,6 @@ class IntegrationTest(unittest.TestCase):
|
|||
@staticmethod
|
||||
def update_yaml(path, items, replace=False):
|
||||
"""Update a .yml file, e.g. config.yml, with the given items."""
|
||||
yaml = YAML()
|
||||
doc = {}
|
||||
if not replace:
|
||||
try:
|
||||
|
@ -91,7 +89,7 @@ class IntegrationTest(unittest.TestCase):
|
|||
pass
|
||||
doc.update(items)
|
||||
with open(path, "w") as f:
|
||||
yaml.dump(doc, f)
|
||||
yaml_dumper.dump(doc, f)
|
||||
|
||||
@staticmethod
|
||||
def remove_lines(path, unwanted_strings):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue