update-python-libraries: support pyproject and flit formats

Generally, this is determined by the fetcher. The
notable exception would be the "wheel" format.
This commit is contained in:
Jonathan Ringer 2022-01-13 15:40:19 -08:00 committed by Jonathan Ringer
parent d016f26cda
commit ce0a907730

View File

@ -242,7 +242,9 @@ DEFAULT_SETUPTOOLS_EXTENSION = 'tar.gz'
FORMATS = {
'setuptools' : DEFAULT_SETUPTOOLS_EXTENSION,
'wheel' : 'whl'
'wheel' : 'whl',
'pyproject' : 'tar.gz',
'flit' : 'tar.gz'
}
def _determine_fetcher(text):
@ -281,12 +283,8 @@ def _determine_extension(text, fetcher):
if extension is None:
if src_format is None:
src_format = 'setuptools'
elif src_format == 'flit':
raise ValueError("Don't know how to update a Flit package.")
elif src_format == 'other':
raise ValueError("Don't know how to update a format='other' package.")
elif src_format == 'pyproject':
raise ValueError("Don't know how to update a pyproject package.")
extension = FORMATS[src_format]
elif fetcher == 'fetchurl':