Verified Commit d1977f5d authored by BonfaceKilz's avatar BonfaceKilz Committed by Efraim Flashner
Browse files

python24: return `linux` for kernels >= 4.x when `sys.platform` is run


Signed-off-by: Efraim Flashner's avatarEfraim Flashner <efraim@flashner.co.il>
parent c74f8021
......@@ -22,6 +22,7 @@
#:use-module (guix git-download)
#:use-module (guix build-system python)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages maths)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages python)
......@@ -39,6 +40,9 @@
(method url-fetch)
(uri (string-append "https://www.python.org/ftp/python/"
version "/Python-" version ".tar.bz2"))
(patches
(search-patches
"past/patches/python24-get-platform.patch"))
(sha256
(base32
"021y88a4ki07dgq19yhg6zfvmncfiz7h5b2255438i9zmlwl246s"))))
......
This patch makes Python2.4 print out "linux" for kernel versions >= 4.
Patch by Bonface Munyoki <bonfacemunyoki@gmail.com>
*** Python-2.4.6/Python/getplatform.c.orig 2020-07-07 21:26:40.500141410 +0300
--- Python-2.4.6/Python/getplatform.c 2020-07-07 22:34:49.192864557 +0300
***************
*** 2,3 ****
--- 2,4 ----
#include "Python.h"
+ #include <regex.h>
*************** Py_GetPlatform(void)
*** 10,11 ****
--- 11,18 ----
{
+ regex_t regex;
+ regcomp(&regex, "linux[4-9]", 0);
+ if(regexec(&regex, PLATFORM, 0, NULL, 0) == 0)
+ {
+ return "linux";
+ }
return PLATFORM;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment