7053223 python needs lint libraries
authorDanek Duvall <danek.duvall@oracle.com>
Fri, 04 Nov 2011 10:38:12 -0700
changeset 578 4f51372decaf
parent 577 c13e8d244261
child 579 085a881269b8
7053223 python needs lint libraries 7097702 python _close_fds from subprocess.py can call close 2 billion times 7103310 os.mknod() not available
components/python/python26/Makefile
components/python/python26/llib-lpython26
components/python/python26/patches/Python26-24-makedev.patch
components/python/python26/patches/Python26-25-closerange.patch
components/python/python26/python-26.p5m
components/python/python27/Makefile
components/python/python27/llib-lpython27
components/python/python27/patches/10-closerange.patch
components/python/python27/python-27.p5m
--- a/components/python/python26/Makefile	Wed Nov 09 12:33:59 2011 -0800
+++ b/components/python/python26/Makefile	Fri Nov 04 10:38:12 2011 -0700
@@ -34,6 +34,7 @@
 include $(WS_TOP)/make-rules/prep.mk
 include $(WS_TOP)/make-rules/configure.mk
 include $(WS_TOP)/make-rules/ips.mk
+include $(WS_TOP)/make-rules/lint-libraries.mk
 
 # We patch auto* files, so regenerate headers and configure
 COMPONENT_PREP_ACTION = \
@@ -62,6 +63,9 @@
 # libffi for _ctypes
 CPPFLAGS +=	$(shell pkg-config --cflags-only-I libffi)
 
+# Python puts its header files in a special place.
+LINT_FLAGS +=	-I$(SOURCE_DIR)/Include
+
 CONFIGURE_OPTIONS  +=		--infodir=$(CONFIGURE_INFODIR)
 CONFIGURE_OPTIONS  +=		--enable-shared
 CONFIGURE_OPTIONS  +=		--disable-static
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python26/llib-lpython26	Fri Nov 04 10:38:12 2011 -0700
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+#include <Python.h>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python26/patches/Python26-24-makedev.patch	Fri Nov 04 10:38:12 2011 -0700
@@ -0,0 +1,35 @@
+--- Python-2.6.4/configure.in	Thu Oct  6 14:37:11 2011
++++ Python-2.6.4/configure.in	Thu Oct 20 14:46:16 2011
[email protected]@ -1362,29 +1362,9 @@
+ ])
+ AC_MSG_RESULT($was_it_defined)
+ 
+-# Check whether using makedev requires defining _OSF_SOURCE
+-AC_MSG_CHECKING(for makedev)
+-AC_TRY_LINK([#include <sys/types.h> ],
+-	    [ makedev(0, 0) ],
+-	    ac_cv_has_makedev=yes,
+-	    ac_cv_has_makedev=no)
+-if test "$ac_cv_has_makedev" = "no"; then
+-    # we didn't link, try if _OSF_SOURCE will allow us to link
+-    AC_TRY_LINK([
+-#define _OSF_SOURCE 1
+-#include <sys/types.h>
+-    ],
+-    [ makedev(0, 0) ],
+-    ac_cv_has_makedev=yes,
+-    ac_cv_has_makedev=no)
+-    if test "$ac_cv_has_makedev" = "yes"; then
+-        AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
+-    fi
+-fi
+-AC_MSG_RESULT($ac_cv_has_makedev)
+-if test "$ac_cv_has_makedev" = "yes"; then
+-    AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
+-fi
++# Solaris has makedev, and posixmodule already has all the right #include
++# statements.
++AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
+ 
+ # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
+ # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python26/patches/Python26-25-closerange.patch	Fri Nov 04 10:38:12 2011 -0700
@@ -0,0 +1,39 @@
+--- Python-2.6.4/Modules/posixmodule.c	Wed Sep 16 13:06:36 2009
++++ Python-2.6.4/Modules/posixmodule.c	Thu Nov  3 17:39:15 2011
[email protected]@ -6295,15 +6297,34 @@
+ "closerange(fd_low, fd_high)\n\n\
+ Closes all file descriptors in [fd_low, fd_high), ignoring errors.");
+ 
++static int
++close_func(void *lohi, int fd)
++{
++	int lo = ((int *)lohi)[0];
++	int hi = ((int *)lohi)[1];
++
++	if (fd >= hi)
++		return (1);
++	else if (fd >= lo)
++		close(fd);
++
++	return (0);
++}
++
+ static PyObject *
+ posix_closerange(PyObject *self, PyObject *args)
+ {
+ 	int fd_from, fd_to, i;
++	int lohi[2];
++
+ 	if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to))
+ 		return NULL;
+ 	Py_BEGIN_ALLOW_THREADS
+-	for (i = fd_from; i < fd_to; i++)
+-		close(i);
++
++	lohi[0] = fd_from;
++	lohi[1] = fd_to;
++	fdwalk(close_func, lohi);
++
+ 	Py_END_ALLOW_THREADS
+ 	Py_RETURN_NONE;
+ }
--- a/components/python/python26/python-26.p5m	Wed Nov 09 12:33:59 2011 -0800
+++ b/components/python/python26/python-26.p5m	Fri Nov 04 10:38:12 2011 -0700
@@ -178,8 +178,11 @@
 file path=usr/include/python2.6/weakrefobject.h
 file path=usr/lib/$(MACH64)/libpython2.6.so.1.0
 file path=usr/lib/$(MACH64)/libpython2.6_db.so.1.0
