From d6fbfe360937c972cdca65e91cb19f0b1419c677 Mon Sep 17 00:00:00 2001 From: Matthew Seiler Date: Sun, 24 Mar 2024 19:30:32 -0400 Subject: [PATCH] Fix custom config reference syntax for `diff-file` This replaces the implementation for custom configparser option references in the diff-file option. Moves detection and handling for the custom syntax into a dedicated submodule. Uses a regular expression to preserve text before and after the reference. --- src/bandersnatch/config/__init__.py | 0 .../config/diff_file_reference.py | 60 ++++++++++++++ src/bandersnatch/configuration.py | 20 +++-- src/bandersnatch/tests/test_configuration.py | 79 +++++++++++++++++++ 4 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 src/bandersnatch/config/__init__.py create mode 100644 src/bandersnatch/config/diff_file_reference.py diff --git a/src/bandersnatch/config/__init__.py b/src/bandersnatch/config/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/bandersnatch/config/diff_file_reference.py b/src/bandersnatch/config/diff_file_reference.py new file mode 100644 index 000000000..2d7a02ec4 --- /dev/null +++ b/src/bandersnatch/config/diff_file_reference.py @@ -0,0 +1,60 @@ +""" +Custom configparser section/option reference syntax for the diff-file option. + +diff-file supports a "section reference" syntax for it's value: + + [mirror] + ... + diff-file = /folder{{
_