-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS Python analysis engine integration #1231
Conversation
src/client/activation/downloader.ts
Outdated
}); | ||
|
||
let firstResponse = true; | ||
https.get(uri, (response) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use npm package like request-package for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/client/activation/downloader.ts
Outdated
|
||
let firstResponse = true; | ||
https.get(uri, (response) => { | ||
this.checkHttpResponse(response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return value of checkHttpResponse
not checked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N/A as replaced by request-package
src/client/activation/downloader.ts
Outdated
deferred.resolve(); | ||
}).on('error', (err) => { | ||
tempFile.cleanupCallback(); | ||
this.handleError(`Unable to download Python Analysis Engine. Error ${err}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors thrown by this.handleError
will not be bubbled up.
You're better off changing as follows:
fileStream.on('finish', () => {
fileStream.close();
deferred.resolve();
}).on('error', (err) => {
tempFile.cleanupCallback();
deferred.reject(err);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve
will be done by VSC progress. Added reject
src/client/activation/downloader.ts
Outdated
try { | ||
await this.verifyDownload(localTempFilePath); | ||
await this.unpackArchive(context.extensionPath, localTempFilePath); | ||
} finally { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to add a catch here and then invoke this.handleError
This way, all errors are handled and logged in one place (you won't need to call this.handleError
in a number of places)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/client/activation/downloader.ts
Outdated
this.output.append('Verifying download... '); | ||
const verifier = new HashVerifier(); | ||
if (!await verifier.verifyHash(filePath, this.platformData.getExpectedHash())) { | ||
this.handleError('Hash of the downloaded file does not match.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to just throw an exception here, let calling code log the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more for the output formatting. It starts with Verifying download...
and I'd like it to look as
Verifying download... valid
on the same line and on different lines if there is an error. Same as in other cases: download and unpack.
@@ -32,6 +39,10 @@ export class ConfigurationService implements IConfigurationService { | |||
return process.env.VSC_PYTHON_CI_TEST === '1'; | |||
} | |||
|
|||
public async checkDependencies(): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to some other place. Checking dependencies is not the role of a Configuration service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -55,4 +66,22 @@ export class ConfigurationService implements IConfigurationService { | |||
} while (retries < 20); | |||
} | |||
} | |||
|
|||
private async checkDotNet(): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move out of this class ( Checking dependencies is not the role of a Configuration service)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
test_script: | ||
- yarn run clean | ||
- yarn run vscode:prepublish | ||
- yarn run testDebugger --silent | ||
- yarn run testSingleWorkspace --silent | ||
- yarn run testMultiWorkspace --silent | ||
# - yarn run testAnalysisEngine --silent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't remember, but please could you confirm that the tests only run on Appveyor and not on Travis. If this is true, then we might want to create an issue for this, to ensure we try to get this resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They currently only on Appveyor b/c of setup issues. We need to discuss if we want a) install .NET Runtime on Travis or b) rely on some other means. (b) may work for us as we download from Azure but third party contributors cant.
|
||
const downloadUriPrefix = 'https://pvsc.blob.core.windows.net/python-analysis'; | ||
const downloadBaseFileName = 'python-analysis-vscode'; | ||
const downloadVersion = '0.1.0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to store the version info, in package.json
.
This way its easier when we make upgrades (all dependencies and versions are stored and listed in a central location - package.json
).
E.g. package.json
:
},
"dotNetDepedencies":{
"python-analysis-vscode":"0.1.0"
},
"dependencies": {
"arch": "^2.1.0",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to store the hashes
in here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hashes are generated in the build. And we don't want users to be able to modify them (or any malicious code running under user creds). Also, don't want users to be able to change engine version or URLs.
|
||
// This file will be replaced by a generated one during the release build | ||
// with actual hashes of the uploaded packages. | ||
export const analysis_engine_win_x86_sha512 = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to generate some json
file to store this information, rather than generating a .js
. Feels better to store in a json
file (possibly package.json
or other).
The goal is to ensure all depedencies (file names, versions, etc are stored in a central location such as package.json
or as in .net, we'd stored these in the project file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. We don't want it visible and easily modifiable.
Replaces #1144
Fixes #1101
Fixes #1087
Fixes #1063
Fixes #1051
Fixes #1004
Fixes #998
Fixes #408
Fixes #82
This pull request: