Przeglądaj źródła

Minor fixes

main
Sindre Stephansen 2 lat temu
rodzic
commit
938147ba65
Podpisane przez: sindre <sindre@sindrestephansen.com> ID klucza GPG: B06FC67D17A46ADE
2 zmienionych plików z 8 dodań i 5 usunięć
  1. +1
    -1
      sync/src/main.py
  2. +7
    -4
      sync/src/pom.py

+ 1
- 1
sync/src/main.py Wyświetl plik

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


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


+ 7
- 4
sync/src/pom.py Wyświetl plik

@@ -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}')


Ładowanie…
Anuluj
Zapisz