@@ -246,55 +246,9 @@ public void SetReadExec(IntPtr mappedMemory, int numBytes)
246246 /// </summary>
247247 public static void InitializePlatformData ( )
248248 {
249- IntPtr op = IntPtr . Zero ;
250- IntPtr fn = IntPtr . Zero ;
251- IntPtr platformModule = IntPtr . Zero ;
252- IntPtr emptyTuple = IntPtr . Zero ;
253- try
254- {
255- platformModule = Runtime . PyImport_ImportModule ( "platform" ) ;
256- PythonException . ThrowIfIsNull ( platformModule ) ;
257-
258- fn = Runtime . PyObject_GetAttrString ( platformModule , "system" ) ;
259- PythonException . ThrowIfIsNull ( fn ) ;
260-
261- emptyTuple = Runtime . PyTuple_New ( 0 ) ;
262- op = Runtime . PyObject_Call ( fn , emptyTuple , IntPtr . Zero ) ;
263- PythonException . ThrowIfIsNull ( op ) ;
264-
265- OperatingSystemName = Runtime . GetManagedString ( op ) ;
266-
267- fn = Runtime . PyObject_GetAttrString ( platformModule , "machine" ) ;
268- PythonException . ThrowIfIsNull ( fn ) ;
269-
270- op = Runtime . PyObject_Call ( fn , emptyTuple , IntPtr . Zero ) ;
271- PythonException . ThrowIfIsNull ( op ) ;
272- MachineName = Runtime . GetManagedString ( op ) ;
273- }
274- finally
275- {
276- Runtime . XDecref ( op ) ;
277- Runtime . XDecref ( fn ) ;
278-
279- Runtime . XDecref ( emptyTuple ) ;
280- Runtime . XDecref ( platformModule ) ;
281- }
282-
283- // Now convert the strings into enum values so we can do switch
284- // statements rather than constant parsing.
285- OperatingSystemType OSType ;
286- if ( ! OperatingSystemTypeMapping . TryGetValue ( OperatingSystemName , out OSType ) )
287- {
288- OSType = OperatingSystemType . Other ;
289- }
290- OperatingSystem = OSType ;
291-
292- MachineType MType ;
293- if ( ! MachineTypeMapping . TryGetValue ( MachineName . ToLower ( ) , out MType ) )
294- {
295- MType = MachineType . Other ;
296- }
297- Machine = MType ;
249+ // FIXME: arch, non-windows
250+ Machine = Runtime . Is32Bit ? MachineType . i386 : MachineType . x86_64 ;
251+ OperatingSystem = Runtime . IsWindows ? OperatingSystemType . Windows : OperatingSystemType . Linux ;
298252 }
299253
300254 internal static IMemoryMapper CreateMemoryMapper ( )
0 commit comments