Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 893aa1e

Browse files
committedFeb 5, 2023
bug(pip): pip in Windows is now called via py
Instead of the incorrect `python3`
1 parent 3a6b8e4 commit 893aa1e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4949

5050
### Changed
5151

52+
- Changed the way Python is invoked in Windows machines uses `py` instead of `python`
5253
- Changed the `npm vsce` package to `@vscode/vsce` for publishing
5354
([#814](https://github.com/fortran-lang/vscode-fortran-support/issues/814))
5455
- Changed logger to draw focus on certain error messages

‎src/lib/tools.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as vscode from 'vscode';
44
import * as assert from 'assert';
55
import * as cp from 'child_process';
66
import { isString, isArrayOfString } from './helper';
7+
import { off } from 'process';
78

89
export const LS_NAME = 'fortls';
910
export const EXTENSION_ID = 'fortran';
@@ -142,7 +143,10 @@ export async function promptForMissingTool(
142143
* @param pyPackage name of python package in PyPi
143144
*/
144145
export async function pipInstall(pyPackage: string): Promise<string> {
145-
const py = 'python3'; // Fetches the top-most python in the Shell
146+
let py = 'python3'; // Fetches the top-most python in the Shell
147+
// For Windows, use py instead of python3, see:
148+
// https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-pypi
149+
if (process.platform === 'win32') py = 'py';
146150
const args = ['-m', 'pip', 'install', '--user', '--upgrade', pyPackage];
147151
return await shellTask(py, args, `pip: ${pyPackage}`);
148152
}

0 commit comments

Comments
 (0)
Please sign in to comment.