+file $(MACH64)/llib-lpython26.ln path=usr/lib/$(MACH64)/llib-lpython2.6.ln
 file path=usr/lib/libpython2.6.so.1.0
 file path=usr/lib/libpython2.6_db.so.1.0
+file llib-lpython26 path=usr/lib/llib-lpython2.6
+file $(MACH32)/llib-lpython26.ln path=usr/lib/llib-lpython2.6.ln
 file path=usr/lib/python2.6/BaseHTTPServer.py
 file path=usr/lib/python2.6/Bastion.py
 file path=usr/lib/python2.6/CGIHTTPServer.py
--- a/components/python/python27/Makefile	Wed Nov 09 12:33:59 2011 -0800
+++ b/components/python/python27/Makefile	Fri Nov 04 10:38:12 2011 -0700
@@ -35,6 +35,7 @@
 include $(WS_TOP)/make-rules/prep.mk
 include $(WS_TOP)/make-rules/configure.mk
 include $(WS_TOP)/make-rules/ips.mk
+include $(WS_TOP)/make-rules/lint-libraries.mk
 
 # We patch auto* files, so regenerate headers and configure
 COMPONENT_PREP_ACTION = \
@@ -57,6 +58,9 @@
 LDFLAGS.64 = -R/usr/gnu/lib/$(MACH64) -L/usr/gnu/lib/$(MACH64)
 LDFLAGS += $(LDFLAGS.$(BITS))
 
+# Python puts its header files in a special place.
+LINT_FLAGS +=	-I$(SOURCE_DIR)/Include
+
 CONFIGURE_OPTIONS  +=		--infodir=$(CONFIGURE_INFODIR)
 CONFIGURE_OPTIONS  +=		--enable-shared
 CONFIGURE_OPTIONS  +=		--with-system-expat
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python27/llib-lpython27	Fri Nov 04 10:38:12 2011 -0700
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/* LINTLIBRARY */
+/* PROTOLIB1 */
+
+#include <Python.h>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/python/python27/patches/10-closerange.patch	Fri Nov 04 10:38:12 2011 -0700
@@ -0,0 +1,40 @@
+--- Python-2.7.1/Modules/posixmodule.c	Fri Nov 26 09:35:50 2010
++++ Python-2.7.1/Modules/posixmodule.c	Fri Nov  4 09:41:24 2011
[email protected]@ -6442,16 +6442,34 @@
+ "closerange(fd_low, fd_high)\n\n\
+ Closes all file descriptors in [fd_low, fd_high), ignoring errors.");
+ 
++static int
++close_func(void *lohi, int fd)
++{
++    int lo = ((int *)lohi)[0];
++    int hi = ((int *)lohi)[1];
++
++    if (fd >= hi)
++        return (1);
++    else if (fd >= lo)
++        close(fd);
++
++    return (0);
++}
++
+ static PyObject *
+ posix_closerange(PyObject *self, PyObject *args)
+ {
+     int fd_from, fd_to, i;
++    int lohi[2];
++
+     if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to))
+         return NULL;
+     Py_BEGIN_ALLOW_THREADS
+-    for (i = fd_from; i < fd_to; i++)
+-        if (_PyVerify_fd(i))
+-            close(i);
++
++    lohi[0] = fd_from;
++    lohi[1] = fd_to;
++    fdwalk(close_func, lohi);
++
+     Py_END_ALLOW_THREADS
+     Py_RETURN_NONE;
+ }
--- a/components/python/python27/python-27.p5m	Wed Nov 09 12:33:59 2011 -0800
+++ b/components/python/python27/python-27.p5m	Fri Nov 04 10:38:12 2011 -0700
@@ -210,6 +210,7 @@
 file path=usr/include/python2.7/warnings.h
 file path=usr/include/python2.7/weakrefobject.h
 file path=usr/lib/$(MACH64)/libpython2.7.so.1.0
+file $(MACH64)/llib-lpython27.ln path=usr/lib/$(MACH64)/llib-lpython2.7.ln
 file path=usr/lib/$(MACH64)/pkgconfig/python-2.7.pc
 #file path=usr/lib/$(MACH64)/python2.7/config/Makefile
 #file path=usr/lib/$(MACH64)/python2.7/config/Setup
@@ -221,6 +222,8 @@
 #file path=usr/lib/$(MACH64)/python2.7/config/makesetup mode=0555
 #file path=usr/lib/$(MACH64)/python2.7/config/python.o
 file path=usr/lib/libpython2.7.so.1.0
+file llib-lpython27 path=usr/lib/llib-lpython2.7
+file $(MACH32)/llib-lpython27.ln path=usr/lib/llib-lpython2.7.ln
 file path=usr/lib/pkgconfig/python-2.7.pc
 file path=usr/lib/python2.7/BaseHTTPServer.py
 file path=usr/lib/python2.7/Bastion.py