rename p4a so it will clone

This commit is contained in:
zeppi 2022-11-29 15:11:29 -05:00
parent 718044ee02
commit 6d519ea619
567 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,74 @@
from os.path import join, exists
from pythonforandroid.recipe import Recipe
from pythonforandroid.python import GuestPythonRecipe
from pythonforandroid.logger import shprint
import sh
class Python2Recipe(GuestPythonRecipe):
'''
The python2's recipe.
.. note:: This recipe can be built only against API 21+
.. versionchanged:: 0.6.0
Updated to version 2.7.15 and the build process has been changed in
favour of the recently added class
:class:`~pythonforandroid.python.GuestPythonRecipe`
'''
version = "2.7.15"
url = 'https://www.python.org/ftp/python/{version}/Python-{version}.tgz'
name = 'python2'
depends = ['hostpython2']
conflicts = ['python3crystax', 'python3', 'python2legacy']
patches = [
# new 2.7.15 patches
# ('patches/fix-api-minor-than-21.patch',
# is_api_lt(21)), # Todo: this should be tested
'patches/fix-missing-extensions.patch',
'patches/fix-filesystem-default-encoding.patch',
'patches/fix-gethostbyaddr.patch',
'patches/fix-posix-declarations.patch',
'patches/fix-pwd-gecos.patch']
configure_args = ('--host={android_host}',
'--build={android_build}',
'--enable-shared',
'--disable-ipv6',
'--disable-toolbox-glue',
'--disable-framework',
'ac_cv_file__dev_ptmx=yes',
'ac_cv_file__dev_ptc=no',
'--without-ensurepip',
'ac_cv_little_endian_double=yes',
'ac_cv_header_langinfo_h=no',
'--prefix={prefix}',
'--exec-prefix={exec_prefix}')
compiled_extension = '.pyo'
def prebuild_arch(self, arch):
super(Python2Recipe, self).prebuild_arch(arch)
patch_mark = join(self.get_build_dir(arch.arch), '.openssl-patched')
if 'openssl' in self.ctx.recipe_build_order and not exists(patch_mark):
self.apply_patch(join('patches', 'enable-openssl.patch'), arch.arch)
shprint(sh.touch, patch_mark)
def set_libs_flags(self, env, arch):
env = super(Python2Recipe, self).set_libs_flags(env, arch)
if 'libffi' in self.ctx.recipe_build_order:
# For python2 we need to tell configure that we want to use our
# compiled libffi, this step is not necessary for python3.
self.configure_args += ('--with-system-ffi',)
if 'openssl' in self.ctx.recipe_build_order:
recipe = Recipe.get_recipe('openssl', self.ctx)
openssl_build = recipe.get_build_dir(arch.arch)
env['OPENSSL_BUILD'] = openssl_build
env['OPENSSL_VERSION'] = recipe.version
return env
recipe = Python2Recipe()

View file

@ -0,0 +1,46 @@
--- Python-2.7.15.orig/setup.py 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/setup.py 2018-07-05 11:08:57.305125432 +0200
@@ -812,18 +840,15 @@ class PyBuildExt(build_ext):
'/usr/local/ssl/include',
'/usr/contrib/ssl/include/'
]
- ssl_incs = find_file('openssl/ssl.h', inc_dirs,
- search_for_ssl_incs_in
- )
+ ssl_incs = [
+ os.path.join(os.environ["OPENSSL_BUILD"], 'include'),
+ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')]
if ssl_incs is not None:
krb5_h = find_file('krb5.h', inc_dirs,
['/usr/kerberos/include'])
if krb5_h:
ssl_incs += krb5_h
- ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
- ] )
+ ssl_libs = [os.environ["OPENSSL_BUILD"]]
if (ssl_incs is not None and
ssl_libs is not None):
@@ -841,8 +866,8 @@ class PyBuildExt(build_ext):
'^\s*#\s*define\s+OPENSSL_VERSION_NUMBER\s+(0x[0-9a-fA-F]+)' )
# look for the openssl version header on the compiler search path.
- opensslv_h = find_file('openssl/opensslv.h', [],
- inc_dirs + search_for_ssl_incs_in)
+ opensslv_h = [os.path.join(os.environ["OPENSSL_BUILD"], 'include'),
+ os.path.join(os.environ["OPENSSL_BUILD"], 'include', 'openssl')]
if opensslv_h:
name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
if host_platform == 'darwin' and is_macosx_sdk_path(name):
@@ -859,8 +884,7 @@ class PyBuildExt(build_ext):
min_openssl_ver = 0x00907000
have_any_openssl = ssl_incs is not None and ssl_libs is not None
- have_usable_openssl = (have_any_openssl and
- openssl_ver >= min_openssl_ver)
+ have_usable_openssl = (have_any_openssl and True)
if have_any_openssl:
if have_usable_openssl:

