UNCLASSIFIED

Commit d310f9f2 authored by Al Fontaine's avatar Al Fontaine
Browse files

Merge branch 'development' into 'master'

fix for whl filename

See merge request !230
parents afbe73fa 240f1266
Pipeline #467291 failed with stages
in 93 minutes and 5 seconds
......@@ -61,6 +61,7 @@ async function getPypiData(url) {
const output = {
sha: results.urls[i].digests.sha256,
updatedUrl: results.urls[i].url,
updatedFilename: results.urls[i].filename,
};
return output;
}
......@@ -140,12 +141,16 @@ async function updateDependency({ fileContent, upgrade, }) {
}
const newValue = upgrade.newValue;
const oldUrl = upgrade.managerData.item.url;
const oldFilename = upgrade.managerData.item.filename;
const searchURL = `https://pypi.org/pypi/${upgrade.depName}/${newValue}/json`;
const updatedData = getPypiData(searchURL);
let newContent = fileContent;
if ((await updatedData).sha && (await updatedData).updatedUrl) {
if ((await updatedData).sha &&
(await updatedData).updatedUrl &&
(await updatedData).updatedFilename) {
newContent = newContent.replace(upgrade.managerData.item.validation.value, (await updatedData).sha);
newContent = newContent.replace(oldUrl, (await updatedData).updatedUrl);
newContent = newContent.replace(oldFilename, (await updatedData).updatedFilename);
}
return newContent;
}
......
This diff is collapsed.
......@@ -55,7 +55,7 @@ async function getHashFromUrl(url: string): Promise<string | string> {
async function getPypiData(
url: string
): Promise<{ sha: string; updatedUrl: string }> {
): Promise<{ sha: string; updatedUrl: string; updatedFilename: string }> {
logger.debug(`${'getPypiData:'} ${url} ${'filename'}`);
try {
const result = await http.get(url);
......@@ -67,6 +67,7 @@ async function getPypiData(
const output = {
sha: results.urls[i].digests.sha256,
updatedUrl: results.urls[i].url,
updatedFilename: results.urls[i].filename,
};
return output;
......@@ -171,16 +172,25 @@ export async function updateDependency({
const newValue = upgrade.newValue;
const oldUrl = upgrade.managerData.item.url;
const oldFilename = upgrade.managerData.item.filename;
const searchURL = `https://pypi.org/pypi/${upgrade.depName}/${newValue}/json`;
const updatedData = getPypiData(searchURL);
let newContent = fileContent;
if ((await updatedData).sha && (await updatedData).updatedUrl) {
if (
(await updatedData).sha &&
(await updatedData).updatedUrl &&
(await updatedData).updatedFilename
) {
newContent = newContent.replace(
upgrade.managerData.item.validation.value,
(await updatedData).sha
);
newContent = newContent.replace(oldUrl, (await updatedData).updatedUrl);
newContent = newContent.replace(
oldFilename,
(await updatedData).updatedFilename
);
}
return newContent;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment