8000 Rename $IsOSX to $IsMacOS by SteveL-MSFT · Pull Request #4757 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Rename $IsOSX to $IsMacOS #4757

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

Merged
merged 3 commits into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ gen
#VS Code files
.vscode

# OS X
# macOS
.DS_Store

# TestsResults
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ If you have any problems building, please consult the developer [FAQ][].

| AppVeyor (Windows) | Travis CI (Linux) | Travis CI (macOS) | Code Coverage Status |
|--------------------------|-------------------|-------------------|----------------------|
| [![av-nightly-image][]][av-nightly-site] | [![linux-nightly-image][]][tv-site] | [![osx-nightly-image][]][tv-site] | [![cc-image][]][cc-site] |
| [![av-nightly-image][]][av-nightly-site] | [![linux-nightly-image][]][tv-site] | [![macOS-nightly-image][]][tv-site] | [![cc-image][]][cc-site] |

[bd-linux]: docs/building/linux.md
[bd-windows]: docs/building/windows-core.md
Expand All @@ -123,7 +123,7 @@ If you have any problems building, please consult the developer [FAQ][].
[av-image]: https://ci.appveyor.com/api/projects/status/nsng9iobwa895f98/branch/master?svg=true
[av-site]: https://ci.appveyor.com/project/PowerShell/powershell
[linux-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.Linux.svg
[osx-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.OSX.svg
[macOS-nightly-image]: https://jimtru1979.blob.core.windows.net/badges/DailyBuildStatus.OSX.svg
[av-nightly-image]: https://ci.appveyor.com/api/projects/status/46yd4jogtm2jodcq?svg=true
[av-nightly-site]: https://ci.appveyor.com/project/PowerShell/powershell-f975h
[cc-site]: https://codecov.io/gh/PowerShell/PowerShell
Expand Down
2 changes: 1 addition & 1 deletion assets/powershell.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ powershell(1) -- command-line shell and .NET REPL
## DESCRIPTION

PowerShell is an automation and configuration management platform.
It consists of a cross-platform (Windows, Linux and OS X)
It consists of a cross-platform (Windows, Linux and macOS)
command-line shell and associated scripting language.

## OPTIONS
Expand Down
34 changes: 17 additions & 17 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ function Get-EnvironmentInformation

$environment += @{'IsCoreCLR' = $true}
$environment += @{'IsLinux' = $Runtime::IsOSPlatform($OSPlatform::Linux)}
$environment += @{'IsOSX' = $Runtime::IsOSPlatform($OSPlatform::OSX)}
$environment += @{'IsMacOS' = $Runtime::IsOSPlatform($OSPlatform::OSX)}
$environment += @{'IsWindows' = $Runtime::IsOSPlatform($OSPlatform::Windows)}
} catch {
$environment += @{'IsCoreCLR' = $false}
$environment += @{'IsLinux' = $false}
$environment += @{'IsOSX' = $false}
$environment += @{'IsMacOS' = $false}
$environment += @{'IsWindows' = $true}
}

Expand Down Expand Up @@ -352,7 +352,7 @@ function Start-PSBuild {
# Verify we have all tools in place to do the build
$precheck = precheck 'dotnet' "Build dependency 'dotnet' not found in PATH. Run Start-PSBootstrap. Also see: https://dotnet.github.io/getting-started/"

if ($Environment.IsLinux -or $Environment.IsOSX) {
if ($Environment.IsLinux -or $Environment.IsMacOS) {
foreach ($Dependency in 'cmake', 'make', 'g++') {
$precheck = $precheck -and (precheck $Dependency "Build dependency '$Dependency' not found. Run 'Start-PSBootstrap'.")
}
Expand All @@ -376,7 +376,7 @@ Fix steps:

1. Remove the installed version from:
- on windows '`$env:LOCALAPPDATA\Microsoft\dotnet'
- on osx and linux '`$env:HOME/.dotnet'
- on macOS and linux '`$env:HOME/.dotnet'
2. Run Start-PSBootstrap or Install-Dotnet
3. Start-PSBuild -Clean
`n
Expand Down Expand Up @@ -441,10 +441,10 @@ Fix steps:
}

# Build native components
if (($Environment.IsLinux -or $Environment.IsOSX) -and -not $SMAOnly) {
if (($Environment.IsLinux -or $Environment.IsMacOS) -and -not $SMAOnly) {
$Ext = if ($Environment.IsLinux) {
"so"
} elseif ($Environment.IsOSX) {
} elseif ($Environment.IsMacOS) {
"dylib"
}

Expand Down Expand Up @@ -508,7 +508,7 @@ Fix steps:
if ($Environment.IsRedHatFamily) {
# add two symbolic links to system shared libraries that libmi.so is dependent on to handle
# platform specific changes. This is the only set of platforms needed for this currently
# as Ubuntu has these specific library files in the platform and OSX builds for itself
# as Ubuntu has these specific library files in the platform and macOS builds for itself
# against the correct versions.
if ( ! (test-path "$publishPath/libssl.so.1.0.0")) {
$null = New-Item -Force -ItemType SymbolicLink -Target "/lib64/libssl.so.10" -Path "$publishPath/libssl.so.1.0.0" -ErrorAction Stop
Expand Down Expand Up @@ -592,7 +592,7 @@ function New-PSOptions {

$ConfigWarningMsg = "The passed-in Configuration value '{0}' is not supported on '{1}'. Use '{2}' instead."
if (-not $Configuration) {
$Configuration = if ($Environment.IsLinux -or $Environment.IsOSX) {
$Configuration = if ($Environment.IsLinux -or $Environment.IsMacOS) {
"Linux"
} elseif ($Environment.IsWindows) {
"Debug"
Expand All @@ -612,7 +612,7 @@ function New-PSOptions {
}
}
Default {
if ($Environment.IsLinux -or $Environment.IsOSX) {
if ($Environment.IsLinux -or $Environment.IsMacOS) {
$Configuration = "Linux"
Write-Warning ($ConfigWarningMsg -f $switch.Current, $Environment.LinuxInfo.PRETTY_NAME, $Configuration)
}
Expand Down Expand Up @@ -655,7 +655,7 @@ function New-PSOptions {
}
}

$Executable = if ($Environment.IsLinux -or $Environment.IsOSX) {
$Executable = if ($Environment.IsLinux -or $Environment.IsMacOS) {
"powershell"
} elseif ($Environment.IsWindows) {
"powershell.exe"
Expand Down Expand Up @@ -1078,7 +1078,7 @@ function Start-PSxUnit {
throw "xUnit tests are only currently supported on Linux / OS X"
}

if ($Environment.IsOSX) {
if ($Environment.IsMacOS) {
log "Not yet supported on OS X, pretending they passed..."
return
}
Expand Down Expand Up @@ -1129,11 +1129,11 @@ function Install-Dotnet {
$obtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"

# Install for Linux and OS X
if ($Environment.IsLinux -or $Environment.IsOSX) {
if ($Environment.IsLinux -or $Environment.IsMacOS) {
# Uninstall all previous dotnet packages
$uninstallScript = if ($Environment.IsUbuntu) {
"dotnet-uninstall-debian-packages.sh"
} elseif ($Environment.IsOSX) {
} elseif ($Environment.IsMacOS) {
"dotnet-uninstall-pkgs.sh"
}

Expand Down Expand Up @@ -1200,7 +1200,7 @@ function Start-PSBootstrap {
Push-Location $PSScriptRoot/tools

try {
if ($Environment.IsLinux -or $Environment.IsOSX) {
if ($Environment.IsLinux -or $Environment.IsMacOS) {
# This allows sudo install to be optional; needed when running in containers / as root
# Note that when it is null, Invoke-Expression (but not &) must be used to interpolate properly
$sudo = if (!$NoSudo) { "sudo" }
Expand Down Expand Up @@ -1258,7 +1258,7 @@ function Start-PSBootstrap {
Start-NativeExecution {
Invoke-Expression "$baseCommand $Deps"
}
} elseif ($Environment.IsOSX) {
} elseif ($Environment.IsMacOS) {
precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/"

# Build tools
Expand Down Expand Up @@ -1885,7 +1885,7 @@ function Start-CrossGen {
}
} elseif ($Environment.IsLinux) {
"linux-x64"
} elseif ($Environment.IsOSX) {
} elseif ($Environment.IsMacOS) {
"osx-x64"
}

Expand Down Expand Up @@ -1914,7 +1914,7 @@ function Start-CrossGen {
"clrjit.dll"
} elseif ($Environment.IsLinux) {
"libclrjit.so"
} elseif ($Environment.IsOSX) {
} elseif ($Environment.IsMacOS) {
"libclrjit.dylib"
}

Expand Down
2 changes: 1 addition & 1 deletion docker/tests/containerTestCommon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function Set-RepoName
function Test-SkipWindows
{
[bool] $canRunWindows = (Get-DockerEngineOs) -like 'Windows*'
return ($IsLinux -or $IsOSX -or !$canRunWindows)
return ($IsLinux -or $IsMacOS -or !$canRunWindows)
}

function Test-SkipLinux
Expand Down
2 changes: 1 addition & 1 deletion docs/learning-powershell/create-powershell-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you would like to author one script that will return the IP address across Li

```PowerShell
# Script to return current IPv4 addresses for Linux, MacOS, or Windows
$IP = if ($IsLinux -or $IsOSX) {
$IP = if ($IsLinux -or $IsMacOS) {
$ipInfo = ifconfig | Select-String 'inet'
$ipInfo = [regex]::matches($ipInfo,"addr:\b(?:\d{1,3}\.){3}\d{1,3}\b") | ForEach-Object value
foreach ($ip in $ipInfo) {
Expand Down
4 changes: 2 additions & 2 deletions docs/maintainers/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ This is to help track the release preparation work.
Delete the `docker` branch once the builds succeed.
- Windows: queue a new build in `PowerShell Windows Docker Build` on VSTS.
1. Verify the generated docker container images.
1. [Update the homebrew formula](#homebrew) for the OSX package.
1. [Update the homebrew formula](#homebrew) for the macOS package.
This task usually will be taken care of by the community,
so we can wait for one day or two and see if the homebrew formula has already been updated,
and only do the update if it hasn't.

## Building Packages

> Note: Linux and Windows packages are taken care of by our release build pipeline in VSTS,
while the OSX package needs to be built separately on a macOS.
while the macOS package needs to be built separately on a macOS.

The release build should be started based on the `release` branch.
The release Git tag won't be created until all release preparation tasks are done,
Expand Down
6 changes: 3 additions & 3 deletions docs/testing-guidelines/TestRoadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ This will provide us much needed visibility in how PowerShell Core is being used
We already have infrastructure in place to allow us see how PowerShell Core is being used, by collecting telemetry from PowerShell Core, we can improve our confidence as we drive to production quality.

### Logging
The code which on Windows create ETW logging has been completely stubbed out on Linux/OSX.
We should take advantage of the native logging mechanisms on Linux/OSX and implement a logger similar to the ETW logger on Windows using Syslog (or equivalent).
The code which on Windows create ETW logging has been completely stubbed out on Linux/macOS.
We should take advantage of the native logging mechanisms on Linux/macOS and implement a logger similar to the ETW logger on Windows using Syslog (or equivalent).
We could use this data during test runs to identify test gaps.
Simply by capturing the cmdlets and their parameters which are invoked during test would illuminate the gaps we have in our current tests, and allow us to easily fill them.
It is not sufficient to support only one platform because we have many tests which determine at runtime whether or not it should run based on OS, so data from Windows will not be the same as that from Linux or MacOS.
Expand Down Expand Up @@ -69,7 +69,7 @@ In addition to loopback tests using both WSMan and SSH protocols, we should have
* Windows Client->Nano Server
* Windows Client->Linux Server
* Linux Client -> Windows Server
* OSX Client -> Nano Client
* macOS Client -> Nano Client
* PowerShell Core Client -> Full PowerShell Server
* Full PowerShell Client -> PowerShell Core Server
* Downlevel Full PowerShell Client -> PowerShell Core Server
Expand Down
8 changes: 4 additions & 4 deletions src/System.Management.Automation/CoreCLR/CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public static bool IsLinux
}

/// <summary>
/// True if the current platform is OS X.
/// True if the current platform is macOS.
/// </summary>
public static bool IsOSX
public static bool IsMacOS
{
get
{
Expand Down Expand Up @@ -605,7 +605,7 @@ internal static uint NonWindowsGetThreadId()

internal static int NonWindowsGetProcessParentPid(int pid)
{
return IsOSX ? Unix.NativeMethods.GetPPid(pid) : Unix.GetProcFSParentPid(pid);
return IsMacOS ? Unix.NativeMethods.GetPPid(pid) : Unix.GetProcFSParentPid(pid);
}

// Unix specific implementations of required functionality
Expand Down Expand Up @@ -710,7 +710,7 @@ internal static class NativeMethods
{
private const string psLib = "libpsl-native";

// Ansi is a misnomer, it is hardcoded to UTF-8 on Linux and OS X
// Ansi is a misnomer, it is hardcoded to UTF-8 on Linux and macOS

// C bools are 1 byte and so must be marshaled as I1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4963,8 +4963,8 @@ .ForwardHelpCategory Cmdlet
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),

new SessionStateVariableEntry(
SpecialVariables.IsOSX,
Platform.IsOSX,
SpecialVariables.IsMacOS,
Platform.IsMacOS,
String.Empty,
ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),

Expand Down Expand Up @@ -5138,9 +5138,9 @@ internal static SessionStateAliasEntry[] BuiltInAliases
"Invoke-RestMethod", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
new SessionStateAliasEntry("iwr",
"Invoke-WebRequest", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
// Porting note: #if !UNIX is used to disable aliases for cmdlets which conflict with Linux / OS X
// Porting note: #if !UNIX is used to disable aliases for cmdlets which conflict with Linux / macOS
#if !UNIX
// ac is a native command on OS X
// ac is a native command on macOS
new SessionStateAliasEntry("ac",
"Add-Content", "", ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope),
new SessionStateAliasEntry("compare",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ private void InitNativeProcess()
{
// UseShellExecute is not properly supported on Unix. It runs the file with '/bin/sh'.
// Before the behavior is improved (tracked by dotnet/corefx#19956), we use xdg-open/open as the default programs
string executable = Platform.IsLinux ? "xdg-open" : /* OS X */ "open";
string executable = Platform.IsLinux ? "xdg-open" : /* macOS */ "open";
startInfo.Arguments = "\"" + startInfo.FileName + "\" " + startInfo.Arguments;
startInfo.FileName = executable;
startInfo.UseShellExecute = false;
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/engine/SpecialVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ internal static class SpecialVariables
internal const string IsLinux = "IsLinux";
internal static VariablePath IsLinuxPath = new VariablePath("IsLinux");

internal const string IsOSX = "IsOSX";
internal static VariablePath IsOSXPath = new VariablePath("IsOSX");
internal const string IsMacOS = "IsMacOS";
internal static VariablePath IsMacOSPath = new VariablePath("IsMacOS");

internal const string IsWindows = "IsWindows";
internal static VariablePath IsWindowsPath = new VariablePath("IsWindows");
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/help/HelpCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ private void LaunchOnlineHelp(Uri uriToLaunch)
this.WriteVerbose(string.Format(CultureInfo.InvariantCulture, HelpDisplayStrings.OnlineHelpUri, uriToLaunch.OriginalString));
System.Diagnostics.Process browserProcess = new System.Diagnostics.Process();
#if UNIX
browserProcess.StartInfo.FileName = Platform.IsLinux ? "xdg-open" : /* OS X */ "open";
browserProcess.StartInfo.FileName = Platform.IsLinux ? "xdg-open" : /* macOS */ "open";
browserProcess.StartInfo.Arguments = uriToLaunch.OriginalString;
browserProcess.Start();
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ protected override void InvokeDefaultAction(string path)
bool invokeDefaultProgram = false;
if (Directory.Exists(path))
{
// Path points to a directory. We have to use xdg-open/open on Linux/OSX.
// Path points to a directory. We have to use xdg-open/open on Linux/macOS.
invokeDefaultProgram = true;
}
else
Expand All @@ -1345,15 +1345,15 @@ protected override void InvokeDefaultAction(string path)
catch (Win32Exception ex) when (ex.NativeErrorCode == 13)
{
// Error code 13 -- Permission denied
// The file is possibly not an executable. We try xdg-open/open on Linux/OSX.
// The file is possibly not an executable. We try xdg-open/open on Linux/macOS.
invokeDefaultProgram = true;
}
}

if (invokeDefaultProgram)
{
const string quoteFormat = "\"{0}\"";
invokeProcess.StartInfo.FileName = Platform.IsLinux ? "xdg-open" : /* OS X */ "open";
invokeProcess.StartInfo.FileName = Platform.IsLinux ? "xdg-open" : /* macOS */ "open";
if (NativeCommandParameterBinder.NeedQuotes(path))
{
path = string.Format(CultureInfo.InvariantCulture, quoteFormat, path);
Expand Down
6 changes: 3 additions & 3 deletions test/csharp/test_CorePsPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static void TestGetUserName()
}
}

[Fact(Skip="Bad arguments for OS X")]
[Fact(Skip="Bad arguments for macOS")]
public static void TestGetMachineName()
{
var startInfo = new ProcessStartInfo
Expand All @@ -61,7 +61,7 @@ public static void TestGetMachineName()
}
}

[Fact(Skip="Bad arguments for OS X")]
[Fact(Skip="Bad arguments for macOS")]
public static void TestGetFQDN()
{
var startInfo = new ProcessStartInfo
Expand All @@ -84,7 +84,7 @@ public static void TestGetFQDN()
}
}

[Fact(Skip="Bad arguments for OS X")]
[Fact(Skip="Bad arguments for macOS")]
public static void TestGetDomainName()
{
var startInfo = new ProcessStartInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

try {
#
# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and OSX.
# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and macOS.
# The issue has been reported to CoreCLR team. We need to work around it for now with the following approach:
# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests
# 2. For daily build, build with '-CrossGen' but don't run the parsing tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

try {
#
# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and OSX.
# CrossGen'ed assemblies cause a hang to happen intermittently when running this test suite in Linux and macOS.
# The issue has been reported to CoreCLR team. We need to work around it for now with the following approach:
# 1. For pull request and push commit, build without '-CrossGen' and run the parsing tests
# 2. For daily build, build with '-CrossGen' but don't run the parsing tests
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/Language/Parser/Parser.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ foo``u{2195}abc
}

It "Check that a command that uses shell execute can be run from the command line and that no exception is thrown. (line 1702)" {
if ( $IsLinux -or $IsOSX ) {
if ( $IsLinux -or $IsMacOS ) {
# because we execute on *nix based on executable bit, and the file name doesn't matter
# so we can use the same filename as for windows, just make sure it's executable with chmod
"#!/bin/sh`necho ""Hello World""" | out-file -encoding ASCII $shellfile
Expand Down
Loading
0