Selaa lähdekoodia

Minor fixes

main
Sindre Stephansen 2 vuotta sitten
vanhempi
commit
938147ba65
Allekirjoittanut: sindre <sindre@sindrestephansen.com> GPG Key ID: B06FC67D17A46ADE
2 muutettua tiedostoa jossa 8 lisäystä ja 5 poistoa
  1. +1
    -1
      sync/src/main.py
  2. +7
    -4
      sync/src/pom.py

+ 1
- 1
sync/src/main.py Näytä tiedosto

@@ -36,7 +36,7 @@ async def main(package_list: Path, output_dir: Path, gradle_repo: str) -> None:

if not config:
print('Error in configuration')
if not config.configurations:
elif not config.configurations:
print('No configurations defined, nothing to do.')
elif not config.mirrors:
print('No mirrors defined. Add maven.mirrors in the config file.')


+ 7
- 4
sync/src/pom.py Näytä tiedosto

@@ -8,7 +8,7 @@ from xmlutils import pom_namespace as ns, find_tag_text

logger = logging.getLogger(__name__)

Properties: TypeAlias = dict[str, Optional[str]]
Properties: TypeAlias = dict[str, str]


class PropertyMissing(Exception):
@@ -76,7 +76,10 @@ class PackagePOM:
changed = False

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:
changed = True
@@ -85,7 +88,7 @@ class PackagePOM:

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:
prop = match.group(1)

@@ -105,7 +108,7 @@ class PackagePOM:
except KeyError:
value = None

if value is None and not quiet:
if value is None:
raise PropertyMissing(prop)
else:
logger.debug(f'{self.name}: Replacing property {prop} with {value}')


Loading…
Peruuta
Tallenna