lbry-fdroid/recipes/python2/patches/fix-platform-2.7.13.patch

33 lines
607 B
Diff
Raw Normal View History

2017-08-13 03:24:00 +02:00
--- Python-2.7.9/Python/getplatform.c.orig 2014-12-10 16:59:59.000000000 +0100
+++ Python-2.7.9/Python/getplatform.c 2015-05-03 19:17:58.071596232 +0200
@@ -1,12 +1,25 @@
#include "Python.h"
-#ifndef PLATFORM
-#define PLATFORM "unknown"
-#endif
+#include <sys/utsname.h>
+#include <string.h>
const char *
Py_GetPlatform(void)
{
- return PLATFORM;
+ struct utsname u;
+ int i;
+ if ( uname(&u) < 0 )
+ return "unknown";
+
+ char xx[37];
+ memset(xx, 0, 37);
+ strcat (xx, u.sysname);
+ strcat (xx, "-");
+ strcat (xx, u.machine);
+
+ for (i=0; xx[i]; i++)
+ xx[i]=tolower(xx[i]);
+
+ return xx;
}