Skip to content

Commit 6dbd8b6

Browse files
erinxoconDonJayamanne
authored andcommitted
Append --pre to black installation command when pipenv is used (microsoft#5393)
* if black is being installed, append pre This is so it can be resolved correctly by pipenv * extra extra read all about it! update news * if black is being installed make sure we pass --pre * Thank author of PR
1 parent a215b5d commit 6dbd8b6

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

news/2 Fixes/5171.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Append `--pre` to black installation command so pipenv can properly resolve it.
2+
(thanks [Erin O'Connell](https://github.com/erinxocon))

src/client/common/installer/pipEnvInstaller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ export class PipEnvInstaller extends ModuleInstaller implements IModuleInstaller
3131
return interpreters && interpreters.length > 0;
3232
}
3333
protected async getExecutionInfo(moduleName: string, _resource?: Uri): Promise<ExecutionInfo> {
34+
const args = ['install', moduleName, '--dev'];
35+
if (moduleName === 'black') {
36+
args.push('--pre');
37+
};
3438
return {
35-
args: ['install', moduleName, '--dev'],
39+
args: args,
3640
execPath: pipenvName
3741
};
3842
}

src/test/common/installer/moduleInstaller.unit.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ suite('Module Installer', () => {
217217
test(`Test args (${product.name})`, async () => {
218218
setActiveInterpreter();
219219
const expectedArgs = ['install', moduleName, '--dev'];
220+
if (moduleName === 'black') {
221+
expectedArgs.push('--pre')
222+
}
220223
await installModuleAndVerifyCommand(pipenvName, expectedArgs);
221224
});
222225
}

0 commit comments

Comments
 (0)