Merge.
[fedora-mingw.git] / python3 / mingw32-python-3.1-pwdmodule.patch
1 Index: configure.in
2 ===================================================================
3 --- configure.in        (revision 67686)
4 +++ configure.in        (working copy)
5 @@ -1179,7 +1203,7 @@
6  AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
7  fcntl.h grp.h \
8  ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
9 -shadow.h signal.h stdint.h stropts.h termios.h thread.h \
10 +pwd.h shadow.h signal.h stdint.h stropts.h termios.h thread.h \
11  unistd.h utime.h \
12  sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
13  sys/lock.h sys/mkdev.h sys/modem.h \
14 @@ -2362,7 +2386,7 @@
15  AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
16   clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
17   gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
18 - getpriority getpwent getspnam getspent getsid getwd \
19 + getpriority getpwent getpwuid getpwnam getspnam getspent getsid getwd \
20   kill killpg lchmod lchown lstat mkfifo mknod mktime \
21   mremap nice pathconf pause plock poll pthread_init \
22   putenv readlink realpath \
23 Index: Modules/pwdmodule.c
24 ===================================================================
25 --- Modules/pwdmodule.c (revision 67686)
26 +++ Modules/pwdmodule.c (working copy)
27 @@ -5,8 +5,12 @@
28  #include "structseq.h"
29  
30  #include <sys/types.h>
31 +
32 +#ifdef HAVE_PWD_H
33  #include <pwd.h>
34 +#endif
35  
36 +#ifdef HAVE_GETPWUID
37  static PyStructSequence_Field struct_pwd_type_fields[] = {
38         {"pw_name", "user name"},
39         {"pw_passwd", "password"},
40 @@ -30,6 +34,7 @@
41         struct_pwd_type_fields,
42         7,
43  };
44 +#endif
45  
46  PyDoc_STRVAR(pwd__doc__,
47  "This module provides access to the Unix password database.\n\
48 @@ -43,6 +48,8 @@
49  
50        
51  static int initialized;
52 +
53 +#ifdef HAVE_GETPWUID
54  static PyTypeObject StructPwdType;
55  
56  static void
57 @@ -117,7 +124,9 @@
58         }
59         return mkpwent(p);
60  }
61 +#endif
62  
63 +#ifdef HAVE_GETPWNAM
64  PyDoc_STRVAR(pwd_getpwnam__doc__,
65  "getpwnam(name) -> (pw_name,pw_passwd,pw_uid,\n\
66                      pw_gid,pw_gecos,pw_dir,pw_shell)\n\
67 @@ -138,6 +147,7 @@
68         }
69         return mkpwent(p);
70  }
71 +#endif
72  
73  #ifdef HAVE_GETPWENT
74  PyDoc_STRVAR(pwd_getpwall__doc__,
75 @@ -173,8 +183,12 @@
76  #endif
77  
78  static PyMethodDef pwd_methods[] = {
79 +#ifdef HAVE_GETPWUID
80         {"getpwuid",    pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__},
81 +#endif
82 +#ifdef HAVE_GETPWNAM
83         {"getpwnam",    pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__},
84 +#endif
85  #ifdef HAVE_GETPWENT
86         {"getpwall",    (PyCFunction)pwd_getpwall,
87                 METH_NOARGS,  pwd_getpwall__doc__},
88 @@ -203,6 +217,7 @@
89         if (m == NULL)
90                 return NULL;
91  
92 +#ifdef HAVE_GETPWUID
93         if (!initialized)
94                 PyStructSequence_InitType(&StructPwdType, 
95                                           &struct_pwd_type_desc);
96 @@ -210,6 +225,8 @@
97         PyModule_AddObject(m, "struct_passwd", (PyObject *) &StructPwdType);
98         /* And for b/w compatibility (this was defined by mistake): */
99         PyModule_AddObject(m, "struct_pwent", (PyObject *) &StructPwdType);
100 +#endif
101 +
102         initialized = 1;
103         return m;
104  }