Skip to content

Commit 21b7694

Browse files
authored
Capitalize Activate.ps1 (#9911)
1 parent 1a7618f commit 21b7694

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

news/2 Fixes/2607.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Capitalize `Activate.ps1` in code for PowerShell Core on Linux.

src/client/common/terminal/environmentActivationProviders/commandPrompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export class CommandPromptAndPowerShell extends BaseActivationCommandProvider {
2525

2626
if (targetShell === TerminalShellType.commandPrompt && scriptFile.endsWith('activate.bat')) {
2727
return [scriptFile.fileToCommandArgument()];
28-
} else if ((targetShell === TerminalShellType.powershell || targetShell === TerminalShellType.powershellCore) && scriptFile.endsWith('activate.ps1')) {
28+
} else if ((targetShell === TerminalShellType.powershell || targetShell === TerminalShellType.powershellCore) && scriptFile.endsWith('Activate.ps1')) {
2929
return [`& ${scriptFile.fileToCommandArgument()}`];
30-
} else if (targetShell === TerminalShellType.commandPrompt && scriptFile.endsWith('activate.ps1')) {
30+
} else if (targetShell === TerminalShellType.commandPrompt && scriptFile.endsWith('Activate.ps1')) {
3131
// lets not try to run the powershell file from command prompt (user may not have powershell)
3232
return [];
3333
} else {
@@ -37,7 +37,7 @@ export class CommandPromptAndPowerShell extends BaseActivationCommandProvider {
3737

3838
private getScriptsInOrderOfPreference(targetShell: TerminalShellType): string[] {
3939
const batchFiles = ['activate.bat', path.join('Scripts', 'activate.bat'), path.join('scripts', 'activate.bat')];
40-
const powerShellFiles = ['activate.ps1', path.join('Scripts', 'activate.ps1'), path.join('scripts', 'activate.ps1')];
40+
const powerShellFiles = ['Activate.ps1', path.join('Scripts', 'Activate.ps1'), path.join('scripts', 'Activate.ps1')];
4141
if (targetShell === TerminalShellType.commandPrompt) {
4242
return batchFiles.concat(powerShellFiles);
4343
} else {

src/test/common/terminals/activation.bash.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ suite('Terminal Environment Activation (bash)', () => {
1818
const hasSpaces = pythonPath.indexOf(' ') > 0;
1919
const suiteTitle = hasSpaces ? 'and there are spaces in the script file (pythonpath),' : 'and there are no spaces in the script file (pythonpath),';
2020
suite(suiteTitle, () => {
21-
['activate', 'activate.sh', 'activate.csh', 'activate.fish', 'activate.bat', 'activate.ps1'].forEach(scriptFileName => {
21+
['activate', 'activate.sh', 'activate.csh', 'activate.fish', 'activate.bat', 'Activate.ps1'].forEach(scriptFileName => {
2222
suite(`and script file is ${scriptFileName}`, () => {
2323
let serviceContainer: TypeMoq.IMock<IServiceContainer>;
2424
let fileSystem: TypeMoq.IMock<IFileSystem>;

src/test/common/terminals/activation.commandPrompt.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
2121

2222
const suiteTitle = hasSpaces ? 'and there are spaces in the script file (pythonpath),' : 'and there are no spaces in the script file (pythonpath),';
2323
suite(suiteTitle, () => {
24-
['activate', 'activate.sh', 'activate.csh', 'activate.fish', 'activate.bat', 'activate.ps1'].forEach(scriptFileName => {
24+
['activate', 'activate.sh', 'activate.csh', 'activate.fish', 'activate.bat', 'Activate.ps1'].forEach(scriptFileName => {
2525
suite(`and script file is ${scriptFileName}`, () => {
2626
let serviceContainer: TypeMoq.IMock<IServiceContainer>;
2727
let fileSystem: TypeMoq.IMock<IFileSystem>;
@@ -38,7 +38,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
3838
});
3939

4040
getNamesAndValues<TerminalShellType>(TerminalShellType).forEach(shellType => {
41-
const isScriptFileSupported = ['activate.bat', 'activate.ps1'].indexOf(scriptFileName) >= 0;
41+
const isScriptFileSupported = ['activate.bat', 'Activate.ps1'].indexOf(scriptFileName) >= 0;
4242
const titleTitle = isScriptFileSupported
4343
? `Ensure terminal type is supported (Shell: ${shellType.name})`
4444
: `Ensure terminal type is not supported (Shell: ${shellType.name})`;
@@ -141,7 +141,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
141141
});
142142
});
143143

144-
suite('and script file is activate.ps1', () => {
144+
suite('and script file is Activate.ps1', () => {
145145
let serviceContainer: TypeMoq.IMock<IServiceContainer>;
146146
let fileSystem: TypeMoq.IMock<IFileSystem>;
147147
let platform: TypeMoq.IMock<IPlatformService>;
@@ -163,7 +163,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
163163
const bash = new CommandPromptAndPowerShell(serviceContainer.object);
164164

165165
platform.setup(p => p.isWindows).returns(() => true);
166-
const pathToScriptFile = path.join(path.dirname(pythonPath), 'activate.ps1');
166+
const pathToScriptFile = path.join(path.dirname(pythonPath), 'Activate.ps1');
167167
fileSystem.setup(fs => fs.fileExists(TypeMoq.It.isValue(pathToScriptFile))).returns(() => Promise.resolve(true));
168168
const command = await bash.getActivationCommands(resource, TerminalShellType.commandPrompt);
169169

@@ -174,7 +174,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
174174
const bash = new CommandPromptAndPowerShell(serviceContainer.object);
175175

176176
platform.setup(p => p.isWindows).returns(() => true);
177-
const pathToScriptFile = path.join(path.dirname(pythonPath), 'activate.ps1');
177+
const pathToScriptFile = path.join(path.dirname(pythonPath), 'Activate.ps1');
178178
fileSystem.setup(fs => fs.fileExists(TypeMoq.It.isValue(pathToScriptFile))).returns(() => Promise.resolve(true));
179179
const command = await bash.getActivationCommands(resource, TerminalShellType.powershell);
180180

@@ -185,7 +185,7 @@ suite('Terminal Environment Activation (cmd/powershell)', () => {
185185
const bash = new CommandPromptAndPowerShell(serviceContainer.object);
186186

187187
platform.setup(p => p.isWindows).returns(() => true);
188-
const pathToScriptFile = path.join(path.dirname(pythonPath), 'activate.ps1');
188+
const pathToScriptFile = path.join(path.dirname(pythonPath), 'Activate.ps1');
189189
fileSystem.setup(fs => fs.fileExists(TypeMoq.It.isValue(pathToScriptFile))).returns(() => Promise.resolve(true));
190190
const command = await bash.getActivationCommands(resource, TerminalShellType.powershellCore);
191191

0 commit comments

Comments
 (0)