|
|
31075cf |
diff -Nur Python-2.7.13.orig/Include/iscygpty.h Python-2.7.13/Include/iscygpty.h
|
|
|
31075cf |
--- Python-2.7.13.orig/Include/iscygpty.h 1970-01-01 01:00:00.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Include/iscygpty.h 2017-08-19 15:50:22.584217400 +0200
|
|
|
31075cf |
@@ -0,0 +1,41 @@
|
|
|
31075cf |
+/*
|
|
|
31075cf |
+ * iscygpty.h -- part of ptycheck
|
|
|
31075cf |
+ * https://github.com/k-takata/ptycheck
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * Copyright (c) 2015-2017 K.Takata
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * You can redistribute it and/or modify it under the terms of either
|
|
|
31075cf |
+ * the MIT license (as described below) or the Vim license.
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * Permission is hereby granted, free of charge, to any person obtaining
|
|
|
31075cf |
+ * a copy of this software and associated documentation files (the
|
|
|
31075cf |
+ * "Software"), to deal in the Software without restriction, including
|
|
|
31075cf |
+ * without limitation the rights to use, copy, modify, merge, publish,
|
|
|
31075cf |
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
31075cf |
+ * permit persons to whom the Software is furnished to do so, subject to
|
|
|
31075cf |
+ * the following conditions:
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * The above copyright notice and this permission notice shall be
|
|
|
31075cf |
+ * included in all copies or substantial portions of the Software.
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
31075cf |
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
31075cf |
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
31075cf |
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
31075cf |
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
31075cf |
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
31075cf |
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
31075cf |
+ */
|
|
|
31075cf |
+
|
|
|
31075cf |
+#ifndef _ISCYGPTY_H
|
|
|
31075cf |
+#define _ISCYGPTY_H
|
|
|
31075cf |
+
|
|
|
31075cf |
+#ifdef _WIN32
|
|
|
31075cf |
+int is_cygpty(int fd);
|
|
|
31075cf |
+int is_cygpty_used(void);
|
|
|
31075cf |
+#else
|
|
|
31075cf |
+#define is_cygpty(fd) 0
|
|
|
31075cf |
+#define is_cygpty_used() 0
|
|
|
31075cf |
+#endif
|
|
|
31075cf |
+
|
|
|
31075cf |
+#endif /* _ISCYGPTY_H */
|
|
|
31075cf |
Binary files Python-2.7.13.orig/Lib/encodings/cp850.pyc and Python-2.7.13/Lib/encodings/cp850.pyc differ
|
|
|
31075cf |
Binary files Python-2.7.13.orig/Lib/io.pyc and Python-2.7.13/Lib/io.pyc differ
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Makefile.pre.in Python-2.7.13/Makefile.pre.in
|
|
|
31075cf |
--- Python-2.7.13.orig/Makefile.pre.in 2017-08-19 14:39:02.676420600 +0200
|
|
|
31075cf |
+++ Python-2.7.13/Makefile.pre.in 2017-08-19 15:57:17.883971100 +0200
|
|
|
31075cf |
@@ -87,7 +87,7 @@
|
|
|
31075cf |
# Extra C flags added for building the interpreter object files.
|
|
|
31075cf |
CFLAGSFORSHARED=@CFLAGSFORSHARED@
|
|
|
31075cf |
# C flags used for building the interpreter object files
|
|
|
31075cf |
-PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
|
|
|
31075cf |
+PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE -D_WIN32_WINNT=0x0600
|
|
|
31075cf |
|
|
|
31075cf |
# ; on Windows otherwise :
|
|
|
31075cf |
DELIM= @DELIM@
|
|
|
31075cf |
@@ -350,6 +350,7 @@
|
|
|
31075cf |
Python/graminit.o \
|
|
|
31075cf |
Python/import.o \
|
|
|
31075cf |
Python/importdl.o \
|
|
|
31075cf |
+ Python/iscygpty.o \
|
|
|
31075cf |
Python/marshal.o \
|
|
|
31075cf |
Python/modsupport.o \
|
|
|
31075cf |
Python/mystrtoul.o \
|
|
|
31075cf |
@@ -804,6 +805,7 @@
|
|
|
31075cf |
Include/import.h \
|
|
|
31075cf |
Include/intobject.h \
|
|
|
31075cf |
Include/intrcheck.h \
|
|
|
31075cf |
+ Include/iscygpty.h \
|
|
|
31075cf |
Include/iterobject.h \
|
|
|
31075cf |
Include/listobject.h \
|
|
|
31075cf |
Include/longintrepr.h \
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Modules/_io/fileio.c Python-2.7.13/Modules/_io/fileio.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Modules/_io/fileio.c 2016-12-17 21:05:07.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Modules/_io/fileio.c 2017-08-19 16:07:42.329687400 +0200
|
|
|
31075cf |
@@ -13,6 +13,7 @@
|
|
|
31075cf |
#endif
|
|
|
31075cf |
#include <stddef.h> /* For offsetof */
|
|
|
31075cf |
#include "_iomodule.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
|
|
|
31075cf |
/*
|
|
|
31075cf |
* Known likely problems:
|
|
|
31075cf |
@@ -953,7 +954,7 @@
|
|
|
31075cf |
if (self->fd < 0)
|
|
|
31075cf |
return err_closed();
|
|
|
31075cf |
Py_BEGIN_ALLOW_THREADS
|
|
|
31075cf |
- res = isatty(self->fd);
|
|
|
31075cf |
+ res = isatty(self->fd) || is_cygpty(self->fd);
|
|
|
31075cf |
Py_END_ALLOW_THREADS
|
|
|
31075cf |
return PyBool_FromLong(res);
|
|
|
31075cf |
}
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Modules/posixmodule.c Python-2.7.13/Modules/posixmodule.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Modules/posixmodule.c 2017-08-19 14:39:02.303399300 +0200
|
|
|
31075cf |
+++ Python-2.7.13/Modules/posixmodule.c 2017-08-19 16:06:05.867170100 +0200
|
|
|
31075cf |
@@ -369,6 +369,8 @@
|
|
|
31075cf |
#endif
|
|
|
31075cf |
#endif
|
|
|
31075cf |
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
+
|
|
|
31075cf |
|
|
|
31075cf |
#ifndef MS_WINDOWS
|
|
|
31075cf |
PyObject *
|
|
|
31075cf |
@@ -6977,7 +6979,7 @@
|
|
|
31075cf |
return NULL;
|
|
|
31075cf |
if (!_PyVerify_fd(fd))
|
|
|
31075cf |
return PyBool_FromLong(0);
|
|
|
31075cf |
- return PyBool_FromLong(isatty(fd));
|
|
|
31075cf |
+ return PyBool_FromLong(isatty(fd) || is_cygpty(fd));
|
|
|
31075cf |
}
|
|
|
31075cf |
|
|
|
31075cf |
#ifdef HAVE_PIPE
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Modules/readline.c Python-2.7.13/Modules/readline.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Modules/readline.c 2016-12-17 21:05:07.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Modules/readline.c 2017-08-19 16:15:38.831941800 +0200
|
|
|
31075cf |
@@ -6,6 +6,7 @@
|
|
|
31075cf |
|
|
|
31075cf |
/* Standard definitions */
|
|
|
31075cf |
#include "Python.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
#include <setjmp.h>
|
|
|
31075cf |
#include <signal.h>
|
|
|
31075cf |
#include <errno.h>
|
|
|
31075cf |
@@ -1204,6 +1205,11 @@
|
|
|
31075cf |
{
|
|
|
31075cf |
PyObject *m;
|
|
|
31075cf |
|
|
|
31075cf |
+ if (!is_cygpty(STDOUT_FILENO)) {
|
|
|
31075cf |
+ PyErr_SetString(PyExc_ImportError, "Not a cygwin terminal");
|
|
|
31075cf |
+ return;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+
|
|
|
31075cf |
#ifdef __APPLE__
|
|
|
31075cf |
if (strncmp(rl_library_version, libedit_version_tag, strlen(libedit_version_tag)) == 0) {
|
|
|
31075cf |
using_libedit_emulation = 1;
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Objects/fileobject.c Python-2.7.13/Objects/fileobject.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Objects/fileobject.c 2016-12-17 21:05:07.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Objects/fileobject.c 2017-08-19 16:13:45.925483900 +0200
|
|
|
31075cf |
@@ -3,6 +3,7 @@
|
|
|
31075cf |
#define PY_SSIZE_T_CLEAN
|
|
|
31075cf |
#include "Python.h"
|
|
|
31075cf |
#include "structmember.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
|
|
|
31075cf |
#ifdef HAVE_SYS_TYPES_H
|
|
|
31075cf |
#include <sys/types.h>
|
|
|
31075cf |
@@ -986,7 +987,7 @@
|
|
|
31075cf |
if (f->f_fp == NULL)
|
|
|
31075cf |
return err_closed();
|
|
|
31075cf |
FILE_BEGIN_ALLOW_THREADS(f)
|
|
|
31075cf |
- res = isatty((int)fileno(f->f_fp));
|
|
|
31075cf |
+ res = isatty((int)fileno(f->f_fp)) || is_cygpty((int)fileno(f->f_fp));
|
|
|
31075cf |
FILE_END_ALLOW_THREADS(f)
|
|
|
31075cf |
return PyBool_FromLong(res);
|
|
|
31075cf |
}
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Python/bltinmodule.c Python-2.7.13/Python/bltinmodule.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Python/bltinmodule.c 2016-12-17 21:05:07.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Python/bltinmodule.c 2017-08-19 16:02:12.832841300 +0200
|
|
|
31075cf |
@@ -2,6 +2,7 @@
|
|
|
31075cf |
|
|
|
31075cf |
#include "Python.h"
|
|
|
31075cf |
#include "Python-ast.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
|
|
|
31075cf |
#include "node.h"
|
|
|
31075cf |
#include "code.h"
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Python/frozenmain.c Python-2.7.13/Python/frozenmain.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Python/frozenmain.c 2016-12-17 21:05:07.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Python/frozenmain.c 2017-08-19 16:03:06.009882800 +0200
|
|
|
31075cf |
@@ -2,6 +2,7 @@
|
|
|
31075cf |
/* Python interpreter main program for frozen scripts */
|
|
|
31075cf |
|
|
|
31075cf |
#include "Python.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
|
|
|
31075cf |
#ifdef MS_WINDOWS
|
|
|
31075cf |
extern void PyWinFreeze_ExeInit(void);
|
|
|
31075cf |
@@ -58,7 +59,7 @@
|
|
|
31075cf |
else
|
|
|
31075cf |
sts = 0;
|
|
|
31075cf |
|
|
|
31075cf |
- if (inspect && isatty((int)fileno(stdin)))
|
|
|
31075cf |
+ if (inspect && (isatty((int)fileno(stdin)) || is_cygpty((int)fileno(stdin))))
|
|
|
31075cf |
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
|
|
|
31075cf |
|
|
|
31075cf |
#ifdef MS_WINDOWS
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Python/iscygpty.c Python-2.7.13/Python/iscygpty.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Python/iscygpty.c 1970-01-01 01:00:00.000000000 +0100
|
|
|
31075cf |
+++ Python-2.7.13/Python/iscygpty.c 2017-08-19 15:50:12.959666900 +0200
|
|
|
31075cf |
@@ -0,0 +1,185 @@
|
|
|
31075cf |
+/*
|
|
|
31075cf |
+ * iscygpty.c -- part of ptycheck
|
|
|
31075cf |
+ * https://github.com/k-takata/ptycheck
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * Copyright (c) 2015-2017 K.Takata
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * You can redistribute it and/or modify it under the terms of either
|
|
|
31075cf |
+ * the MIT license (as described below) or the Vim license.
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * Permission is hereby granted, free of charge, to any person obtaining
|
|
|
31075cf |
+ * a copy of this software and associated documentation files (the
|
|
|
31075cf |
+ * "Software"), to deal in the Software without restriction, including
|
|
|
31075cf |
+ * without limitation the rights to use, copy, modify, merge, publish,
|
|
|
31075cf |
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
31075cf |
+ * permit persons to whom the Software is furnished to do so, subject to
|
|
|
31075cf |
+ * the following conditions:
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * The above copyright notice and this permission notice shall be
|
|
|
31075cf |
+ * included in all copies or substantial portions of the Software.
|
|
|
31075cf |
+ *
|
|
|
31075cf |
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
31075cf |
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
31075cf |
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
31075cf |
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
31075cf |
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
31075cf |
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
31075cf |
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
31075cf |
+ */
|
|
|
31075cf |
+
|
|
|
31075cf |
+#ifdef _WIN32
|
|
|
31075cf |
+
|
|
|
31075cf |
+#include <ctype.h>
|
|
|
31075cf |
+#include <io.h>
|
|
|
31075cf |
+#include <wchar.h>
|
|
|
31075cf |
+#include <windows.h>
|
|
|
31075cf |
+
|
|
|
31075cf |
+#ifdef USE_FILEEXTD
|
|
|
31075cf |
+/* VC 7.1 or earlier doesn't support SAL. */
|
|
|
31075cf |
+# if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
|
|
31075cf |
+# define __out
|
|
|
31075cf |
+# define __in
|
|
|
31075cf |
+# define __in_opt
|
|
|
31075cf |
+# endif
|
|
|
31075cf |
+/* Win32 FileID API Library:
|
|
|
31075cf |
+ * http://www.microsoft.com/en-us/download/details.aspx?id=22599
|
|
|
31075cf |
+ * Needed for WinXP. */
|
|
|
31075cf |
+# include <fileextd.h>
|
|
|
31075cf |
+#else /* USE_FILEEXTD */
|
|
|
31075cf |
+/* VC 8 or earlier. */
|
|
|
31075cf |
+# if defined(_MSC_VER) && (_MSC_VER < 1500)
|
|
|
31075cf |
+# ifdef ENABLE_STUB_IMPL
|
|
|
31075cf |
+# define STUB_IMPL
|
|
|
31075cf |
+# else
|
|
|
31075cf |
+# error "Win32 FileID API Library is required for VC2005 or earlier."
|
|
|
31075cf |
+# endif
|
|
|
31075cf |
+# endif
|
|
|
31075cf |
+#endif /* USE_FILEEXTD */
|
|
|
31075cf |
+
|
|
|
31075cf |
+
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
+
|
|
|
31075cf |
+//#define USE_DYNFILEID
|
|
|
31075cf |
+#ifdef USE_DYNFILEID
|
|
|
31075cf |
+typedef BOOL (WINAPI *pfnGetFileInformationByHandleEx)(
|
|
|
31075cf |
+ HANDLE hFile,
|
|
|
31075cf |
+ FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
|
|
|
31075cf |
+ LPVOID lpFileInformation,
|
|
|
31075cf |
+ DWORD dwBufferSize
|
|
|
31075cf |
+);
|
|
|
31075cf |
+static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;
|
|
|
31075cf |
+
|
|
|
31075cf |
+# ifndef USE_FILEEXTD
|
|
|
31075cf |
+static BOOL WINAPI stub_GetFileInformationByHandleEx(
|
|
|
31075cf |
+ HANDLE hFile,
|
|
|
31075cf |
+ FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
|
|
|
31075cf |
+ LPVOID lpFileInformation,
|
|
|
31075cf |
+ DWORD dwBufferSize
|
|
|
31075cf |
+ )
|
|
|
31075cf |
+{
|
|
|
31075cf |
+ return FALSE;
|
|
|
31075cf |
+}
|
|
|
31075cf |
+# endif
|
|
|
31075cf |
+
|
|
|
31075cf |
+static void setup_fileid_api(void)
|
|
|
31075cf |
+{
|
|
|
31075cf |
+ if (pGetFileInformationByHandleEx != NULL) {
|
|
|
31075cf |
+ return;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ pGetFileInformationByHandleEx = (pfnGetFileInformationByHandleEx)
|
|
|
31075cf |
+ GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
|
|
31075cf |
+ "GetFileInformationByHandleEx");
|
|
|
31075cf |
+ if (pGetFileInformationByHandleEx == NULL) {
|
|
|
31075cf |
+# ifdef USE_FILEEXTD
|
|
|
31075cf |
+ pGetFileInformationByHandleEx = GetFileInformationByHandleEx;
|
|
|
31075cf |
+# else
|
|
|
31075cf |
+ pGetFileInformationByHandleEx = stub_GetFileInformationByHandleEx;
|
|
|
31075cf |
+# endif
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+}
|
|
|
31075cf |
+#else
|
|
|
31075cf |
+# define pGetFileInformationByHandleEx GetFileInformationByHandleEx
|
|
|
31075cf |
+# define setup_fileid_api()
|
|
|
31075cf |
+#endif
|
|
|
31075cf |
+
|
|
|
31075cf |
+
|
|
|
31075cf |
+#define is_wprefix(s, prefix) \
|
|
|
31075cf |
+ (wcsncmp((s), (prefix), sizeof(prefix) / sizeof(WCHAR) - 1) == 0)
|
|
|
31075cf |
+
|
|
|
31075cf |
+/* Check if the fd is a cygwin/msys's pty. */
|
|
|
31075cf |
+int is_cygpty(int fd)
|
|
|
31075cf |
+{
|
|
|
31075cf |
+#ifdef STUB_IMPL
|
|
|
31075cf |
+ return 0;
|
|
|
31075cf |
+#else
|
|
|
31075cf |
+ HANDLE h;
|
|
|
31075cf |
+ int size = sizeof(FILE_NAME_INFO) + sizeof(WCHAR) * MAX_PATH;
|
|
|
31075cf |
+ FILE_NAME_INFO *nameinfo;
|
|
|
31075cf |
+ WCHAR *p = NULL;
|
|
|
31075cf |
+
|
|
|
31075cf |
+ setup_fileid_api();
|
|
|
31075cf |
+
|
|
|
31075cf |
+ h = (HANDLE) _get_osfhandle(fd);
|
|
|
31075cf |
+ if (h == INVALID_HANDLE_VALUE) {
|
|
|
31075cf |
+ return 0;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ /* Cygwin/msys's pty is a pipe. */
|
|
|
31075cf |
+ if (GetFileType(h) != FILE_TYPE_PIPE) {
|
|
|
31075cf |
+ return 0;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ nameinfo = malloc(size);
|
|
|
31075cf |
+ if (nameinfo == NULL) {
|
|
|
31075cf |
+ return 0;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ /* Check the name of the pipe:
|
|
|
31075cf |
+ * '\{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master' */
|
|
|
31075cf |
+ if (pGetFileInformationByHandleEx(h, FileNameInfo, nameinfo, size)) {
|
|
|
31075cf |
+ nameinfo->FileName[nameinfo->FileNameLength / sizeof(WCHAR)] = L'\0';
|
|
|
31075cf |
+ p = nameinfo->FileName;
|
|
|
31075cf |
+ if (is_wprefix(p, L"\\cygwin-")) { /* Cygwin */
|
|
|
31075cf |
+ p += 8;
|
|
|
31075cf |
+ } else if (is_wprefix(p, L"\\msys-")) { /* MSYS and MSYS2 */
|
|
|
31075cf |
+ p += 6;
|
|
|
31075cf |
+ } else {
|
|
|
31075cf |
+ p = NULL;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ if (p != NULL) {
|
|
|
31075cf |
+ while (*p && isxdigit(*p)) /* Skip 16-digit hexadecimal. */
|
|
|
31075cf |
+ ++p;
|
|
|
31075cf |
+ if (is_wprefix(p, L"-pty")) {
|
|
|
31075cf |
+ p += 4;
|
|
|
31075cf |
+ } else {
|
|
|
31075cf |
+ p = NULL;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ if (p != NULL) {
|
|
|
31075cf |
+ while (*p && isdigit(*p)) /* Skip pty number. */
|
|
|
31075cf |
+ ++p;
|
|
|
31075cf |
+ if (is_wprefix(p, L"-from-master")) {
|
|
|
31075cf |
+ //p += 12;
|
|
|
31075cf |
+ } else if (is_wprefix(p, L"-to-master")) {
|
|
|
31075cf |
+ //p += 10;
|
|
|
31075cf |
+ } else {
|
|
|
31075cf |
+ p = NULL;
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ free(nameinfo);
|
|
|
31075cf |
+ return (p != NULL);
|
|
|
31075cf |
+#endif /* STUB_IMPL */
|
|
|
31075cf |
+}
|
|
|
31075cf |
+
|
|
|
31075cf |
+/* Check if at least one cygwin/msys pty is used. */
|
|
|
31075cf |
+int is_cygpty_used(void)
|
|
|
31075cf |
+{
|
|
|
31075cf |
+ int fd, ret = 0;
|
|
|
31075cf |
+
|
|
|
31075cf |
+ for (fd = 0; fd < 3; fd++) {
|
|
|
31075cf |
+ ret |= is_cygpty(fd);
|
|
|
31075cf |
+ }
|
|
|
31075cf |
+ return ret;
|
|
|
31075cf |
+}
|
|
|
31075cf |
+
|
|
|
31075cf |
+#endif /* _WIN32 */
|
|
|
31075cf |
+
|
|
|
31075cf |
+/* vim: set ts=4 sw=4: */
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/Python/pythonrun.c Python-2.7.13/Python/pythonrun.c
|
|
|
31075cf |
--- Python-2.7.13.orig/Python/pythonrun.c 2017-08-19 14:39:02.294398800 +0200
|
|
|
31075cf |
+++ Python-2.7.13/Python/pythonrun.c 2017-08-19 15:54:43.491140400 +0200
|
|
|
31075cf |
@@ -18,6 +18,7 @@
|
|
|
31075cf |
#include "eval.h"
|
|
|
31075cf |
#include "marshal.h"
|
|
|
31075cf |
#include "abstract.h"
|
|
|
31075cf |
+#include "iscygpty.h"
|
|
|
31075cf |
|
|
|
31075cf |
#ifdef HAVE_SIGNAL_H
|
|
|
31075cf |
#include <signal.h>
|
|
|
31075cf |
@@ -1864,7 +1865,7 @@
|
|
|
31075cf |
int
|
|
|
31075cf |
Py_FdIsInteractive(FILE *fp, const char *filename)
|
|
|
31075cf |
{
|
|
|
31075cf |
- if (isatty((int)fileno(fp)))
|
|
|
31075cf |
+ if (isatty((int)fileno(fp)) || is_cygpty((int)fileno(fp)))
|
|
|
31075cf |
return 1;
|
|
|
31075cf |
if (!Py_InteractiveFlag)
|
|
|
31075cf |
return 0;
|
|
|
31075cf |
diff -Nur Python-2.7.13.orig/setup.py Python-2.7.13/setup.py
|
|
|
31075cf |
--- Python-2.7.13.orig/setup.py 2017-08-19 14:39:10.682878600 +0200
|
|
|
31075cf |
+++ Python-2.7.13/setup.py 2017-08-19 16:16:38.642362700 +0200
|
|
|
31075cf |
@@ -655,8 +655,10 @@
|
|
|
31075cf |
# Python 3.1 _io library
|
|
|
31075cf |
exts.append( Extension("_io",
|
|
|
31075cf |
["_io/bufferedio.c", "_io/bytesio.c", "_io/fileio.c",
|
|
|
31075cf |
- "_io/iobase.c", "_io/_iomodule.c", "_io/stringio.c", "_io/textio.c"],
|
|
|
31075cf |
- depends=["_io/_iomodule.h"], include_dirs=["Modules/_io"]))
|
|
|
31075cf |
+ "_io/iobase.c", "_io/_iomodule.c", "_io/stringio.c", "_io/textio.c",
|
|
|
31075cf |
+ "../Python/iscygpty.c"],
|
|
|
31075cf |
+ depends=["_io/_iomodule.h"], include_dirs=["Modules/_io"],
|
|
|
31075cf |
+ extra_compile_args=["-D_WIN32_WINNT=0x0600"]))
|
|
|
31075cf |
# _functools
|
|
|
31075cf |
# On win32 host(mingw build in MSYS environment) show that site.py
|
|
|
31075cf |
# fail to load if some modules are not build-in:
|
|
|
31075cf |
@@ -841,10 +843,11 @@
|
|
|
31075cf |
[sr + '/lib/termcap' for sr in with_build_sysroots],
|
|
|
31075cf |
'termcap'):
|
|
|
31075cf |
readline_libs.append('termcap')
|
|
|
31075cf |
- exts.append( Extension('readline', ['readline.c'],
|
|
|
31075cf |
+ exts.append( Extension('readline', ['readline.c', '../Python/iscygpty.c'],
|
|
|
31075cf |
library_dirs=[sr + '/lib/termcap' for sr in with_build_sysroots],
|
|
|
31075cf |
extra_link_args=readline_extra_link_args,
|
|
|
31075cf |
- libraries=readline_libs) )
|
|
|
31075cf |
+ libraries=readline_libs,
|
|
|
31075cf |
+ extra_compile_args=["-D_WIN32_WINNT=0x0600"]) )
|
|
|
31075cf |
else:
|
|
|
31075cf |
missing.append('readline')
|
|
|
31075cf |
|