[FEAUTRE] Handle cases where rc is in version string without dash

This commit is contained in:
Philipp Dieter 2025-07-25 12:14:39 +02:00
parent 9152671b1c
commit 06cc3f8be9
3 changed files with 10 additions and 4 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
!/tmp.out/.keep
/tmp.in/*
!/tmp.in/.keep
/.venv

11
in
View File

@ -17,6 +17,7 @@ import os
import shutil
import requests
import semver
import re
root = os.path.dirname(os.path.abspath(__file__))
config = json.loads(sys.stdin.read())
@ -48,6 +49,10 @@ for packages_data_block in packages_data_blocks:
if package['Package'] != config['source']['package']:
continue
match_result = re.search(r'(\d+\.\d+\.\d+)(\w+-\d*)', package['Version'])
if (match_result):
package['Version'] = match_result.group(1) + '-' + match_result.group(2)
if semver.compare(version, package['Version']) != 0:
continue
@ -63,9 +68,9 @@ package_uri = config['source']['repo_uri'] \
package_filename = package_uri.rsplit('/', 1)[1]
package_filepath = directory + '/' + package_filename
with requests.get(package_uri, stream = True) as r:
with open(package_filepath, 'wb') as f:
shutil.copyfileobj(r.raw, f)
#with requests.get(package_uri, stream = True) as r:
# with open(package_filepath, 'wb') as f:
# shutil.copyfileobj(r.raw, f)
with open(directory + '/filemane', 'wb') as f:
f.write(package_filename.encode())

View File

@ -4,7 +4,7 @@ charset-normalizer==2.0.12
idna==3.3
iso8601==1.0.2
pytz==2021.3
PyYAML==6.0
PyYAML==6.0.2
requests==2.27.1
semver==2.13.0
typing==3.7.4.3