|
|
@@ -8,7 +8,7 @@ from xmlutils import pom_namespace as ns, find_tag_text |
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
Properties: TypeAlias = dict[str, Optional[str]] |
|
|
|
|
|
|
|
|
Properties: TypeAlias = dict[str, str] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PropertyMissing(Exception): |
|
|
class PropertyMissing(Exception): |
|
|
@@ -76,7 +76,10 @@ class PackagePOM: |
|
|
changed = False |
|
|
changed = False |
|
|
|
|
|
|
|
|
for prop, value in props.items(): |
|
|
for prop, value in props.items(): |
|
|
new_value = self._prop_replace(value, props, True) |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
new_value = self._prop_replace(value, props) |
|
|
|
|
|
except PropertyMissing: |
|
|
|
|
|
continue |
|
|
|
|
|
|
|
|
if new_value != value: |
|
|
if new_value != value: |
|
|
changed = True |
|
|
changed = True |
|
|
@@ -85,7 +88,7 @@ class PackagePOM: |
|
|
|
|
|
|
|
|
self.properties = props |
|
|
self.properties = props |
|
|
|
|
|
|
|
|
def _prop_replace(self, text, props: Optional[Properties] = None, quiet: bool = False) -> str: |
|
|
|
|
|
|
|
|
def _prop_replace(self, text: str, props: Optional[Properties] = None) -> str: |
|
|
def lookup_prop(match) -> str: |
|
|
def lookup_prop(match) -> str: |
|
|
prop = match.group(1) |
|
|
prop = match.group(1) |
|
|
|
|
|
|
|
|
@@ -105,7 +108,7 @@ class PackagePOM: |
|
|
except KeyError: |
|
|
except KeyError: |
|
|
value = None |
|
|
value = None |
|
|
|
|
|
|
|
|
if value is None and not quiet: |
|
|
|
|
|
|
|
|
if value is None: |
|
|
raise PropertyMissing(prop) |
|
|
raise PropertyMissing(prop) |
|
|
else: |
|
|
else: |
|
|
logger.debug(f'{self.name}: Replacing property {prop} with {value}') |
|
|
logger.debug(f'{self.name}: Replacing property {prop} with {value}') |
|
|
|