Skip to content

Commit c6ae15b

Browse files
committed
Drop OperatingSystemName from the interface as well
1 parent a7949b9 commit c6ae15b

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/embed_tests/TestRuntime.cs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public static void PlatformCache()
3030

3131
Assert.That(Runtime.Runtime.Machine, Is.Not.EqualTo(MachineType.Other));
3232
Assert.That(Runtime.Runtime.OperatingSystem, Is.Not.EqualTo(OperatingSystemType.Other));
33-
Assert.That(!string.IsNullOrEmpty(Runtime.Runtime.OperatingSystemName));
3433

3534
// Don't shut down the runtime: if the python engine was initialized
3635
// but not shut down by another test, we'd end up in a bad state.

src/runtime/runtime.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ public class Runtime
123123
/// </summary>
124124
public static OperatingSystemType OperatingSystem { get; private set; }
125125

126-
/// <summary>
127-
/// Gets the operating system as reported by python's platform.system().
128-
/// </summary>
129-
public static string OperatingSystemName { get; private set; }
130-
131-
132126
/// <summary>
133127
/// Map lower-case version of the python machine name to the processor
134128
/// type. There are aliases, e.g. x86_64 and amd64 are two names for
@@ -359,7 +353,7 @@ private static void InitializePlatformData()
359353

360354
fn = PyObject_GetAttrString(platformModule, "system");
361355
op = PyObject_Call(fn, emptyTuple, IntPtr.Zero);
362-
OperatingSystemName = GetManagedString(op);
356+
string operatingSystemName = GetManagedString(op);
363357
XDecref(op);
364358
XDecref(fn);
365359

@@ -375,7 +369,7 @@ private static void InitializePlatformData()
375369
// Now convert the strings into enum values so we can do switch
376370
// statements rather than constant parsing.
377371
OperatingSystemType OSType;
378-
if (!OperatingSystemTypeMapping.TryGetValue(OperatingSystemName, out OSType))
372+
if (!OperatingSystemTypeMapping.TryGetValue(operatingSystemName, out OSType))
379373
{
380374
OSType = OperatingSystemType.Other;
381375
}
@@ -388,14 +382,15 @@ private static void InitializePlatformData()
388382
}
389383
Machine = MType;
390384
#else
391-
OperatingSystem = OperatingSystemType.Other;
392385
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
393386
OperatingSystem = OperatingSystemType.Linux;
394387
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
395388
OperatingSystem = OperatingSystemType.Darwin;
396389
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
397390
OperatingSystem = OperatingSystemType.Windows;
398-
391+
else
392+
OperatingSystem = OperatingSystemType.Other;
393+
399394
switch (RuntimeInformation.ProcessArchitecture)
400395
{
401396
case Architecture.X86:

src/runtime/typemanager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ int MAP_ANONYMOUS
625625
case OperatingSystemType.Linux:
626626
return 0x20;
627627
default:
628-
throw new NotImplementedException($"mmap is not supported on {Runtime.OperatingSystemName}");
628+
throw new NotImplementedException($"mmap is not supported on this operating system");
629629
}
630630
}
631631
}
@@ -659,7 +659,7 @@ internal static IMemoryMapper CreateMemoryMapper()
659659
case OperatingSystemType.Windows:
660660
return new WindowsMemoryMapper();
661661
default:
662-
throw new NotImplementedException($"No support for {Runtime.OperatingSystemName}");
662+
throw new NotImplementedException($"No support for this operating system");
663663
}
664664
}
665665

0 commit comments

Comments
 (0)