View file

@ -0,0 +1,229 @@
diff -Naurp Python-2.7.15.orig/configure.ac Python-2.7.15/configure.ac
--- Python-2.7.15.orig/configure.ac 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/configure.ac 2018-07-05 17:44:50.500985727 +0200
@@ -1790,7 +1790,7 @@ fi
# structures (such as rlimit64) without declaring them. As a
# work-around, disable LFS on such configurations
-use_lfs=yes
+use_lfs=no
AC_MSG_CHECKING(Solaris LFS bug)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _LARGEFILE_SOURCE 1
diff -Naurp Python-2.7.15.orig/Modules/mmapmodule.c Python-2.7.15/Modules/mmapmodule.c
--- Python-2.7.15.orig/Modules/mmapmodule.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/mmapmodule.c 2018-07-05 16:18:40.953035027 +0200
@@ -78,6 +78,12 @@ my_getpagesize(void)
# define MAP_ANONYMOUS MAP_ANON
#endif
+//PMPP API<21
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
+#endif
+//PMPP API<21
+
static PyObject *mmap_module_error;
typedef enum
diff -Naurp Python-2.7.15.orig/Modules/posixmodule.c Python-2.7.15/Modules/posixmodule.c
--- Python-2.7.15.orig/Modules/posixmodule.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/posixmodule.c 2018-07-05 16:20:48.933033807 +0200
@@ -9477,6 +9477,12 @@ all_ins(PyObject *d)
#define MODNAME "posix"
#endif
+//PMPP API<21
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+ extern ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
+#endif
+//PMPP API<21
+
PyMODINIT_FUNC
INITFUNC(void)
{
diff -Naurp Python-2.7.15.orig/Modules/signalmodule.c Python-2.7.15/Modules/signalmodule.c
--- Python-2.7.15.orig/Modules/signalmodule.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/signalmodule.c 2018-07-05 16:40:46.601022385 +0200
@@ -32,6 +32,13 @@
#include <process.h>
#endif
+//PMPP API<21
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+ #define SIGRTMIN 32
+ #define SIGRTMAX _NSIG
+#endif
+//PMPP API<21
+
#ifndef NSIG
# if defined(_NSIG)
# define NSIG _NSIG /* For BSD/SysV */
diff -Naurp Python-2.7.15.orig/Modules/termios.c Python-2.7.15/Modules/termios.c
--- Python-2.7.15.orig/Modules/termios.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/termios.c 2018-07-05 16:43:16.457020956 +0200
@@ -357,7 +357,11 @@ static struct constant {
#endif
/* tcsetattr() constants */
+#if defined(__ANDROID_API__) && __ANDROID_API__ > 0
+ {"TCSANOW", TCSETS}, // https://github.com/android-ndk/ndk/issues/441
+#else
{"TCSANOW", TCSANOW},
+#endif
{"TCSADRAIN", TCSADRAIN},
{"TCSAFLUSH", TCSAFLUSH},
#ifdef TCSASOFT
diff -Naurp Python-2.7.15.orig/Objects/obmalloc.c Python-2.7.15/Objects/obmalloc.c
--- Python-2.7.15.orig/Objects/obmalloc.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Objects/obmalloc.c 2018-07-05 16:52:27.577015700 +0200
@@ -1,5 +1,11 @@
#include "Python.h"
+//PMPP API<21
+#if __ANDROID_API__ < 21
+ extern void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
+#endif
+//PMPP API<21
+
#if defined(__has_feature) /* Clang */
#if __has_feature(address_sanitizer) /* is ASAN enabled? */
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
###############################################################
######### ANDROID LOCALE PATCHES FOR ANDROID API < 21 #########
###############################################################
--- Python-2.7.15.orig/Modules/_localemodule.c 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/_localemodule.c 2018-07-05 16:39:08.241023323 +0200
@@ -170,6 +170,12 @@ PyLocale_setlocale(PyObject* self, PyObj
PyErr_SetString(Error, "invalid locale category");
return NULL;
}
+#else
+ #ifdef __ANDROID__
+ #if defined(__ANDROID_API__) && __ANDROID_API__ < 20
+ return PyUnicode_FromFormat("%s", "C");
+ #endif
+ #endif
#endif
if (locale) {
@@ -215,7 +221,15 @@ PyLocale_localeconv(PyObject* self)
return NULL;
/* if LC_NUMERIC is different in the C library, use saved value */
- l = localeconv();
+ //PMPP API<21
+ #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
+ /* Don't even try on Android's broken locale.h. */
+ goto failed;
+ #else
+ /* if LC_NUMERIC is different in the C library, use saved value */
+ l = localeconv(); //PATCHED
+ #endif
+ //PMPP API<21
/* hopefully, the localeconv result survives the C library calls
involved herein */
@@ -215,7 +215,11 @@ PyLocale_localeconv(PyObject* self)
return NULL;
/* if LC_NUMERIC is different in the C library, use saved value */
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
l = localeconv();
+#else
+ decimal_point = ".";
+#endif
/* hopefully, the localeconv result survives the C library calls
involved herein */
--- Python-2.7.15/Objects/stringlib/formatter.h.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Objects/stringlib/formatter.h 2018-12-26 11:37:08.771315390 +0100
@@ -640,11 +640,17 @@ get_locale_info(int type, LocaleInfo *lo
{
switch (type) {
case LT_CURRENT_LOCALE: {
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
+/* NDK version for SDK below 21 doesn't implement the whole C++11 standard in
+ the STL. locale.h header has stubs for localeconv() method, but the library
+ doesn't implement it. The closest Android SDK that implement localeconv()
+ is SDK 21*/
struct lconv *locale_data = localeconv();
locale_info->decimal_point = locale_data->decimal_point;
locale_info->thousands_sep = locale_data->thousands_sep;
locale_info->grouping = locale_data->grouping;
break;
+#endif
}
case LT_DEFAULT_LOCALE:
locale_info->decimal_point = ".";
--- Python-2.7.15/Objects/stringlib/localeutil.h.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Objects/stringlib/localeutil.h 2018-12-26 11:38:10.003314806 +0100
@@ -202,9 +202,18 @@ _Py_InsertThousandsGroupingLocale(STRING
Py_ssize_t n_digits,
Py_ssize_t min_width)
{
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
+/* NDK version for SDK below 21 doesn't implement the whole C++11 standard in
+ the STL. locale.h header has stubs for localeconv() method, but the library
+ doesn't implement it. The closest Android SDK that implement localeconv()
+ is SDK 21*/
struct lconv *locale_data = localeconv();
const char *grouping = locale_data->grouping;
const char *thousands_sep = locale_data->thousands_sep;
+#else
+ const char *grouping = "\3\0";
+ const char *thousands_sep = ",";
+#endif
return _Py_InsertThousandsGrouping(buffer, n_buffer, digits, n_digits,
min_width, grouping, thousands_sep);
--- Python-2.7.15/Python/pystrtod.c.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Python/pystrtod.c 2018-12-26 11:47:54.723309229 +0100
@@ -126,7 +126,13 @@ _PyOS_ascii_strtod(const char *nptr, cha
{
char *fail_pos;
double val = -1.0;
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
+/* NDK version for SDK below 21 doesn't implement the whole C++11 standard in
+ the STL. locale.h header has stubs for localeconv() method, but the library
+ doesn't implement it. The closest Android SDK that implement localeconv()
+ is SDK 21*/
struct lconv *locale_data;
+#endif
const char *decimal_point;
size_t decimal_point_len;
const char *p, *decimal_point_pos;
@@ -138,8 +144,16 @@ _PyOS_ascii_strtod(const char *nptr, cha
fail_pos = NULL;
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
+/* NDK version for SDK below 21 doesn't implement the whole C++11 standard in
+ the STL. locale.h header has stubs for localeconv() method, but the library
+ doesn't implement it. The closest Android SDK that implement localeconv()
+ is SDK 21*/
locale_data = localeconv();
decimal_point = locale_data->decimal_point;
+#else
+ decimal_point = ".";
+#endif
decimal_point_len = strlen(decimal_point);
assert(decimal_point_len != 0);
@@ -375,8 +389,16 @@ PyOS_string_to_double(const char *s,
Py_LOCAL_INLINE(void)
change_decimal_from_locale_to_dot(char* buffer)
{
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
+/* NDK version for SDK below 21 doesn't implement the whole C++11 standard in
+ the STL. locale.h header has stubs for localeconv() method, but the library
+ doesn't implement it. The closest Android SDK that implement localeconv()
+ is SDK 21*/
struct lconv *locale_data = localeconv();
const char *decimal_point = locale_data->decimal_point;
+#else
+ decimal_point = ".";
+#endif
if (decimal_point[0] != '.' || decimal_point[1] != 0) {
size_t decimal_point_len = strlen(decimal_point);

View file

@ -0,0 +1,11 @@
--- Python-2.7.15.orig/Python/bltinmodule.c 2017-12-29 01:44:57.018079845 +0200
+++ Python-2.7.15/Python/bltinmodule.c 2017-12-29 01:45:02.650079649 +0200
@@ -22,7 +22,7 @@
#elif defined(__APPLE__)
const char *Py_FileSystemDefaultEncoding = "utf-8";
#else
-const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
+const char *Py_FileSystemDefaultEncoding = "utf-8"; /* use default */
#endif
/* Forward */

View file

@ -0,0 +1,12 @@
--- Python-2.7.15/Modules/socketmodule.c.orig 2017-12-29 01:40:09.915694810 +0100
+++ Python-2.7.15/Modules/socketmodule.c 2017-12-29 01:40:36.967694486 +0100
@@ -156,6 +156,9 @@
On the other hand, not all Linux versions agree, so there the settings
computed by the configure script are needed! */
+/* Android hack, same reason are what is described above */
+#undef HAVE_GETHOSTBYNAME_R
+
#ifndef linux
# undef HAVE_GETHOSTBYNAME_R_3_ARG
# undef HAVE_GETHOSTBYNAME_R_5_ARG

View file

@ -0,0 +1,120 @@
diff -Naurp Python-2.7.15/Modules/Setup.dist.orig Python-2.7.15/Modules/Setup.dist
--- Python-2.7.15/Modules/Setup.dist.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/Setup.dist 2018-11-17 20:40:20.153518694 +0100
@@ -464,7 +464,7 @@
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
+zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
# Interface to the Expat XML parser
#
diff -Naurp Python-2.7.15.orig/Makefile.pre.in Python-2.7.15/Makefile.pre.in
--- Python-2.7.15.orig/Makefile.pre.in 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Makefile.pre.in 2018-11-18 00:43:58.777379280 +0100
@@ -20,6 +20,7 @@
# === Variables set by makesetup ===
+MODNAMES= _MODNAMES_
MODOBJS= _MODOBJS_
MODLIBS= _MODLIBS_
diff -Naurp Python-2.7.15.orig/Modules/_ctypes/libffi/src/arm/sysv.S Python-2.7.15/Modules/_ctypes/libffi/src/arm/sysv.S
--- Python-2.7.15.orig/Modules/_ctypes/libffi/src/arm/sysv.S 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/_ctypes/libffi/src/arm/sysv.S 2018-11-17 22:28:50.925456603 +0100
@@ -396,7 +396,7 @@ LSYM(Lbase_args):
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_SINT64
- stmeqia r2, {r0, r1}
+ stmiaeq r2, {r0, r1}
beq LSYM(Lepilogue_vfp)
cmp r3, #FFI_TYPE_FLOAT
diff -Naurp Python-2.7.15.orig/Modules/makesetup Python-2.7.15/Modules/makesetup
--- Python-2.7.15.orig/Modules/makesetup 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/makesetup 2018-11-18 00:43:10.289379743 +0100
@@ -110,6 +110,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
# Rules appended by makedepend
" >$rulesf
DEFS=
+ NAMES=
MODS=
SHAREDMODS=
OBJS=
@@ -181,7 +182,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
*.*) echo 1>&2 "bad word $arg in $line"
exit 1;;
-u) skip=libs; libs="$libs -u";;
- [a-zA-Z_]*) mods="$mods $arg";;
+ [a-zA-Z_]*) NAMES="$NAMES $arg"; mods="$mods $arg";;
*) echo 1>&2 "bad word $arg in $line"
exit 1;;
esac
@@ -284,6 +285,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
echo "1i\\" >$sedf
str="# Generated automatically from $makepre by makesetup."
echo "$str" >>$sedf
+ echo "s%_MODNAMES_%$NAMES%" >>$sedf
echo "s%_MODOBJS_%$OBJS%" >>$sedf
echo "s%_MODLIBS_%$LIBS%" >>$sedf
echo "/Definitions added by makesetup/a$NL$NL$DEFS" >>$sedf
diff -Naurp Python-2.7.15.orig/setup.py Python-2.7.15/setup.py
--- Python-2.7.15.orig/setup.py 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/setup.py 2018-11-18 00:40:50.021381080 +0100
@@ -217,7 +217,11 @@ class PyBuildExt(build_ext):
# Python header files
headers = [sysconfig.get_config_h_filename()]
headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
- for ext in self.extensions[:]:
+ # The sysconfig variable built by makesetup, listing the already
+ # built modules as configured by the Setup files.
+ modnames = sysconfig.get_config_var('MODNAMES').split()
+ removed_modules = []
+ for ext in self.extensions:
ext.sources = [ find_module_file(filename, moddirlist)
for filename in ext.sources ]
if ext.depends is not None:
@@ -231,10 +235,10 @@ class PyBuildExt(build_ext):
# platform specific include directories
ext.include_dirs.extend(incdirlist)
- # If a module has already been built statically,
- # don't build it here
- if ext.name in sys.builtin_module_names:
- self.extensions.remove(ext)
+ # If a module has already been built by the Makefile,
+ # don't build it here.
+ if ext.name in modnames:
+ removed_modules.append(ext)
# Parse Modules/Setup and Modules/Setup.local to figure out which
# modules are turned on in the file.
@@ -249,8 +253,9 @@ class PyBuildExt(build_ext):
input.close()
for ext in self.extensions[:]:
- if ext.name in remove_modules:
- self.extensions.remove(ext)
+ if removed_modules:
+ self.extensions = [x for x in self.extensions if x not in
+ removed_modules]
# When you run "make CC=altcc" or something similar, you really want
# those environment variables passed into the setup.py phase. Here's
@@ -290,6 +295,13 @@ class PyBuildExt(build_ext):
" detect_modules() for the module's name.")
print
+ if removed_modules:
+ print("The following modules found by detect_modules() in"
+ " setup.py, have been")
+ print("built by the Makefile instead, as configured by the"
+ " Setup files:")
+ print_three_column([ext.name for ext in removed_modules])
+
if self.failed:
failed = self.failed[:]
print

View file

@ -0,0 +1,24 @@
--- Python-2.7.15/Modules/posixmodule.c.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/posixmodule.c 2018-12-26 13:46:37.307241303 +0100
@@ -35,6 +35,12 @@
# include <unixio.h>
#endif /* defined(__VMS) */
+/* On android API level 21, 'AT_EACCESS' is not declared although
+ * HAVE_FACCESSAT is defined. */
+#ifdef __ANDROID__
+#undef HAVE_FACCESSAT
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -3991,7 +3997,7 @@ posix_openpty(PyObject *self, PyObject *
slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */
if (slave_fd < 0)
return posix_error();
-#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC)
+#if !defined(__CYGWIN__) && !defined(__ANDROID__) && !defined(HAVE_DEV_PTC)
ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
#ifndef __hpux

View file

@ -0,0 +1,89 @@
--- Python-2.7.15/configure.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/configure 2018-12-26 12:46:08.163275913 +0100
@@ -12177,6 +12177,32 @@ _ACEOF
fi
+ac_fn_c_check_member "$LINENO" "struct passwd" "pw_gecos" "ac_cv_member_struct_passwd_pw_gecos" "
+ #include <sys/types.h>
+ #include <pwd.h>
+
+"
+if test "x$ac_cv_member_struct_passwd_pw_gecos" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_PASSWD_PW_GECOS 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_member "$LINENO" "struct passwd" "pw_passwd" "ac_cv_member_struct_passwd_pw_passwd" "
+ #include <sys/types.h>
+ #include <pwd.h>
+
+"
+if test "x$ac_cv_member_struct_passwd_pw_passwd" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_PASSWD_PW_PASSWD 1
+_ACEOF
+
+
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for time.h that defines altzone" >&5
$as_echo_n "checking for time.h that defines altzone... " >&6; }
--- Python-2.7.15/configure.ac.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/configure.ac 2018-12-26 12:50:20.679273505 +0100
@@ -3562,6 +3562,10 @@ AC_CHECK_MEMBERS([struct stat.st_flags])
AC_CHECK_MEMBERS([struct stat.st_gen])
AC_CHECK_MEMBERS([struct stat.st_birthtime])
AC_CHECK_MEMBERS([struct stat.st_blocks])
+AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_passwd], [], [], [[
+ #include <sys/types.h>
+ #include <pwd.h>
+]])
AC_MSG_CHECKING(for time.h that defines altzone)
AC_CACHE_VAL(ac_cv_header_time_altzone,[
--- Python-2.7.15/pyconfig.h.in.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/pyconfig.h.in 2018-12-26 12:52:13.247272432 +0100
@@ -737,6 +737,12 @@
/* Define to 1 if you have the <stropts.h> header file. */
#undef HAVE_STROPTS_H
+/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */
+#undef HAVE_STRUCT_PASSWD_PW_GECOS
+
+/* Define to 1 if `pw_passwd' is a member of `struct passwd'. */
+#undef HAVE_STRUCT_PASSWD_PW_PASSWD
+
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
--- Python-2.7.15/Modules/pwdmodule.c.orig 2018-04-30 00:47:33.000000000 +0200
+++ Python-2.7.15/Modules/pwdmodule.c 2018-12-26 12:38:47.611280115 +0100
@@ -68,17 +68,17 @@ mkpwent(struct passwd *p)
#define SETS(i,val) sets(v, i, val)
SETS(setIndex++, p->pw_name);
-#ifdef __VMS
- SETS(setIndex++, "");
-#else
+#if defined(HAVE_STRUCT_PASSWD_PW_PASSWD)
SETS(setIndex++, p->pw_passwd);
+#else
+ SETS(setIndex++, "");
#endif
PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromUid(p->pw_uid));
PyStructSequence_SET_ITEM(v, setIndex++, _PyInt_FromGid(p->pw_gid));
-#ifdef __VMS
- SETS(setIndex++, "");
-#else
+#if defined(HAVE_STRUCT_PASSWD_PW_GECOS)
SETS(setIndex++, p->pw_gecos);
+#else
+ SETS(setIndex++, "");
#endif
SETS(setIndex++, p->pw_dir);
SETS(setIndex++, p->pw_shell);