Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commitc6ae15b

Browse files
committed
Drop OperatingSystemName from the interface as well
1 parenta7949b9 commitc6ae15b

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

‎src/embed_tests/TestRuntime.cs

Lines changed: 0 additions & 1 deletion
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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ public class Runtime
123123
/// </summary>
124124
publicstaticOperatingSystemTypeOperatingSystem{get;privateset;}
125125

126-
/// <summary>
127-
/// Gets the operating system as reported by python's platform.system().
128-
/// </summary>
129-
publicstaticstringOperatingSystemName{get;privateset;}
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+
stringoperatingSystemName=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
OperatingSystemTypeOSType;
378-
if(!OperatingSystemTypeMapping.TryGetValue(OperatingSystemName,outOSType))
372+
if(!OperatingSystemTypeMapping.TryGetValue(operatingSystemName,outOSType))
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
elseif(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
395388
OperatingSystem=OperatingSystemType.Darwin;
396389
elseif(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
397390
OperatingSystem=OperatingSystemType.Windows;
398-
391+
else
392+
OperatingSystem=OperatingSystemType.Other;
393+
399394
switch(RuntimeInformation.ProcessArchitecture)
400395
{
401396
caseArchitecture.X86:

‎src/runtime/typemanager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ int MAP_ANONYMOUS
625625
caseOperatingSystemType.Linux:
626626
return0x20;
627627
default:
628-
thrownewNotImplementedException($"mmap is not supported on{Runtime.OperatingSystemName}");
628+
thrownewNotImplementedException($"mmap is not supported onthis operating system");
629629
}
630630
}
631631
}
@@ -659,7 +659,7 @@ internal static IMemoryMapper CreateMemoryMapper()
659659
caseOperatingSystemType.Windows:
660660
returnnewWindowsMemoryMapper();
661661
default:
662-
thrownewNotImplementedException($"No support for{Runtime.OperatingSystemName}");
662+
thrownewNotImplementedException($"No support forthis operating system");
663663
}
664664
}
665665

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp