Skip to content
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

Replace unzip package #1419

Merged
merged 45 commits into from
Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a764bc9
Undo changes
Feb 13, 2018
9d1b2cc
Test fixes
Feb 13, 2018
a91291a
Increase timeout
Mar 2, 2018
bf266af
Remove double event listening
Mar 7, 2018
7bc6bd6
Remove test
Mar 7, 2018
8ce8b48
Revert "Remove test"
Mar 7, 2018
e3a549e
Revert "Remove double event listening"
Mar 7, 2018
92e8c1e
#1096 The if statement is automatically formatted incorrectly
Mar 27, 2018
b540a1d
Merge fix
Mar 27, 2018
7b0573e
Add more tests
Mar 27, 2018
facb106
More tests
Mar 27, 2018
f113881
Typo
Mar 27, 2018
3e76718
Test
Mar 28, 2018
6e85dc6
Also better handle multiline arguments
Mar 28, 2018
99e037c
Add a couple missing periods
brettcannon Mar 28, 2018
3caeab7
Undo changes
Feb 13, 2018
eeb1f11
Test fixes
Feb 13, 2018
f5f78c7
Increase timeout
Mar 2, 2018
88744da
Remove double event listening
Mar 7, 2018
65dde44
Remove test
Mar 7, 2018
c513f71
Revert "Remove test"
Mar 7, 2018
ccb3886
Revert "Remove double event listening"
Mar 7, 2018
106f4db
Merge fix
Mar 27, 2018
9e5cb43
Merge branch 'master' of https://github.com/MikhailArkhipov/vscode-py…
Apr 5, 2018
e1da6a6
#1257 On type formatting errors for args and kwargs
Apr 5, 2018
e78f0fb
Handle f-strings
Apr 5, 2018
725cf71
Stop importing from test code
Apr 5, 2018
5cd6d45
#1308 Single line statements leading to an indentation on the next line
Apr 5, 2018
27613db
#726 editing python after inline if statement invalid indent
Apr 5, 2018
8061a20
Undo change
Apr 5, 2018
17dc292
Move constant
Apr 5, 2018
65964b9
Harden LS startup error checks
Apr 10, 2018
4bf5a4c
#1364 Intellisense doesn't work after specific const string
Apr 10, 2018
6f7212c
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Apr 12, 2018
ddbd295
Telemetry for the analysis enging
Apr 12, 2018
ffd1d3f
Merge branch 'master' of https://github.com/Microsoft/vscode-python
Apr 12, 2018
d4afb6c
PR feedback
Apr 13, 2018
12186b8
Fix typo
Apr 16, 2018
ca90529
Test baseline update
Apr 16, 2018
a7267b5
Jedi 0.12
Apr 16, 2018
cfee109
Priority to goto_defition
Apr 16, 2018
1285789
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
Apr 17, 2018
d1ff1d9
News
Apr 17, 2018
1bd1651
Replace unzip
Apr 17, 2018
a69b6fd
Merge branch 'master' of https://github.com/Microsoft/vscode-python i…
Apr 17, 2018
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,7 @@
"md5": "2.2.1",
"minimatch": "3.0.4",
"named-js-regexp": "1.3.3",
"node-stream-zip": "^1.6.0",
"opn": "5.3.0",
"pidusage": "1.2.0",
"reflect-metadata": "0.1.12",
Expand All @@ -1862,7 +1863,6 @@
"uint64be": "1.0.1",
"unicode": "10.0.0",
"untildify": "3.0.2",
"unzip": "0.1.11",
"vscode-debugadapter": "1.28.0",
"vscode-debugprotocol": "1.28.0",
"vscode-extension-telemetry": "0.0.15",
Expand Down
42 changes: 33 additions & 9 deletions src/client/activation/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as fs from 'fs';
import * as path from 'path';
import * as request from 'request';
import * as requestProgress from 'request-progress';
import * as unzip from 'unzip';
import { ExtensionContext, OutputChannel, ProgressLocation, window } from 'vscode';
import { STANDARD_OUTPUT_CHANNEL } from '../common/constants';
import { noop } from '../common/core.utils';
Expand All @@ -16,6 +15,9 @@ import { IServiceContainer } from '../ioc/types';
import { HashVerifier } from './hashVerifier';
import { PlatformData } from './platformData';

// tslint:disable-next-line:no-require-imports no-var-requires
const StreamZip = require('node-stream-zip');

const downloadUriPrefix = 'https://pvsc.blob.core.windows.net/python-analysis';
const downloadBaseFileName = 'python-analysis-vscode';
const downloadVersion = '0.1.0';
Expand Down Expand Up @@ -109,15 +111,37 @@ export class AnalysisEngineDownloader {
const installFolder = path.join(extensionPath, this.engineFolder);
const deferred = createDeferred();

fs.createReadStream(tempFilePath)
.pipe(unzip.Extract({ path: installFolder }))
.on('finish', () => {
deferred.resolve();
})
.on('error', (err) => {
deferred.reject(err);
const title = 'Extracting files... ';
await window.withProgress({
location: ProgressLocation.Window,
title
}, (progress) => {
const zip = new StreamZip({
file: tempFilePath,
storeEntries: true
});
await deferred.promise;

let totalFiles = 0;
let extractedFiles = 0;
zip.on('ready', () => {
totalFiles = zip.entriesCount;
if (!fs.existsSync(installFolder)) {
fs.mkdirSync(installFolder);
}
zip.extract(null, installFolder, (err, count) => {
if (err) {
deferred.reject(err);
} else {
deferred.resolve();
}
zip.close();
});
}).on('extract', (entry, file) => {
extractedFiles += 1;
progress.report({ message: `${title}${Math.round(100 * extractedFiles / totalFiles)}%` });
});
return deferred.promise;
});
this.output.append('done.');

// Set file to executable
Expand Down