[FEAUTRE] Handle cases where rc is in version string without dash
This commit is contained in:
11
in
11
in
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user