Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_MAVEN_TOKEN }}
run: npm publish

- name: Commit and push package modifications
Expand Down
28 changes: 18 additions & 10 deletions src/providers/python_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ import {EOL} from "os";
import {getCustom} from "../tools.js";


function getPipFreezeOutput() {
return "EXHORT_PIP_FREEZE" in process.env && process.env["EXHORT_PIP_FREEZE"].trim() != "" ? new Buffer(process.env["EXHORT_PIP_FREEZE"],'base64').toString('ascii') : execSync(`${this.pathToPipBin} freeze --all`, err => {
if (err) {
throw new Error('fail invoking pip freeze to fetch all installed dependencies in environment --> ' + err.message)
}
}).toString();
}

function getPipShowOutput(depNames) {
return "EXHORT_PIP_SHOW" in process.env && process.env["EXHORT_PIP_SHOW"].trim() != "" ? new Buffer(process.env["EXHORT_PIP_SHOW"],'base64').toString('ascii') : execSync(`${this.pathToPipBin} show ${depNames}`, err => {
if (err) {
throw new Error('fail invoking pip show to fetch all installed dependencies metadata --> ' + err.message)
}
}).toString();
}

/** @typedef {{name: string, version: string, dependencies: DependencyEntry[]}} DependencyEntry */


Expand Down Expand Up @@ -144,20 +160,12 @@ export default class Python_controller {
}
#getDependenciesImpl(includeTransitive) {
let dependencies = new Array()
let freezeOutput = execSync(`${this.pathToPipBin} freeze --all`, err =>{
if (err) {
throw new Error('fail invoking pip freeze to fetch all installed dependencies in environment --> ' + err.message)
}
}).toString();
let freezeOutput = getPipFreezeOutput.call(this);
//debug
// freezeOutput = "alternative pip freeze output goes here for debugging"
let lines = freezeOutput.split(EOL)
let depNames = lines.map( line => getDependencyName(line)).join(" ")
let pipShowOutput = execSync(`${this.pathToPipBin} show ${depNames}`, err =>{
if (err) {
throw new Error('fail invoking pip show to fetch all installed dependencies metadata --> ' + err.message)
}
}).toString();
let pipShowOutput = getPipShowOutput.call(this, depNames);
//debug
// pipShowOutput = "alternative pip show output goes here for debugging"
let allPipShowDeps = pipShowOutput.split( EOL +"---" + EOL);
Expand Down
2 changes: 0 additions & 2 deletions test/it/end-to-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ suite('Integration Tests', () => {
let parsedSummaryFromHtml = getParsedKeyFromHtml(html,"\"summary\"",10)
let parsedScannedFromHtml = reportParsedFromHtml.scanned
let parsedStatusFromHtmlSnyk = reportParsedFromHtml.providers["snyk"].status
let parsedStatusFromHtmlossIndex = reportParsedFromHtml.providers["oss-index"].status
expect( typeof html).equals("string")
expect(html).include("html").include("svg")
expect(parsedScannedFromHtml.total).greaterThan(0)
Expand All @@ -92,7 +91,6 @@ suite('Integration Tests', () => {
}
expect(parsedSummaryFromHtml.total).greaterThanOrEqual(0)
expect(parsedStatusFromHtmlSnyk.code).equals(200)
expect(parsedStatusFromHtmlossIndex.code).equals(401)
// parsedSummaryFromHtml.providerStatuses.forEach(provider => expect(provider.status).equals(200))
}).timeout(15000);

Expand Down