Update python to 3.7.4, reduce patch significantly

This commit is contained in:
Jeremy Soller 2019-07-16 22:09:18 -06:00
parent 2c061f7d9f
commit d90e711e61
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
3 changed files with 104 additions and 280 deletions

View File

@ -1,275 +0,0 @@
diff -ru Python-3.6.1/configure Python-3.6.1-new/configure
--- Python-3.6.1/configure 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/configure 2017-07-03 15:26:44.804152125 -0700
@@ -3256,6 +3256,9 @@
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-*-redox*)
+ ac_sys_system=Redox
+ ;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
@@ -3302,9 +3305,7 @@
_host_cpu=
;;
*)
- # for now, limit cross builds to known configurations
- MACHDEP="unknown"
- as_fn_error $? "cross build not supported for $host" "$LINENO" 5
+ _host_cpu=$host_cpu
esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi
@@ -11343,7 +11344,6 @@
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-$as_echo "#define HAVE_FCHDIR 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -11393,7 +11393,6 @@
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-$as_echo "#define HAVE_FDATASYNC 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -12093,7 +12092,6 @@
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-$as_echo "#define HAVE_SETGROUPS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
@@ -12491,8 +12489,8 @@
$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
- LIBS="$LIBS -lrt"
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+ LIBS="$LIBS -lrt"
$as_echo "#define TIMEMODULE_LIB rt" >>confdefs.h
@@ -12510,7 +12508,6 @@
ac_fn_c_check_func "$LINENO" "clock_getres" "ac_cv_func_clock_getres"
if test "x$ac_cv_func_clock_getres" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_CLOCK_GETRES 1
_ACEOF
else
@@ -12553,7 +12550,6 @@
$as_echo "$ac_cv_lib_rt_clock_getres" >&6; }
if test "x$ac_cv_lib_rt_clock_getres" = xyes; then :
- $as_echo "#define HAVE_CLOCK_GETRES 1" >>confdefs.h
fi
diff -ru Python-3.6.1/Lib/posixpath.py Python-3.6.1-new/Lib/posixpath.py
--- Python-3.6.1/Lib/posixpath.py 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Lib/posixpath.py 2017-07-04 13:28:08.034693302 -0700
@@ -165,11 +165,7 @@
def islink(path):
"""Test whether a path is a symbolic link"""
- try:
- st = os.lstat(path)
- except (OSError, AttributeError):
- return False
- return stat.S_ISLNK(st.st_mode)
+ return False
# Being true for dangling symbolic links is also useful.
diff -ru Python-3.6.1/Modules/clinic/posixmodule.c.h Python-3.6.1-new/Modules/clinic/posixmodule.c.h
--- Python-3.6.1/Modules/clinic/posixmodule.c.h 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Modules/clinic/posixmodule.c.h 2017-07-03 14:47:11.991792352 -0700
@@ -519,7 +519,7 @@
#endif /* defined(HAVE_LCHFLAGS) */
-#if defined(HAVE_CHROOT)
+#if 0
PyDoc_STRVAR(os_chroot__doc__,
"chroot($module, /, path)\n"
diff -ru Python-3.6.1/Modules/faulthandler.c Python-3.6.1-new/Modules/faulthandler.c
--- Python-3.6.1/Modules/faulthandler.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Modules/faulthandler.c 2017-07-03 14:39:30.321353882 -0700
@@ -906,7 +906,7 @@
SetErrorMode(mode | SEM_NOGPFAULTERRORBOX);
#endif
-#ifdef HAVE_SYS_RESOURCE_H
+#if 0
struct rlimit rl;
/* Disable creation of core dump */
diff -ru Python-3.6.1/Modules/_io/fileio.c Python-3.6.1-new/Modules/_io/fileio.c
--- Python-3.6.1/Modules/_io/fileio.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Modules/_io/fileio.c 2017-07-04 13:13:07.963211923 -0700
@@ -457,7 +457,7 @@
}
}
else {
-#if defined(S_ISDIR) && defined(EISDIR)
+#if 0
/* On Unix, open will succeed for directories.
In Python, there should be no file objects referring to
directories, so we need a check. */
@@ -467,7 +467,7 @@
goto error;
}
#endif /* defined(S_ISDIR) */
-#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
+#if 0
if (fdfstat.st_blksize > 1)
self->blksize = fdfstat.st_blksize;
#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
diff -ru Python-3.6.1/Modules/posixmodule.c Python-3.6.1-new/Modules/posixmodule.c
--- Python-3.6.1/Modules/posixmodule.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Modules/posixmodule.c 2017-07-03 15:31:13.753481813 -0700
@@ -188,7 +188,6 @@
#define HAVE_PIPE 1
#define HAVE_SYSTEM 1
#define HAVE_WAIT 1
-#define HAVE_TTYNAME 1
#endif /* _MSC_VER */
#endif /* ! __WATCOMC__ || __QNX__ */
@@ -2940,7 +2939,7 @@
#endif /* HAVE_LCHFLAGS */
-#ifdef HAVE_CHROOT
+#if 0
/*[clinic input]
os.chroot
path: path_t
@@ -5563,8 +5562,6 @@
os_sched_yield_impl(PyObject *module)
/*[clinic end generated code: output=902323500f222cac input=e54d6f98189391d4]*/
{
- if (sched_yield())
- return posix_error();
Py_RETURN_NONE;
}
@@ -11804,7 +11801,7 @@
(name_len == 1 || (direntp->d_name[1] == '.' && name_len == 2));
if (!is_dot) {
entry = DirEntry_from_posix_info(&iterator->path, direntp->d_name,
- name_len, direntp->d_ino
+ name_len, 0
#ifdef HAVE_DIRENT_D_TYPE
, direntp->d_type
#endif
diff -ru Python-3.6.1/Modules/timemodule.c Python-3.6.1-new/Modules/timemodule.c
--- Python-3.6.1/Modules/timemodule.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Modules/timemodule.c 2017-07-03 14:41:43.868293016 -0700
@@ -966,7 +966,7 @@
return PyFloat_FromDouble(total * 1e-7);
#else
-#if defined(HAVE_SYS_RESOURCE_H)
+#if 0
struct rusage ru;
#endif
#ifdef HAVE_TIMES
@@ -1000,7 +1000,7 @@
}
#endif
-#if defined(HAVE_SYS_RESOURCE_H)
+#if 0
if (getrusage(RUSAGE_SELF, &ru) == 0) {
double total;
total = ru.ru_utime.tv_sec + ru.ru_utime.tv_usec * 1e-6;
@@ -1195,7 +1195,7 @@
And I'm lazy and hate C so nyer.
*/
-#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__)
+#if 0
PyObject *otz0, *otz1;
tzset();
PyModule_AddIntConstant(m, "timezone", timezone);
diff -ru Python-3.6.1/Python/pylifecycle.c Python-3.6.1-new/Python/pylifecycle.c
--- Python-3.6.1/Python/pylifecycle.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Python/pylifecycle.c 2017-07-04 09:28:10.863071915 -0700
@@ -998,7 +998,7 @@
#else
if (Py_FileSystemDefaultEncoding == NULL)
{
- Py_FileSystemDefaultEncoding = get_locale_encoding();
+ Py_FileSystemDefaultEncoding = "utf-8";
if (Py_FileSystemDefaultEncoding == NULL)
Py_FatalError("Py_Initialize: Unable to get the locale encoding");
diff -ru Python-3.6.1/Python/pytime.c Python-3.6.1-new/Python/pytime.c
--- Python-3.6.1/Python/pytime.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Python/pytime.c 2017-07-03 15:29:14.832184973 -0700
@@ -578,9 +578,6 @@
info->implementation = "clock_gettime(CLOCK_REALTIME)";
info->monotonic = 0;
info->adjustable = 1;
- if (clock_getres(CLOCK_REALTIME, &res) == 0)
- info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
- else
info->resolution = 1e-9;
}
#else /* HAVE_CLOCK_GETTIME */
@@ -714,15 +711,10 @@
}
if (info) {
- struct timespec res;
info->monotonic = 1;
info->implementation = implementation;
info->adjustable = 0;
- if (clock_getres(clk_id, &res) != 0) {
- PyErr_SetFromErrno(PyExc_OSError);
- return -1;
- }
- info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
+ info->resolution = 1e-5;
}
if (_PyTime_FromTimespec(tp, &ts, raise) < 0)
return -1;
diff -ru Python-3.6.1/Python/random.c Python-3.6.1-new/Python/random.c
--- Python-3.6.1/Python/random.c 2017-03-20 23:32:38.000000000 -0700
+++ Python-3.6.1-new/Python/random.c 2017-07-03 16:07:31.740783648 -0700
@@ -79,7 +79,7 @@
#else /* !MS_WINDOWS */
-#if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL)
+#if 0
#define PY_GETRANDOM 1
/* Call getrandom() to get random bytes:
@@ -316,7 +316,7 @@
if (urandom_cache.fd >= 0)
fd = urandom_cache.fd;
else {
- fd = _Py_open("/dev/urandom", O_RDONLY);
+ fd = _Py_open("rand:", O_RDONLY);
if (fd < 0) {
if (errno == ENOENT || errno == ENXIO ||
errno == ENODEV || errno == EACCES) {
@@ -361,7 +361,7 @@
} while (0 < size);
}
else {
- fd = _Py_open_noraise("/dev/urandom", O_RDONLY);
+ fd = _Py_open_noraise("rand:", O_RDONLY);
if (fd < 0) {
return -1;
}

View File

@ -1,5 +1,6 @@
VERSION=3.6.2
VERSION=3.7.4
TAR=https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz
BUILD_DEPENDS=(openssl)
export CONFIG_SITE=config.site
@ -15,7 +16,15 @@ function recipe_update {
function recipe_build {
cp ../config.site ./
./configure --build=${BUILD} --host=${HOST} --build=${ARCH} --prefix=/
./configure \
--build=${BUILD} \
--host=${HOST} \
--build=${ARCH} \
--prefix=/ \
--disable-ipv6
sed -i 's|#define HAVE_PTHREAD_KILL 1|/* #undef HAVE_PTHREAD_KILL */|g' pyconfig.h
sed -i 's|#define HAVE_SCHED_SETSCHEDULER 1|/* #undef HAVE_SCHED_SETSCHEDULER */|g' pyconfig.h
sed -i 's|#define HAVE_SYS_RESOURCE_H 1|/* #undef HAVE_SYS_RESOURCE_H */|g' pyconfig.h
make -j"$(nproc)"
skip=1
}
@ -32,8 +41,7 @@ function recipe_clean {
function recipe_stage {
dest="$(realpath $1)"
make prefix="$dest" install
$STRIP "$dest/bin/python3.6"
rm -rf "$dest"/{share,lib/*.a,include}
make DESTDIR="$dest" install -j"$(nproc)"
"$STRIP" "$dest/bin/python3.7"
skip=1
}

View File

@ -0,0 +1,91 @@
diff -ruwN source/configure source-new/configure
--- source/configure 2019-07-08 12:03:50.000000000 -0600
+++ source-new/configure 2019-07-16 21:25:29.432607847 -0600
@@ -3261,6 +3261,9 @@
*-*-cygwin*)
ac_sys_system=Cygwin
;;
+ *-*-redox*)
+ ac_sys_system=Redox
+ ;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
@@ -3293,7 +3296,7 @@
if test "$cross_compiling" = yes; then
case "$host" in
- *-*-linux*)
+ *-*-linux*|*-*-redox*)
case "$host_cpu" in
arm*)
_host_cpu=arm
diff -ruwN source/Lib/distutils/util.py source-new/Lib/distutils/util.py
--- source/Lib/distutils/util.py 2019-07-08 12:03:50.000000000 -0600
+++ source-new/Lib/distutils/util.py 2019-07-16 22:07:35.994862914 -0600
@@ -131,7 +131,7 @@
if not os.path.isabs(pathname):
return os.path.join(new_root, pathname)
else:
- return os.path.join(new_root, pathname[1:])
+ return os.path.join(new_root, pathname.lstrip('/'))
elif os.name == 'nt':
(drive, path) = os.path.splitdrive(pathname)
diff -ruwN source/Modules/main.c source-new/Modules/main.c
--- source/Modules/main.c 2019-07-08 12:03:50.000000000 -0600
+++ source-new/Modules/main.c 2019-07-16 21:46:53.037866142 -0600
@@ -56,6 +56,16 @@
} \
} while (0)
+#if defined(__redox__)
+wchar_t * wcstok(wchar_t * wcs, const wchar_t * delimiters, wchar_t ** ptr) {
+ return NULL;
+}
+
+long wcstol(const wchar_t *restrict nptr, wchar_t **restrict endptr, int base) {
+ return 0;
+}
+#endif
+
#ifdef MS_WINDOWS
#define WCSTOK wcstok_s
#else
diff -ruwN source/Python/pathconfig.c source-new/Python/pathconfig.c
--- source/Python/pathconfig.c 2019-07-08 12:03:50.000000000 -0600
+++ source-new/Python/pathconfig.c 2019-07-16 21:55:34.549726910 -0600
@@ -5,6 +5,10 @@
#include "internal/pystate.h"
#include <wchar.h>
+#if defined(__redox__)
+wchar_t * wcstok(wchar_t * wcs, const wchar_t * delimiters, wchar_t ** ptr);
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff -ruwN source/Python/pytime.c source-new/Python/pytime.c
--- source/Python/pytime.c 2019-07-08 12:03:50.000000000 -0600
+++ source-new/Python/pytime.c 2019-07-16 21:36:53.233119225 -0600
@@ -7,6 +7,19 @@
#include <mach/mach_time.h> /* mach_absolute_time(), mach_timebase_info() */
#endif
+#if defined(__redox__)
+int clock_getres(clockid_t clk_id, struct timespec *res) {
+ if (res) {
+ res->tv_sec = 0;
+ res->tv_nsec = 1000;
+ return 0;
+ } else {
+ errno = EFAULT;
+ return -1;
+ }
+}
+#endif
+
#define _PyTime_check_mul_overflow(a, b) \
(assert(b > 0), \
(_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \