summaryrefslogtreecommitdiff
path: root/math/sage
diff options
context:
space:
mode:
authorStephen Montgomery-Smith <stephen@FreeBSD.org>2014-12-07 16:01:20 +0000
committerStephen Montgomery-Smith <stephen@FreeBSD.org>2014-12-07 16:01:20 +0000
commit8a80f53a2ff0751119d364de0c958048f95ee216 (patch)
treee0423bc7d61ea796bac2a50fa8ec6d4bf4c61e8d /math/sage
parentUpdate to version 0.4 (diff)
- Update to 6.4.
Notes
Notes: svn path=/head/; revision=374215
Diffstat (limited to 'math/sage')
-rw-r--r--math/sage/Makefile58
-rw-r--r--math/sage/distinfo4
-rw-r--r--math/sage/files/patch-build_pkgs_cephes_spkg-install16
-rw-r--r--math/sage/files/patch-build_pkgs_gd_spkg-install12
-rw-r--r--math/sage/files/patch-build_pkgs_iml_spkg-install20
-rw-r--r--math/sage/files/patch-build_pkgs_libm4ri_spkg-install10
-rw-r--r--math/sage/files/patch-build_pkgs_m4rie_spkg-install12
-rw-r--r--math/sage/files/patch-build_pkgs_maxima_spkg-install11
-rw-r--r--math/sage/files/patch-build_pkgs_python818
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_CVE-2014-191253
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc-library-fcntl.rst19
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib__distutils__unixccompiler.py4
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib_distutils_command_build_scripts.py20
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Makefile.pre.in71
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-_ctypes-libffi-configure4
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c18
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c4
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue2037458
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue2116677
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_pr19236561
-rw-r--r--math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py60
-rw-r--r--math/sage/files/patch-build_pkgs_readline_fbsd-patch-src_support_shlib-install14
-rw-r--r--math/sage/files/patch-build_pkgs_readline_patches_shobj-conf.patch11
-rw-r--r--math/sage/files/patch-build_pkgs_zlib_spkg-install12
24 files changed, 300 insertions, 1147 deletions
diff --git a/math/sage/Makefile b/math/sage/Makefile
index a50624d21bb5..ead2fd8afe22 100644
--- a/math/sage/Makefile
+++ b/math/sage/Makefile
@@ -2,16 +2,13 @@
# $FreeBSD$
PORTNAME= sage
-PORTVERSION= 6.2
-PORTREVISION= 4
+PORTVERSION= 6.4
CATEGORIES= math
MASTER_SITES= http://boxen.math.washington.edu/home/sagemath/sage-mirror/src/ \
http://mirrors.xmission.com/sage/src/ \
http://www-ftp.lip6.fr/pub/math/sagemath/src/ \
http://www.sagemath.org/src-old/
PKGNAMESUFFIX= -math
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX} ${PYTHON_SOURCE}
-EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER= stephen@FreeBSD.org
COMMENT= Open source Mathematics software
@@ -29,16 +26,6 @@ LIB_DEPENDS= libatlas.so:${PORTSDIR}/math/atlas \
libjpeg.so:${PORTSDIR}/graphics/jpeg
RUN_DEPENDS= bash:${PORTSDIR}/shells/bash
-PYTHON_SOURCE= python/Python-2.7.6.tar.xz
-
-# 387 option: this only makes a difference for the amd64 architecture. Causes
-# the internal floating point calculations to be performed with extended
-# precision.
-OPTIONS_DEFINE_amd64= 387
-387_DESC= Use 387 instead of SSE FPU
-
-.include <bsd.port.options.mk>
-
pre-extract:
@${ECHO_MSG}
@${ECHO_MSG} Instead of installing the port, which will take a considerable amount of
@@ -48,24 +35,15 @@ pre-extract:
@sleep 10
PLIST_FILES= bin/sage
-USE_GCC= yes
USE_TEX= latex:build
-USES= fortran gmake iconv tk
+USES= gmake iconv tk
MAKE_JOBS_SAFE= yes
-LDFLAGS:= -Wl,-rpath=${WRKSRC}/local/lib ${LDFLAGS}
-FFLAGS+= -Wl,-rpath=${WRKSRC}/local/lib ${FPM_FLAG}
-CFLAGS+= -Wl,-rpath=${WRKSRC}/local/lib ${FPM_FLAG}
-CXXFLAGS+= -Wl,-rpath=${WRKSRC}/local/lib ${FPM_FLAG}
-# Note that the above addition to LDFLAGS, as a side effect, provides a
-# work-around for the make(1) idiosyncracy mentioned in PR 164361 (which
-# otherwise breaks the build of the maxima sub-package).
# Optimization flags will be defined by the source
CFLAGS:= ${CFLAGS:C/^-O.*$//}
FFLAGS:= ${CFLAGS:C/^-O.*$//}
MAKE_ENV+= SAGE_PORT=yes \
- SAGE_INSTALL_GCC=no \
SAGE_ATLAS_LIB=${LOCALBASE}/lib \
DOT_SAGE=${WRKSRC}/tmp/.sage \
SAGE_FAT_BINARY=yes
@@ -76,27 +54,11 @@ LATEST_LINK= sage-math # Conflicts with graphics/sage.
MAKE_ARGS+= ARCH="${AR}"
post-patch:
- ${CP} ${DISTDIR}/${PYTHON_SOURCE} ${WRKSRC}/upstream/.
-
${REINPLACE_CMD} 's/$$MAKE $$gettext/$$MAKE PTHREAD_LIBS=${PTHREAD_LIBS} $$gettext/' ${WRKSRC}/build/pkgs/git/spkg-install
-# Create the wrappers for the compiler invocations.
+# Create wrapper for invocation of make.
@${MKDIR} ${WRKSRC}/local/bin
@${LN} -s -f ${LOCALBASE}/bin/gmake ${WRKSRC}/local/bin/make
- @${SED} -e "s#%%CC%%#`which ${CC}`#" \
- -e 's#%%LDFLAGS%%#${LDFLAGS} ${FPM_FLAG}#' \
- ${FILESDIR}/gcc.in > ${WRKSRC}/local/bin/cc
- @${CHMOD} +x ${WRKSRC}/local/bin/cc
- @${LN} -s -f cc ${WRKSRC}/local/bin/gcc
- @${SED} -e "s#%%CC%%#`which ${CXX}`#" \
- -e 's#%%LDFLAGS%%#${LDFLAGS} ${FPM_FLAG}#' \
- ${FILESDIR}/gcc.in > ${WRKSRC}/local/bin/c++
- @${CHMOD} +x ${WRKSRC}/local/bin/c++
- @${LN} -s -f c++ ${WRKSRC}/local/bin/g++
- @${SED} -e "s#%%CC%%#`which ${FC}`#" \
- -e 's#%%LDFLAGS%%#${LDFLAGS} ${FPM_FLAG}#' \
- ${FILESDIR}/gcc.in > ${WRKSRC}/local/bin/gfortran
- @${CHMOD} +x ${WRKSRC}/local/bin/gfortran
post-build:
${RM} -rf ${WRKSRC}/tmp/.sage
@@ -135,12 +97,6 @@ post-install:
BROKEN= POSIX semaphores are required, and the support only works in FreeBSD 7-STABLE and later
.endif
-.if ${PORT_OPTIONS:M387}
-FPM_FLAG= -mfpmath=387
-.else
-FPM_FLAG=
-.endif
-
MAKE_ENV+= MAKE="${MAKE} -j${MAKE_JOBS_NUMBER}"
.ifdef MAINTAINER_MODE
@@ -152,9 +108,13 @@ test-fbsd-patches: patch
b=$${d##*/}-`${CAT} $$d/package-version.txt | ${SED} 's/\.p.*//'`; \
c=${WRKSRC}/upstream/$$b.tar.bz2 ; \
if [ ! -e $$c ]; then \
- ${ECHO_MSG} Couldn\'t find $$c; \
- exit 1; \
+ c=${WRKSRC}/upstream/$$b.tar.gz ; \
+ if [ ! -e $$c ]; then \
+ ${ECHO_MSG} Couldn\'t find $$c; \
+ exit 1; \
+ fi; \
fi; \
+ b=`echo $$b | sed 's/python/Python/'` ; \
if ! (cd $$d && tar xf $$c && ${MV} $$b src); then \
${ECHO_MSG} Unable to unarchive $$c; \
exit 1; \
diff --git a/math/sage/distinfo b/math/sage/distinfo
index 6f98eac87d00..310c231b5734 100644
--- a/math/sage/distinfo
+++ b/math/sage/distinfo
@@ -1,4 +1,4 @@
-SHA256 (sage-6.2.tar.gz) = ca9759fd1d38f51f5187907782c73682cba7dec04d1f6aba6e502084ab4035bb
-SIZE (sage-6.2.tar.gz) = 424950536
+SHA256 (sage-6.4.tar.gz) = d37143a1eb9af6c6b46d95e421bbe077c608f5ae96d68697aba5f1a05b344449
+SIZE (sage-6.4.tar.gz) = 578695789
SHA256 (python/Python-2.7.6.tar.xz) = 1fd68e81f8bf7386ff239b7faee9ba387129d2cf34eab13350bd8503a0bff6a1
SIZE (python/Python-2.7.6.tar.xz) = 10431288
diff --git a/math/sage/files/patch-build_pkgs_cephes_spkg-install b/math/sage/files/patch-build_pkgs_cephes_spkg-install
index f819a1d92690..298c3b25bc76 100644
--- a/math/sage/files/patch-build_pkgs_cephes_spkg-install
+++ b/math/sage/files/patch-build_pkgs_cephes_spkg-install
@@ -1,6 +1,16 @@
---- build/pkgs/cephes/spkg-install-orig 2013-03-30 20:48:35.000000000 +0000
-+++ build/pkgs/cephes/spkg-install 2013-03-30 20:48:57.000000000 +0000
-@@ -24,6 +24,8 @@
+--- build/pkgs/cephes/spkg-install.orig 2014-11-14 12:09:55.000000000 +0000
++++ build/pkgs/cephes/spkg-install 2014-12-06 23:43:50.000000000 +0000
+@@ -11,6 +11,9 @@
+ exit 0
+ fi
+
++# Not working properly with FreeBSD right now.
++exit 0
++
+ CUR=`pwd`
+ cd src
+
+@@ -24,6 +27,8 @@
fi
done
diff --git a/math/sage/files/patch-build_pkgs_gd_spkg-install b/math/sage/files/patch-build_pkgs_gd_spkg-install
new file mode 100644
index 000000000000..56b4ba74802f
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_gd_spkg-install
@@ -0,0 +1,12 @@
+--- build/pkgs/gd/spkg-install-orig 2014-12-06 21:44:37.000000000 +0000
++++ build/pkgs/gd/spkg-install 2014-12-06 21:47:08.000000000 +0000
+@@ -24,7 +24,8 @@
+
+ # Needed to correctly pickup libiconv on FreeBSD
+ if [ `uname` = "FreeBSD" ] ; then
+- LDFLAGS="-L/usr/local/lib"; export LDFLAGS
++ LDFLAGS="-L${LOCALBASE}/lib"; export LDFLAGS
++ CFLAGS="-I${LOCALBASE}/include"; export CFLAGS
+ fi
+
+ # needed to pick up zlib.h
diff --git a/math/sage/files/patch-build_pkgs_iml_spkg-install b/math/sage/files/patch-build_pkgs_iml_spkg-install
new file mode 100644
index 000000000000..13ddcc66e1d3
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_iml_spkg-install
@@ -0,0 +1,20 @@
+--- build/pkgs/iml/spkg-install-orig 2014-12-06 21:45:54.000000000 +0000
++++ build/pkgs/iml/spkg-install 2014-12-06 21:50:08.000000000 +0000
+@@ -18,6 +18,7 @@
+ fi
+ done
+
++export CFLAGS="-I${LOCALBASE}/include $CFLAGS"
+
+ if [ "$SAGE_DEBUG" = "yes" ]; then
+ echo "Building a debug version of IML."
+@@ -38,6 +39,9 @@
+ EXTRA_BLAS="--with-cblas=-lcblas"
+ fi
+
++aclocal
++automake --add-missing
++autoconf
+ ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" \
+ --enable-shared --with-default="$SAGE_LOCAL" "$EXTRA_BLAS"
+ if [ $? -ne 0 ]; then
diff --git a/math/sage/files/patch-build_pkgs_libm4ri_spkg-install b/math/sage/files/patch-build_pkgs_libm4ri_spkg-install
deleted file mode 100644
index ebd4cb6f6e53..000000000000
--- a/math/sage/files/patch-build_pkgs_libm4ri_spkg-install
+++ /dev/null
@@ -1,10 +0,0 @@
---- build/pkgs/libm4ri/spkg-install-orig 2014-05-16 18:34:53.000000000 +0000
-+++ build/pkgs/libm4ri/spkg-install 2014-05-16 18:48:25.000000000 +0000
-@@ -54,6 +54,7 @@
-
- cd $ROOT_DIR/src/
-
-+env PKG_CONFIG_LIBDIR=$SAGE_LOCAL/lib/pkgconfig \
- ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $ENABLE_DEBUG $DISABLE_SSE2
-
- if [ $? -ne 0 ]; then
diff --git a/math/sage/files/patch-build_pkgs_m4rie_spkg-install b/math/sage/files/patch-build_pkgs_m4rie_spkg-install
new file mode 100644
index 000000000000..e87383ed340c
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_m4rie_spkg-install
@@ -0,0 +1,12 @@
+--- build/pkgs/m4rie/spkg-install-orig 2014-12-06 21:51:23.000000000 +0000
++++ build/pkgs/m4rie/spkg-install 2014-12-06 21:51:46.000000000 +0000
+@@ -51,6 +51,9 @@
+ # build M4RIE
+
+ cd $ROOT_DIR/src/
++aclocal
++automake --add-missing
++autoconf
+ ./configure \
+ --prefix="$SAGE_LOCAL" \
+ --libdir="$SAGE_LOCAL/lib" \
diff --git a/math/sage/files/patch-build_pkgs_maxima_spkg-install b/math/sage/files/patch-build_pkgs_maxima_spkg-install
new file mode 100644
index 000000000000..c4803985d262
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_maxima_spkg-install
@@ -0,0 +1,11 @@
+--- build/pkgs/maxima/spkg-install-orig 2014-12-06 21:53:38.000000000 +0000
++++ build/pkgs/maxima/spkg-install 2014-12-06 21:54:40.000000000 +0000
+@@ -51,6 +51,8 @@
+ ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-ecl git_found=false
+ check_error "Failed to configure Maxima."
+
++# Remove extraneous spaces created in some of the flags passed to cc
++sed -i.bak 's/" /"/' src/autoconf-variables.lisp
+
+ # Touching html and info files to avoid to regenerate them.
+ # This must be done after configuration since the timestamps need
diff --git a/math/sage/files/patch-build_pkgs_python b/math/sage/files/patch-build_pkgs_python
deleted file mode 100644
index ad75ed4e7915..000000000000
--- a/math/sage/files/patch-build_pkgs_python
+++ /dev/null
@@ -1,818 +0,0 @@
-diff -urN build/pkgs/python/checksums.ini build/pkgs/python/checksums.ini
---- build/pkgs/python/checksums.ini 2014-05-30 23:04:24.000000000 +0000
-+++ build/pkgs/python/checksums.ini 2014-05-30 22:51:28.000000000 +0000
-@@ -1,4 +1,4 @@
--tarball=python-VERSION.tar.bz2
--sha1=6b901ace46a66ea4ea01380cb7dd00d9ac9c5deb
--md5=30b74f145e3d94923f79fd10a0f64490
--cksum=3699497017
-+tarball=Python-VERSION.tar.xz
-+sha1=8321636af2acbeaa68fc635d7dda7369ed446a80
-+md5=bcf93efa8eaf383c98ed3ce40b763497
-+cksum=3044260985
-diff -urN build/pkgs/python/package-version.txt build/pkgs/python/package-version.txt
---- build/pkgs/python/package-version.txt 2014-05-30 23:04:24.000000000 +0000
-+++ build/pkgs/python/package-version.txt 2014-05-30 22:51:43.000000000 +0000
-@@ -1 +1 @@
--2.7.5.p2
-+2.7.6.p0
-diff -urN build/pkgs/python/patches/inc_lib_dirs-issue_17990.patch build/pkgs/python/patches/inc_lib_dirs-issue_17990.patch
---- build/pkgs/python/patches/inc_lib_dirs-issue_17990.patch 2014-05-30 23:04:24.000000000 +0000
-+++ build/pkgs/python/patches/inc_lib_dirs-issue_17990.patch 1970-01-01 00:00:00.000000000 +0000
-@@ -1,18 +0,0 @@
--diff --git a/setup.py b/setup.py
----- a/setup.py
--+++ b/setup.py
--@@ -437,9 +437,11 @@
--
-- def detect_modules(self):
-- # Ensure that /usr/local is always used
--- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
--- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
--- self.add_gcc_paths()
--+ if not cross_compiling:
--+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
--+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
--+ if cross_compiling:
--+ self.add_gcc_paths()
-- self.add_multiarch_paths()
--
-- # Add paths specified in the environment variables LDFLAGS and
-diff -urN build/pkgs/python/patches/re_unsigned_ptrdiff-issue_17016.patch build/pkgs/python/patches/re_unsigned_ptrdiff-issue_17016.patch
---- build/pkgs/python/patches/re_unsigned_ptrdiff-issue_17016.patch 2014-05-30 23:04:24.000000000 +0000
-+++ build/pkgs/python/patches/re_unsigned_ptrdiff-issue_17016.patch 1970-01-01 00:00:00.000000000 +0000
-@@ -1,21 +0,0 @@
--diff -r d91da96a55bf Modules/_sre.c
----- src/Modules/_sre.c Thu May 16 22:47:47 2013 +0100
--+++ src/Modules/_sre.c Fri May 17 21:02:48 2013 +0300
--@@ -1028,7 +1028,7 @@
-- TRACE(("|%p|%p|REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
-- ctx->pattern[1], ctx->pattern[2]));
--
--- if (ctx->pattern[1] > end - ctx->ptr)
--+ if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr)
-- RETURN_FAILURE; /* cannot match */
--
-- state->ptr = ctx->ptr;
--@@ -1111,7 +1111,7 @@
-- TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
-- ctx->pattern[1], ctx->pattern[2]));
--
--- if (ctx->pattern[1] > end - ctx->ptr)
--+ if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr)
-- RETURN_FAILURE; /* cannot match */
--
-- state->ptr = ctx->ptr;
-diff -urN build/pkgs/python/patches/uuid.patch build/pkgs/python/patches/uuid.patch
---- build/pkgs/python/patches/uuid.patch 2014-05-30 23:04:24.000000000 +0000
-+++ build/pkgs/python/patches/uuid.patch 1970-01-01 00:00:00.000000000 +0000
-@@ -1,677 +0,0 @@
--diff -druN python-2.7.5.orig/Lib/test/test_uuid.py python-2.7.5/Lib/test/test_uuid.py
----- python-2.7.5.orig/Lib/test/test_uuid.py 2013-05-12 05:32:48.000000000 +0200
--+++ python-2.7.5/Lib/test/test_uuid.py 2014-04-10 10:35:52.009367700 +0200
--@@ -365,6 +365,7 @@
--
-- # Make sure the generated UUIDs are actually unique.
-- uuids = {}
--+
-- for u in [uuid.uuid1() for i in range(1000)]:
-- uuids[u] = 1
-- equal(len(uuids.keys()), 1000)
--diff -druN python-2.7.5.orig/Lib/test/test_uuid.py.orig python-2.7.5/Lib/test/test_uuid.py.orig
----- python-2.7.5.orig/Lib/test/test_uuid.py.orig 1970-01-01 01:00:00.000000000 +0100
--+++ python-2.7.5/Lib/test/test_uuid.py.orig 2013-05-12 05:32:48.000000000 +0200
--@@ -0,0 +1,482 @@
--+from unittest import TestCase
--+from test import test_support
--+import uuid
--+
--+def importable(name):
--+ try:
--+ __import__(name)
--+ return True
--+ except:
--+ return False
--+
--+class TestUUID(TestCase):
--+ last_node = None
--+ source2node = {}
--+
--+ def test_UUID(self):
--+ equal = self.assertEqual
--+ ascending = []
--+ for (string, curly, hex, bytes, bytes_le, fields, integer, urn,
--+ time, clock_seq, variant, version) in [
--+ ('00000000-0000-0000-0000-000000000000',
--+ '{00000000-0000-0000-0000-000000000000}',
--+ '00000000000000000000000000000000',
--+ '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
--+ '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
--+ (0, 0, 0, 0, 0, 0),
--+ 0,
--+ 'urn:uuid:00000000-0000-0000-0000-000000000000',
--+ 0, 0, uuid.RESERVED_NCS, None),
--+ ('00010203-0405-0607-0809-0a0b0c0d0e0f',
--+ '{00010203-0405-0607-0809-0a0b0c0d0e0f}',
--+ '000102030405060708090a0b0c0d0e0f',
--+ '\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f',
--+ '\x03\x02\x01\0\x05\x04\x07\x06\x08\t\n\x0b\x0c\x0d\x0e\x0f',
--+ (0x00010203L, 0x0405, 0x0607, 8, 9, 0x0a0b0c0d0e0fL),
--+ 0x000102030405060708090a0b0c0d0e0fL,
--+ 'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f',
--+ 0x607040500010203L, 0x809, uuid.RESERVED_NCS, None),
--+ ('02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
--+ '{02d9e6d5-9467-382e-8f9b-9300a64ac3cd}',
--+ '02d9e6d59467382e8f9b9300a64ac3cd',
--+ '\x02\xd9\xe6\xd5\x94\x67\x38\x2e\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd',
--+ '\xd5\xe6\xd9\x02\x67\x94\x2e\x38\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd',
--+ (0x02d9e6d5L, 0x9467, 0x382e, 0x8f, 0x9b, 0x9300a64ac3cdL),
--+ 0x02d9e6d59467382e8f9b9300a64ac3cdL,
--+ 'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
--+ 0x82e946702d9e6d5L, 0xf9b, uuid.RFC_4122, 3),
--+ ('12345678-1234-5678-1234-567812345678',
--+ '{12345678-1234-5678-1234-567812345678}',
--+ '12345678123456781234567812345678',
--+ '\x12\x34\x56\x78'*4,
--+ '\x78\x56\x34\x12\x34\x12\x78\x56\x12\x34\x56\x78\x12\x34\x56\x78',
--+ (0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678),
--+ 0x12345678123456781234567812345678,
--+ 'urn:uuid:12345678-1234-5678-1234-567812345678',
--+ 0x678123412345678L, 0x1234, uuid.RESERVED_NCS, None),
--+ ('6ba7b810-9dad-11d1-80b4-00c04fd430c8',
--+ '{6ba7b810-9dad-11d1-80b4-00c04fd430c8}',
--+ '6ba7b8109dad11d180b400c04fd430c8',
--+ '\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ '\x10\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ (0x6ba7b810L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
--+ 0x6ba7b8109dad11d180b400c04fd430c8L,
--+ 'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8',
--+ 0x1d19dad6ba7b810L, 0xb4, uuid.RFC_4122, 1),
--+ ('6ba7b811-9dad-11d1-80b4-00c04fd430c8',
--+ '{6ba7b811-9dad-11d1-80b4-00c04fd430c8}',
--+ '6ba7b8119dad11d180b400c04fd430c8',
--+ '\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ '\x11\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ (0x6ba7b811L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
--+ 0x6ba7b8119dad11d180b400c04fd430c8L,
--+ 'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8',
--+ 0x1d19dad6ba7b811L, 0xb4, uuid.RFC_4122, 1),
--+ ('6ba7b812-9dad-11d1-80b4-00c04fd430c8',
--+ '{6ba7b812-9dad-11d1-80b4-00c04fd430c8}',
--+ '6ba7b8129dad11d180b400c04fd430c8',
--+ '\x6b\xa7\xb8\x12\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ '\x12\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ (0x6ba7b812L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
--+ 0x6ba7b8129dad11d180b400c04fd430c8L,
--+ 'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8',
--+ 0x1d19dad6ba7b812L, 0xb4, uuid.RFC_4122, 1),
--+ ('6ba7b814-9dad-11d1-80b4-00c04fd430c8',
--+ '{6ba7b814-9dad-11d1-80b4-00c04fd430c8}',
--+ '6ba7b8149dad11d180b400c04fd430c8',
--+ '\x6b\xa7\xb8\x14\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ '\x14\xb8\xa7\x6b\xad\x9d\xd1\x11\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
--+ (0x6ba7b814L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
--+ 0x6ba7b8149dad11d180b400c04fd430c8L,
--+ 'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8',
--+ 0x1d19dad6ba7b814L, 0xb4, uuid.RFC_4122, 1),
--+ ('7d444840-9dc0-11d1-b245-5ffdce74fad2',
--+ '{7d444840-9dc0-11d1-b245-5ffdce74fad2}',
--+ '7d4448409dc011d1b2455ffdce74fad2',
--+ '\x7d\x44\x48\x40\x9d\xc0\x11\xd1\xb2\x45\x5f\xfd\xce\x74\xfa\xd2',
--+ '\x40\x48\x44\x7d\xc0\x9d\xd1\x11\xb2\x45\x5f\xfd\xce\x74\xfa\xd2',
--+ (0x7d444840L, 0x9dc0, 0x11d1, 0xb2, 0x45, 0x5ffdce74fad2L),
--+ 0x7d4448409dc011d1b2455ffdce74fad2L,
--+ 'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2',
--+ 0x1d19dc07d444840L, 0x3245, uuid.RFC_4122, 1),
--+ ('e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
--+ '{e902893a-9d22-3c7e-a7b8-d6e313b71d9f}',
--+ 'e902893a9d223c7ea7b8d6e313b71d9f',
--+ '\xe9\x02\x89\x3a\x9d\x22\x3c\x7e\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f',
--+ '\x3a\x89\x02\xe9\x22\x9d\x7e\x3c\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f',
--+ (0xe902893aL, 0x9d22, 0x3c7e, 0xa7, 0xb8, 0xd6e313b71d9fL),
--+ 0xe902893a9d223c7ea7b8d6e313b71d9fL,
--+ 'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
--+ 0xc7e9d22e902893aL, 0x27b8, uuid.RFC_4122, 3),
--+ ('eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
--+ '{eb424026-6f54-4ef8-a4d0-bb658a1fc6cf}',
--+ 'eb4240266f544ef8a4d0bb658a1fc6cf',
--+ '\xeb\x42\x40\x26\x6f\x54\x4e\xf8\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf',
--+ '\x26\x40\x42\xeb\x54\x6f\xf8\x4e\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf',
--+ (0xeb424026L, 0x6f54, 0x4ef8, 0xa4, 0xd0, 0xbb658a1fc6cfL),
--+ 0xeb4240266f544ef8a4d0bb658a1fc6cfL,
--+ 'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
--+ 0xef86f54eb424026L, 0x24d0, uuid.RFC_4122, 4),
--+ ('f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
--+ '{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}',
--+ 'f81d4fae7dec11d0a76500a0c91e6bf6',
--+ '\xf8\x1d\x4f\xae\x7d\xec\x11\xd0\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6',
--+ '\xae\x4f\x1d\xf8\xec\x7d\xd0\x11\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6',
--+ (0xf81d4faeL, 0x7dec, 0x11d0, 0xa7, 0x65, 0x00a0c91e6bf6L),
--+ 0xf81d4fae7dec11d0a76500a0c91e6bf6L,
--+ 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
--+ 0x1d07decf81d4faeL, 0x2765, uuid.RFC_4122, 1),
--+ ('fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
--+ '{fffefdfc-fffe-fffe-fffe-fffefdfcfbfa}',
--+ 'fffefdfcfffefffefffefffefdfcfbfa',
--+ '\xff\xfe\xfd\xfc\xff\xfe\xff\xfe\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa',
--+ '\xfc\xfd\xfe\xff\xfe\xff\xfe\xff\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa',
--+ (0xfffefdfcL, 0xfffe, 0xfffe, 0xff, 0xfe, 0xfffefdfcfbfaL),
--+ 0xfffefdfcfffefffefffefffefdfcfbfaL,
--+ 'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
--+ 0xffefffefffefdfcL, 0x3ffe, uuid.RESERVED_FUTURE, None),
--+ ('ffffffff-ffff-ffff-ffff-ffffffffffff',
--+ '{ffffffff-ffff-ffff-ffff-ffffffffffff}',
--+ 'ffffffffffffffffffffffffffffffff',
--+ '\xff'*16,
--+ '\xff'*16,
--+ (0xffffffffL, 0xffffL, 0xffffL, 0xff, 0xff, 0xffffffffffffL),
--+ 0xffffffffffffffffffffffffffffffffL,
--+ 'urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff',
--+ 0xfffffffffffffffL, 0x3fff, uuid.RESERVED_FUTURE, None),
--+ ]:
--+ equivalents = []
--+ # Construct each UUID in several different ways.
--+ for u in [uuid.UUID(string), uuid.UUID(curly), uuid.UUID(hex),
--+ uuid.UUID(bytes=bytes), uuid.UUID(bytes_le=bytes_le),
--+ uuid.UUID(fields=fields), uuid.UUID(int=integer),
--+ uuid.UUID(urn)]:
--+ # Test all conversions and properties of the UUID object.
--+ equal(str(u), string)
--+ equal(int(u), integer)
--+ equal(u.bytes, bytes)
--+ equal(u.bytes_le, bytes_le)
--+ equal(u.fields, fields)
--+ equal(u.time_low, fields[0])
--+ equal(u.time_mid, fields[1])
--+ equal(u.time_hi_version, fields[2])
--+ equal(u.clock_seq_hi_variant, fields[3])
--+ equal(u.clock_seq_low, fields[4])
--+ equal(u.node, fields[5])
--+ equal(u.hex, hex)
--+ equal(u.int, integer)
--+ equal(u.urn, urn)
--+ equal(u.time, time)
--+ equal(u.clock_seq, clock_seq)
--+ equal(u.variant, variant)
--+ equal(u.version, version)
--+ equivalents.append(u)
--+
--+ # Different construction methods should give the same UUID.
--+ for u in equivalents:
--+ for v in equivalents:
--+ equal(u, v)
--+ ascending.append(u)
--+
--+ # Test comparison of UUIDs.
--+ for i in range(len(ascending)):
--+ for j in range(len(ascending)):
--+ equal(cmp(i, j), cmp(ascending[i], ascending[j]))
--+
--+ # Test sorting of UUIDs (above list is in ascending order).
--+ resorted = ascending[:]
--+ resorted.reverse()
--+ resorted.sort()
--+ equal(ascending, resorted)
--+
--+ def test_exceptions(self):
--+ badvalue = lambda f: self.assertRaises(ValueError, f)
--+ badtype = lambda f: self.assertRaises(TypeError, f)
--+
--+ # Badly formed hex strings.
--+ badvalue(lambda: uuid.UUID(''))
--+ badvalue(lambda: uuid.UUID('abc'))
--+ badvalue(lambda: uuid.UUID('1234567812345678123456781234567'))
--+ badvalue(lambda: uuid.UUID('123456781234567812345678123456789'))
--+ badvalue(lambda: uuid.UUID('123456781234567812345678z2345678'))
--+
--+ # Badly formed bytes.
--+ badvalue(lambda: uuid.UUID(bytes='abc'))
--+ badvalue(lambda: uuid.UUID(bytes='\0'*15))
--+ badvalue(lambda: uuid.UUID(bytes='\0'*17))
--+
--+ # Badly formed bytes_le.
--+ badvalue(lambda: uuid.UUID(bytes_le='abc'))
--+ badvalue(lambda: uuid.UUID(bytes_le='\0'*15))
--+ badvalue(lambda: uuid.UUID(bytes_le='\0'*17))
--+
--+ # Badly formed fields.
--+ badvalue(lambda: uuid.UUID(fields=(1,)))
--+ badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5)))
--+ badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5, 6, 7)))
--+
--+ # Field values out of range.
--+ badvalue(lambda: uuid.UUID(fields=(-1, 0, 0, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0x100000000L, 0, 0, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, -1, 0, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0x10000L, 0, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, -1, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0x10000L, 0, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, -1, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0x100L, 0, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, -1, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0x100L, 0)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, -1)))
--+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000L)))
--+
--+ # Version number out of range.
--+ badvalue(lambda: uuid.UUID('00'*16, version=0))
--+ badvalue(lambda: uuid.UUID('00'*16, version=6))
--+
--+ # Integer value out of range.
--+ badvalue(lambda: uuid.UUID(int=-1))
--+ badvalue(lambda: uuid.UUID(int=1<<128L))
--+
--+ # Must supply exactly one of hex, bytes, fields, int.
--+ h, b, f, i = '00'*16, '\0'*16, (0, 0, 0, 0, 0, 0), 0
--+ uuid.UUID(h)
--+ uuid.UUID(hex=h)
--+ uuid.UUID(bytes=b)
--+ uuid.UUID(bytes_le=b)
--+ uuid.UUID(fields=f)
--+ uuid.UUID(int=i)
--+
--+ # Wrong number of arguments (positional).
--+ badtype(lambda: uuid.UUID())
--+ badtype(lambda: uuid.UUID(h, b))
--+ badtype(lambda: uuid.UUID(h, b, b))
--+ badtype(lambda: uuid.UUID(h, b, b, f))
--+ badtype(lambda: uuid.UUID(h, b, b, f, i))
--+
--+ # Duplicate arguments.
--+ for hh in [[], [('hex', h)]]:
--+ for bb in [[], [('bytes', b)]]:
--+ for bble in [[], [('bytes_le', b)]]:
--+ for ii in [[], [('int', i)]]:
--+ for ff in [[], [('fields', f)]]:
--+ args = dict(hh + bb + bble + ii + ff)
--+ if len(args) != 0:
--+ badtype(lambda: uuid.UUID(h, **args))
--+ if len(args) != 1:
--+ badtype(lambda: uuid.UUID(**args))
--+
--+ # Immutability.
--+ u = uuid.UUID(h)
--+ badtype(lambda: setattr(u, 'hex', h))
--+ badtype(lambda: setattr(u, 'bytes', b))
--+ badtype(lambda: setattr(u, 'bytes_le', b))
--+ badtype(lambda: setattr(u, 'fields', f))
--+ badtype(lambda: setattr(u, 'int', i))
--+ badtype(lambda: setattr(u, 'time_low', 0))
--+ badtype(lambda: setattr(u, 'time_mid', 0))
--+ badtype(lambda: setattr(u, 'time_hi_version', 0))
--+ badtype(lambda: setattr(u, 'time_hi_version', 0))
--+ badtype(lambda: setattr(u, 'clock_seq_hi_variant', 0))
--+ badtype(lambda: setattr(u, 'clock_seq_low', 0))
--+ badtype(lambda: setattr(u, 'node', 0))
--+
--+ def check_node(self, node, source):
--+ message = "%012x is not an RFC 4122 node ID" % node
--+ self.assertTrue(0 < node, message)
--+ self.assertTrue(node < (1L << 48), message)
--+
--+ TestUUID.source2node[source] = node
--+ if TestUUID.last_node:
--+ if TestUUID.last_node != node:
--+ msg = "different sources disagree on node:\n"
--+ for s, n in TestUUID.source2node.iteritems():
--+ msg += " from source %r, node was %012x\n" % (s, n)
--+ # There's actually no reason to expect the MAC addresses
--+ # to agree across various methods -- e.g., a box may have
--+ # multiple network interfaces, and different ways of getting
--+ # a MAC address may favor different HW.
--+ ##self.fail(msg)
--+ else:
--+ TestUUID.last_node = node
--+
--+ def test_ifconfig_getnode(self):
--+ import sys
--+ import os
--+ if os.name == 'posix':
--+ node = uuid._ifconfig_getnode()
--+ if node is not None:
--+ self.check_node(node, 'ifconfig')
--+
--+ def test_ipconfig_getnode(self):
--+ import os
--+ if os.name == 'nt':
--+ node = uuid._ipconfig_getnode()
--+ if node is not None:
--+ self.check_node(node, 'ipconfig')
--+
--+ def test_netbios_getnode(self):
--+ if importable('win32wnet') and importable('netbios'):
--+ self.check_node(uuid._netbios_getnode(), 'netbios')
--+
--+ def test_random_getnode(self):
--+ node = uuid._random_getnode()
--+ # Least significant bit of first octet must be set.
--+ self.assertTrue(node & 0x010000000000)
--+ self.assertTrue(node < (1L << 48))
--+
--+ def test_unixdll_getnode(self):
--+ import sys
--+ import os
--+ if importable('ctypes') and os.name == 'posix':
--+ try: # Issues 1481, 3581: _uuid_generate_time() might be None.
--+ self.check_node(uuid._unixdll_getnode(), 'unixdll')
--+ except TypeError:
--+ pass
--+
--+ def test_windll_getnode(self):
--+ import os
--+ if importable('ctypes') and os.name == 'nt':
--+ self.check_node(uuid._windll_getnode(), 'windll')
--+
--+ def test_getnode(self):
--+ import sys
--+ node1 = uuid.getnode()
--+ self.check_node(node1, "getnode1")
--+
--+ # Test it again to ensure consistency.
--+ node2 = uuid.getnode()
--+ self.check_node(node2, "getnode2")
--+
--+ self.assertEqual(node1, node2)
--+
--+ def test_uuid1(self):
--+ # uuid1 requires ctypes.
--+ try:
--+ import ctypes
--+ except ImportError:
--+ return
--+
--+ equal = self.assertEqual
--+
--+ # Make sure uuid1() generates UUIDs that are actually version 1.
--+ for u in [uuid.uuid1() for i in range(10)]:
--+ equal(u.variant, uuid.RFC_4122)
--+ equal(u.version, 1)
--+
--+ # Make sure the generated UUIDs are actually unique.
--+ uuids = {}
--+ for u in [uuid.uuid1() for i in range(1000)]:
--+ uuids[u] = 1
--+ equal(len(uuids.keys()), 1000)
--+
--+ # Make sure the supplied node ID appears in the UUID.
--+ u = uuid.uuid1(0)
--+ equal(u.node, 0)
--+ u = uuid.uuid1(0x123456789abc)
--+ equal(u.node, 0x123456789abc)
--+ u = uuid.uuid1(0xffffffffffff)
--+ equal(u.node, 0xffffffffffff)
--+
--+ # Make sure the supplied clock sequence appears in the UUID.
--+ u = uuid.uuid1(0x123456789abc, 0)
--+ equal(u.node, 0x123456789abc)
--+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) | u.clock_seq_low, 0)
--+ u = uuid.uuid1(0x123456789abc, 0x1234)
--+ equal(u.node, 0x123456789abc)
--+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) |
--+ u.clock_seq_low, 0x1234)
--+ u = uuid.uuid1(0x123456789abc, 0x3fff)
--+ equal(u.node, 0x123456789abc)
--+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) |
--+ u.clock_seq_low, 0x3fff)
--+
--+ def test_uuid3(self):
--+ equal = self.assertEqual
--+
--+ # Test some known version-3 UUIDs.
--+ for u, v in [(uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org'),
--+ '6fa459ea-ee8a-3ca4-894e-db77e160355e'),
--+ (uuid.uuid3(uuid.NAMESPACE_URL, 'http://python.org/'),
--+ '9fe8e8c4-aaa8-32a9-a55c-4535a88b748d'),
--+ (uuid.uuid3(uuid.NAMESPACE_OID, '1.3.6.1'),
--+ 'dd1a1cef-13d5-368a-ad82-eca71acd4cd1'),
--+ (uuid.uuid3(uuid.NAMESPACE_X500, 'c=ca'),
--+ '658d3002-db6b-3040-a1d1-8ddd7d189a4d'),
--+ ]:
--+ equal(u.variant, uuid.RFC_4122)
--+ equal(u.version, 3)
--+ equal(u, uuid.UUID(v))
--+ equal(str(u), v)
--+
--+ def test_uuid4(self):
--+ # uuid4 requires ctypes.
--+ try:
--+ import ctypes
--+ except ImportError:
--+ return
--+
--+ equal = self.assertEqual
--+
--+ # Make sure uuid4() generates UUIDs that are actually version 4.
--+ for u in [uuid.uuid4() for i in range(10)]:
--+ equal(u.variant, uuid.RFC_4122)
--+ equal(u.version, 4)
--+
--+ # Make sure the generated UUIDs are actually unique.
--+ uuids = {}
--+ for u in [uuid.uuid4() for i in range(1000)]:
--+ uuids[u] = 1
--+ equal(len(uuids.keys()), 1000)
--+
--+ def test_uuid5(self):
--+ equal = self.assertEqual
--+
--+ # Test some known version-5 UUIDs.
--+ for u, v in [(uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org'),
--+ '886313e1-3b8a-5372-9b90-0c9aee199e5d'),
--+ (uuid.uuid5(uuid.NAMESPACE_URL, 'http://python.org/'),
--+ '4c565f0d-3f5a-5890-b41b-20cf47701c5e'),
--+ (uuid.uuid5(uuid.NAMESPACE_OID, '1.3.6.1'),
--+ '1447fa61-5277-5fef-a9b3-fbc6e44f4af3'),
--+ (uuid.uuid5(uuid.NAMESPACE_X500, 'c=ca'),
--+ 'cc957dd1-a972-5349-98cd-874190002798'),
--+ ]:
--+ equal(u.variant, uuid.RFC_4122)
--+ equal(u.version, 5)
--+ equal(u, uuid.UUID(v))
--+ equal(str(u), v)
--+
--+ def testIssue8621(self):
--+ import os
--+ import sys
--+ if os.name != 'posix':
--+ return
--+
--+ # On at least some versions of OSX uuid.uuid4 generates
--+ # the same sequence of UUIDs in the parent and any
--+ # children started using fork.
--+ fds = os.pipe()
--+ pid = os.fork()
--+ if pid == 0:
--+ os.close(fds[0])
--+ value = uuid.uuid4()
--+ os.write(fds[1], value.hex)
--+ os._exit(0)
--+
--+ else:
--+ os.close(fds[1])
--+ parent_value = uuid.uuid4().hex
--+ os.waitpid(pid, 0)
--+ child_value = os.read(fds[0], 100)
--+
--+ self.assertNotEqual(parent_value, child_value)
--+
--+
--+
--+
--+
--+def test_main():
--+ test_support.run_unittest(TestUUID)
--+
--+if __name__ == '__main__':
--+ test_main()
--diff -druN python-2.7.5.orig/Lib/uuid.py python-2.7.5/Lib/uuid.py
----- python-2.7.5.orig/Lib/uuid.py 2013-05-12 05:32:48.000000000 +0200
--+++ python-2.7.5/Lib/uuid.py 2014-04-10 10:46:45.556242700 +0200
--@@ -50,6 +50,7 @@
-- 'reserved for NCS compatibility', 'specified in RFC 4122',
-- 'reserved for Microsoft compatibility', 'reserved for future definition']
--
--+
-- class UUID(object):
-- """Instances of the UUID class represent UUIDs as specified in RFC 4122.
-- UUID objects are immutable, hashable, and usable as dictionary keys.
--@@ -291,6 +292,7 @@
--
-- version = property(get_version)
--
--+
-- def _find_mac(command, args, hw_identifiers, get_index):
-- import os
-- for dir in ['', '/sbin/', '/usr/sbin']:
--@@ -390,65 +392,87 @@
-- return ((bytes[0]<<40L) + (bytes[1]<<32L) + (bytes[2]<<24L) +
-- (bytes[3]<<16L) + (bytes[4]<<8L) + bytes[5])
--
---# Thanks to Thomas Heller for ctypes and for his help with its use here.
--
---# If ctypes is available, use it to find system routines for UUID generation.
---_uuid_generate_random = _uuid_generate_time = _UuidCreate = None
---try:
--- import ctypes, ctypes.util
--+_ctypes_lib = None
--
--- # The uuid_generate_* routines are provided by libuuid on at least
--- # Linux and FreeBSD, and provided by libc on Mac OS X.
--- for libname in ['uuid', 'c']:
--- try:
--- lib = ctypes.CDLL(ctypes.util.find_library(libname))
--- except:
--- continue
--- if hasattr(lib, 'uuid_generate_random'):
--- _uuid_generate_random = lib.uuid_generate_random
--- if hasattr(lib, 'uuid_generate_time'):
--- _uuid_generate_time = lib.uuid_generate_time
--
--- # The uuid_generate_* functions are broken on MacOS X 10.5, as noted
--- # in issue #8621 the function generates the same sequence of values
--- # in the parent process and all children created using fork (unless
--- # those children use exec as well).
--- #
--- # Assume that the uuid_generate functions are broken from 10.5 onward,
--- # the test can be adjusted when a later version is fixed.
--- import sys
--- if sys.platform == 'darwin':
--- import os
--- if int(os.uname()[2].split('.')[0]) >= 9:
--- _uuid_generate_random = _uuid_generate_time = None
--+def _uuid_generate(attr):
--+ """Find system routines for UUID generation"""
--
--- # On Windows prior to 2000, UuidCreate gives a UUID containing the
--- # hardware address. On Windows 2000 and later, UuidCreate makes a
--- # random UUID and UuidCreateSequential gives a UUID containing the
--- # hardware address. These routines are provided by the RPC runtime.
--- # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last
--- # 6 bytes returned by UuidCreateSequential are fixed, they don't appear
--- # to bear any relationship to the MAC address of any network device
--- # on the box.
--+ # Thanks to Thomas Heller for ctypes and for his help with its use here.
-- try:
--- lib = ctypes.windll.rpcrt4
--+ import ctypes
--+ import ctypes.util
--+
--+ global _ctypes_lib
--+
--+ uuid = None
--+ # The uuid_generate_* routines are provided by libuuid on at least
--+ # Linux and FreeBSD, and provided by libc on Mac OS X.
--+ for libname in ['uuid', 'c']:
--+ try:
--+ if _ctypes_lib is None:
--+ _ctypes_lib = ctypes.CDLL(ctypes.util.find_library(libname))
--+ lib = _ctypes_lib
--+ except:
--+ continue
--+ if hasattr(lib, attr):
--+ uuid = getattr(lib, attr)
--+
--+ # The uuid_generate_* functions are broken on MacOS X 10.5, as noted
--+ # in issue #8621 the function generates the same sequence of values
--+ # in the parent process and all children created using fork (unless
--+ # those children use exec as well).
--+ #
--+ # Assume that the uuid_generate functions are broken from 10.5 onward,
--+ # the test can be adjusted when a later version is fixed.
--+ import sys
--+ if sys.platform == 'darwin':
--+ import os
--+ if int(os.uname()[2].split('.')[0]) >= 9:
--+ uuid = None
--+ return uuid
-- except:
--- lib = None
--- _UuidCreate = getattr(lib, 'UuidCreateSequential',
--- getattr(lib, 'UuidCreate', None))
---except:
--- pass
--+ pass
--+
--+
--+def _uuid_create():
--+ """Get random UUID on Windows platform."""
--+
--+ try:
--+ # On Windows prior to 2000, UuidCreate gives a UUID containing the
--+ # hardware address. On Windows 2000 and later, UuidCreate makes a
--+ # random UUID and UuidCreateSequential gives a UUID containing the
--+ # hardware address. These routines are provided by the RPC runtime.
--+ # NOTE: at least on Tim's WinXP Pro SP2 desktop box, while the last
--+ # 6 bytes returned by UuidCreateSequential are fixed, they don't appear
--+ # to bear any relationship to the MAC address of any network device
--+ # on the box.
--+ try:
--+ import ctypes
--+ lib = ctypes.windll.rpcrt4
--+ except:
--+ lib = None
--+ uuid = getattr(lib, 'UuidCreateSequential',
--+ getattr(lib, 'UuidCreate', None))
--+ return uuid
--+ except:
--+ pass
--
-- def _unixdll_getnode():
-- """Get the hardware address on Unix using ctypes."""
--+ import ctypes
-- _buffer = ctypes.create_string_buffer(16)
--- _uuid_generate_time(_buffer)
--+ uuid_generate_time = _uuid_generate("uuid_generate_time")
--+ uuid_generate_time(_buffer)
-- return UUID(bytes=_buffer.raw).node
--
-- def _windll_getnode():
-- """Get the hardware address on Windows using ctypes."""
--+ import ctypes
-- _buffer = ctypes.create_string_buffer(16)
--- if _UuidCreate(_buffer) == 0:
--+ UuidCreate = _uuid_create()
--+ if UuidCreate(_buffer) == 0:
-- return UUID(bytes=_buffer.raw).node
--
-- def _random_getnode():
--@@ -495,9 +519,12 @@
--
-- # When the system provides a version-1 UUID generator, use it (but don't
-- # use UuidCreate here because its UUIDs don't conform to RFC 4122).
--- if _uuid_generate_time and node is clock_seq is None:
--+ uuid_generate_time = _uuid_generate("uuid_generate_time")
--+
--+ if uuid_generate_time and node is clock_seq is None:
--+ import ctypes
-- _buffer = ctypes.create_string_buffer(16)
--- _uuid_generate_time(_buffer)
--+ uuid_generate_time(_buffer)
-- return UUID(bytes=_buffer.raw)
--
-- global _last_timestamp
--@@ -532,9 +559,11 @@
-- """Generate a random UUID."""
--
-- # When the system provides a version-4 UUID generator, use it.
--- if _uuid_generate_random:
--+ uuid_generate_random = _uuid_generate("uuid_generate_random")
--+ if uuid_generate_random:
--+ import ctypes
-- _buffer = ctypes.create_string_buffer(16)
--- _uuid_generate_random(_buffer)
--+ uuid_generate_random(_buffer)
-- return UUID(bytes=_buffer.raw)
--
-- # Otherwise, get randomness from urandom or the 'random' module.
---- build/pkgs/python/patches/hashlibfallbacks-issue_18000.patch.orig 2014-05-06 11:21:42.000000000 +0000
-+++ build/pkgs/python/patches/hashlibfallbacks-issue_18000.patch 2014-05-31 02:14:09.000000000 +0000
-@@ -1,69 +0,0 @@
--diff -ur src/Lib/test/test_hashlib.py new/Lib/test/test_hashlib.py
----- a/Lib/test/test_hashlib.py 2013-05-12 04:32:46.000000000 +0100
--+++ b/Lib/test/test_hashlib.py 2013-05-18 12:24:04.055336404 +0100
--@@ -19,9 +19,6 @@
-- from test import test_support
-- from test.test_support import _4G, precisionbigmemtest
--
---# Were we compiled --with-pydebug or with #define Py_DEBUG?
---COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
---
--
-- def hexstr(s):
-- import string
--@@ -38,7 +35,7 @@
-- 'sha224', 'SHA224', 'sha256', 'SHA256',
-- 'sha384', 'SHA384', 'sha512', 'SHA512' )
--
--- _warn_on_extension_import = COMPILED_WITH_PYDEBUG
--+ _warn_on_extension_import = True
--
-- def _conditional_import_module(self, module_name):
-- """Import a module and return a reference to it or None on failure."""
--diff -ur src/setup.py new/setup.py
----- a/setup.py 2013-05-12 04:32:54.000000000 +0100
--+++ b/setup.py 2013-05-18 12:22:04.417057535 +0100
--@@ -29,9 +29,6 @@
-- return sys.platform
-- host_platform = get_platform()
--
---# Were we compiled --with-pydebug or with #define Py_DEBUG?
---COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
---
-- # This global variable is used to hold the list of modules to be disabled.
-- disabled_module_list = []
--
--@@ -848,21 +845,18 @@
-- print ("warning: openssl 0x%08x is too old for _hashlib" %
-- openssl_ver)
-- missing.append('_hashlib')
--- if COMPILED_WITH_PYDEBUG or not have_usable_openssl:
--- # The _sha module implements the SHA1 hash algorithm.
--- exts.append( Extension('_sha', ['shamodule.c']) )
--- # The _md5 module implements the RSA Data Security, Inc. MD5
--- # Message-Digest Algorithm, described in RFC 1321. The
--- # necessary files md5.c and md5.h are included here.
--- exts.append( Extension('_md5',
--- sources = ['md5module.c', 'md5.c'],
--- depends = ['md5.h']) )
---
--- min_sha2_openssl_ver = 0x00908000
--- if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver:
--- # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
--- exts.append( Extension('_sha256', ['sha256module.c']) )
--- exts.append( Extension('_sha512', ['sha512module.c']) )
--+
--+ # We always compile these even when OpenSSL is available (issue #14693).
--+ # It's harmless and the object code is tiny (40-50 KB per module,
--+ # only loaded when actually used).
--+ exts.append( Extension('_sha256', ['sha256module.c'],
--+ depends=['hashlib.h']) )
--+ exts.append( Extension('_sha512', ['sha512module.c'],
--+ depends=['hashlib.h']) )
--+ exts.append( Extension('_md5', ['md5module.c', 'md5.c'],
--+ depends=['hashlib.h']) )
--+ exts.append( Extension('_sha', ['shamodule.c'],
--+ depends=['hashlib.h']) )
--
-- # Modules that provide persistent dictionary-like semantics. You will
-- # probably want to arrange for at least one of them to be available on
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_CVE-2014-1912 b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_CVE-2014-1912
deleted file mode 100644
index fa6bcf0de1a7..000000000000
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_CVE-2014-1912
+++ /dev/null
@@ -1,53 +0,0 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_CVE-2014-1912 2014-05-31 00:35:21.000000000 +0000
-@@ -0,0 +1,50 @@
-+# HG changeset patch
-+# User Benjamin Peterson <benjamin@python.org>
-+# Date 1389671978 18000
-+# Node ID 87673659d8f7ba1623cd4914f09ad3d2ade034e9
-+# Parent 2631d33ee7fbd5f0288931ef37872218d511d2e8
-+complain when nbytes > buflen to fix possible buffer overflow (closes #20246)
-+
-+# HG changeset patch
-+# User Stefan Krah <skrah@bytereef.org>
-+# Date 1390341952 -3600
-+# Node ID b6c5a37b221f5c617125faa363d1b460b0b61b42
-+# Parent d55d1cbf5f9a9efa7908fc9412bae676a6b675ef
-+Issue #20246: Fix test failures on FreeBSD. Patch by Ryan Smith-Roberts.
-+
-+diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
-+--- src/Lib/test/test_socket.py
-++++ src/Lib/test/test_socket.py
-+@@ -1620,6 +1620,16 @@ class BufferIOTest(SocketConnectedTest):
-+
-+ _testRecvFromIntoMemoryview = _testRecvFromIntoArray
-+
-++ def testRecvFromIntoSmallBuffer(self):
-++ # See issue #20246.
-++ buf = bytearray(8)
-++ self.assertRaises(ValueError, self.cli_conn.recvfrom_into, buf, 1024)
-++
-++ def _testRecvFromIntoSmallBuffer(self):
-++ with test_support.check_py3k_warnings():
-++ buf = buffer(MSG)
-++ self.serv_conn.send(buf)
-++
-+
-+ TIPC_STYPE = 2000
-+ TIPC_LOWER = 200
-+
-+diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
-+--- src/Modules/socketmodule.c
-++++ src/Modules/socketmodule.c
-+@@ -2742,6 +2742,10 @@ sock_recvfrom_into(PySocketSockObject *s
-+ if (recvlen == 0) {
-+ /* If nbytes was not specified, use the buffer's length */
-+ recvlen = buflen;
-++ } else if (recvlen > buflen) {
-++ PyErr_SetString(PyExc_ValueError,
-++ "nbytes is greater than the length of the buffer");
-++ goto error;
-+ }
-+
-+ readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
-+
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc-library-fcntl.rst b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc-library-fcntl.rst
index 5ca5fec39a78..e2604193e866 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc-library-fcntl.rst
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Doc-library-fcntl.rst
@@ -1,14 +1,13 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Doc-library-fcntl.rst 2014-05-31 00:35:21.000000000 +0000
-@@ -0,0 +1,11 @@
-+--- src/Doc/library/fcntl.rst.orig 2010-08-14 16:19:09.194215129 +0800
-++++ src/Doc/library/fcntl.rst 2010-08-14 16:19:36.999453016 +0800
-+@@ -50,8 +50,6 @@
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Doc__library__fcntl.rst 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,10 @@
++--- src/./Doc/library/fcntl.rst.orig 2014-07-03 21:53:41.473098625 +1000
+++++ src/./Doc/library/fcntl.rst 2014-07-03 21:54:04.342833056 +1000
++@@ -50,7 +50,6 @@
+ operations are typically defined in the library module :mod:`termios` and the
+ argument handling is even more complicated.
+
+- The op parameter is limited to values that can fit in 32-bits.
-+-
-+ The parameter *arg* can be one of an integer, absent (treated identically to the
-+ integer ``0``), an object supporting the read-only buffer interface (most likely
-+ a plain Python string) or an object supporting the read-write buffer interface.
++ Additional constants of interest for use as the *op* argument can be
++ found in the :mod:`termios` module, under the same names as used in
++ the relevant C header files.
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib__distutils__unixccompiler.py b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib__distutils__unixccompiler.py
index 30a3406e4583..8987d81abf37 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib__distutils__unixccompiler.py
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib__distutils__unixccompiler.py
@@ -1,5 +1,5 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Lib__distutils__unixccompiler.py 2014-05-31 00:35:21.000000000 +0000
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Lib__distutils__unixccompiler.py 2014-11-18 03:37:12.000000000 +0000
@@ -0,0 +1,15 @@
+# Description: Some python extensions can't be compiled with clang 3.4
+# Issue ID: http://bugs.python.org/issue20767
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib_distutils_command_build_scripts.py b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib_distutils_command_build_scripts.py
new file mode 100644
index 000000000000..bc336ce06ada
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Lib_distutils_command_build_scripts.py
@@ -0,0 +1,20 @@
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Lib_distutils_command_build_scripts.py 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,17 @@
++# Description: A non-invasive partial backport of the Python3 distutils behaviour.
++# This allows Python's scripts to be properly suffixed (similar to Python 3.x) on
++# installation.
++# Submitted by: mva
++
++--- src/Lib/distutils/command/build_scripts.py.orig 2014-07-26 11:52:20.000000000 +0200
+++++ src/Lib/distutils/command/build_scripts.py 2014-07-26 11:52:56.000000000 +0200
++@@ -126,6 +126,9 @@
++ file, oldmode, newmode)
++ os.chmod(file, newmode)
++
+++ # XXX should we modify self.outfiles?
+++ return outfiles
+++
++ # copy_scripts ()
++
++ # class build_scripts
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Makefile.pre.in b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Makefile.pre.in
index f89ddc78a65b..730c388b82fa 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Makefile.pre.in
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Makefile.pre.in
@@ -1,54 +1,21 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Makefile.pre.in 2014-05-31 00:35:21.000000000 +0000
-@@ -0,0 +1,51 @@
-+# Description: Fix out-of-tree build as a result of upstream #15819
-+# Submitted by: rm (r318353)
-+# Issue ID: http://bugs.python.org/issue15819#msg203348
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Makefile.pre.in 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,18 @@
++# Description: Link scripts in the same way Python3 does
++# Submitted by: mva
+
-+# Description: Run pycompile only once
-+# Submitted by: antoine (r350207)
-+# TODO: ?
-+
-+# Description: Run ranlib before installing the library read-only
-+# Submitted by: antoine@ (r350207)
-+# TODO: Upstream
-+
-+--- src/./Makefile.pre.in.orig 2013-11-10 07:36:41.000000000 +0000
-++++ src/./Makefile.pre.in 2014-04-04 09:16:00.000000000 +0000
-+@@ -285,9 +285,9 @@
-+
-+ ##########################################################################
-+ # AST
-+-AST_H_DIR= Include
-++AST_H_DIR= $(srcdir)/Include
-+ AST_H= $(AST_H_DIR)/Python-ast.h
-+-AST_C_DIR= Python
-++AST_C_DIR= $(srcdir)/Python
-+ AST_C= $(AST_C_DIR)/Python-ast.c
-+ AST_ASDL= $(srcdir)/Parser/Python.asdl
++--- src/Makefile.pre.in.orig 2014-06-30 04:05:39.000000000 +0200
+++++ src/Makefile.pre.in 2014-07-26 11:09:46.000000000 +0200
++@@ -868,6 +868,12 @@
++ (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
++ -rm -f $(DESTDIR)$(LIBPC)/python.pc
++ (cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)
+++ -rm -f $(DESTDIR)$(BINDIR)/idle
+++ (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle2)
+++ -rm -f $(DESTDIR)$(BINDIR)/pydoc
+++ (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc2)
+++ -rm -f $(DESTDIR)$(BINDIR)/2to3
+++ (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
+
-+@@ -1006,12 +1006,12 @@
-+ $(DESTDIR)$(LIBDEST)/distutils/tests ; \
-+ fi
-+ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-+- $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-++ $(PYTHON_FOR_BUILD) -B -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-+ -d $(LIBDEST) -f \
-+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
-+ $(DESTDIR)$(LIBDEST)
-+ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
-+- $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-++ $(PYTHON_FOR_BUILD) -B -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-+ -d $(LIBDEST) -f \
-+ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
-+ $(DESTDIR)$(LIBDEST)
-+@@ -1089,8 +1089,8 @@
-+ if test "$(SO)" = .dll; then \
-+ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
-+ else \
-++ $(RANLIB) $(LIBRARY) ; \
-+ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
-+- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
-+ fi; \
-+ else \
-+ echo Skip install of $(LIBRARY) - use make frameworkinstall; \
++ # Install the interpreter with $(VERSION) affixed
++ # This goes into $(exec_prefix)
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-_ctypes-libffi-configure b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-_ctypes-libffi-configure
index 73e1ac7eff7b..a768a6fa65cf 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-_ctypes-libffi-configure
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-_ctypes-libffi-configure
@@ -1,5 +1,5 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Modules-_ctypes-libffi-configure 2014-05-31 00:35:21.000000000 +0000
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Modules-_ctypes-libffi-configure 2014-11-18 03:37:12.000000000 +0000
@@ -0,0 +1,22 @@
+--- src/Modules/_ctypes/libffi/configure.orig 2010-03-19 19:59:20.000000000 +0100
++++ src/Modules/_ctypes/libffi/configure 2011-03-06 09:20:16.000000000 +0100
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c
index 4c195bd2267e..03bee69c9459 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules-fcntlmodule.c
@@ -1,9 +1,9 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Modules-fcntlmodule.c 2014-05-31 00:35:21.000000000 +0000
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Modules__fcntlmodule.c 2014-11-18 03:37:12.000000000 +0000
@@ -0,0 +1,53 @@
-+--- src/Modules/fcntlmodule.c.orig 2010-08-14 16:36:54.991363730 +0800
-++++ src/Modules/fcntlmodule.c 2010-08-14 16:41:05.555822031 +0800
-+@@ -97,20 +97,15 @@
++--- src/./Modules/fcntlmodule.c.orig 2014-07-03 21:57:10.429953240 +1000
+++++ src/./Modules/fcntlmodule.c 2014-07-03 21:59:36.517210444 +1000
++@@ -98,20 +98,15 @@
+ {
+ #define IOCTL_BUFSZ 1024
+ int fd;
@@ -15,7 +15,7 @@
+ whereas the system expects it to be a 32bit bit field value
+ regardless of it being passed as an int or unsigned long on
+- various platforms. See the termios.TIOCSWINSZ constant across
-+- platforms for an example of thise.
++- platforms for an example of this.
+-
+- If any of the 64bit platforms ever decide to use more than 32bits
+- in their unsigned long ioctl codes this will break and need
@@ -27,7 +27,7 @@
+ int arg;
+ int ret;
+ char *str;
-+@@ -118,7 +113,7 @@
++@@ -119,7 +114,7 @@
+ int mutate_arg = 1;
+ char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
+
@@ -36,7 +36,7 @@
+ conv_descriptor, &fd, &code,
+ &str, &len, &mutate_arg)) {
+ char *arg;
-+@@ -169,7 +164,7 @@
++@@ -170,7 +165,7 @@
+ }
+
+ PyErr_Clear();
@@ -45,7 +45,7 @@
+ conv_descriptor, &fd, &code, &str, &len)) {
+ if (len > IOCTL_BUFSZ) {
+ PyErr_SetString(PyExc_ValueError,
-+@@ -191,7 +186,7 @@
++@@ -192,7 +187,7 @@
+ PyErr_Clear();
+ arg = 0;
+ if (!PyArg_ParseTuple(args,
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c
index bd2b69477bff..456443a692a5 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c
@@ -1,5 +1,5 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c 2014-05-31 00:35:21.000000000 +0000
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_Modules___ctypes__libffi__src__arm__ffi.c 2014-11-18 03:37:12.000000000 +0000
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue20374 b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue20374
deleted file mode 100644
index 93c881111ba9..000000000000
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue20374
+++ /dev/null
@@ -1,58 +0,0 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_issue20374 2014-05-31 00:35:21.000000000 +0000
-@@ -0,0 +1,55 @@
-+# Description: fix readline.so build with readline 6.3
-+# Patch obtained from upstream, issue #20374
-+# http://bugs.python.org/issue20374
-+# PR: ports/187174
-+
-+--- src/./Modules/readline.c.orig 2013-11-10 07:36:41.000000000 +0000
-++++ src/./Modules/readline.c 2014-03-01 12:40:44.000000000 +0000
-+@@ -750,14 +750,22 @@
-+ }
-+
-+ static int
-++#if defined(_RL_FUNCTION_TYPEDEF)
-+ on_startup_hook(void)
-++#else
-++on_startup_hook()
-++#endif
-+ {
-+ return on_hook(startup_hook);
-+ }
-+
-+ #ifdef HAVE_RL_PRE_INPUT_HOOK
-+ static int
-++#if defined(_RL_FUNCTION_TYPEDEF)
-+ on_pre_input_hook(void)
-++#else
-++on_pre_input_hook()
-++#endif
-+ {
-+ return on_hook(pre_input_hook);
-+ }
-+@@ -852,7 +860,7 @@
-+ * before calling the normal completer */
-+
-+ static char **
-+-flex_complete(char *text, int start, int end)
-++flex_complete(const char *text, int start, int end)
-+ {
-+ #ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
-+ rl_completion_append_character ='\0';
-+@@ -911,12 +919,12 @@
-+ rl_bind_key_in_map ('\t', rl_complete, emacs_meta_keymap);
-+ rl_bind_key_in_map ('\033', rl_complete, emacs_meta_keymap);
-+ /* Set our hook functions */
-+- rl_startup_hook = (Function *)on_startup_hook;
-++ rl_startup_hook = on_startup_hook;
-+ #ifdef HAVE_RL_PRE_INPUT_HOOK
-+- rl_pre_input_hook = (Function *)on_pre_input_hook;
-++ rl_pre_input_hook = on_pre_input_hook;
-+ #endif
-+ /* Set our completion function */
-+- rl_attempted_completion_function = (CPPFunction *)flex_complete;
-++ rl_attempted_completion_function = flex_complete;
-+ /* Set Python word break characters */
-+ completer_word_break_characters =
-+ rl_completer_word_break_characters =
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue21166 b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue21166
new file mode 100644
index 000000000000..54261f51da5c
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_issue21166
@@ -0,0 +1,77 @@
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_issue21166 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,74 @@
++# HG changeset patch
++# User Ned Deily <nad@acm.org>
++# Date 1408739459 25200
++# Node ID edb6b282469ea0e8f819d0310afb2937b59dd6b9
++# Parent 727fd4ead3fd854e900ed89362714ad1f7434e5a
++Issue #21166: Prevent possible segfaults and other random failures of
++python --generate-posix-vars in pybuilddir.txt build target by ensuring
++that pybuilddir.txt is always regenerated when configure is run and
++that the newly built skeleton python does not inadvertently import
++modules from previously installed instances.
++
++diff --git a/Makefile.pre.in b/Makefile.pre.in
++--- src/Makefile.pre.in
+++++ src/Makefile.pre.in
++@@ -447,8 +447,18 @@ platform: $(BUILDPYTHON) pybuilddir.txt
++ # Create build directory and generate the sysconfig build-time data there.
++ # pybuilddir.txt contains the name of the build dir and is used for
++ # sys.path fixup -- see Modules/getpath.c.
+++# Since this step runs before shared modules are built, try to avoid bootstrap
+++# problems by creating a dummy pybuildstr.txt just to allow interpreter
+++# initialization to succeed. It will be overwritten by generate-posix-vars
+++# or removed in case of failure.
++ pybuilddir.txt: $(BUILDPYTHON)
++- $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
+++ @echo "none" > ./pybuilddir.txt
+++ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
+++ if test $$? -ne 0 ; then \
+++ echo "generate-posix-vars failed" ; \
+++ rm -f ./pybuilddir.txt ; \
+++ exit 1 ; \
+++ fi
++
++ # Build the shared modules
++ # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
++diff --git a/Misc/NEWS b/Misc/NEWS
++--- src/Misc/NEWS
+++++ src/Misc/NEWS
++@@ -120,6 +120,9 @@ Build
++ - Issue #15759: "make suspicious", "make linkcheck" and "make doctest" in Doc/
++ now display special message when and only when there are failures.
++
+++- Issue #21166: Prevent possible segfaults and other random failures of
+++ python --generate-posix-vars in pybuilddir.txt build target.
+++
++ Windows
++ -------
++
++diff --git a/configure b/configure
++--- src/configure
+++++ src/configure
++@@ -2857,6 +2857,9 @@ case $host_os in *\ *) host_os=`echo "$h
++
++
++
+++# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
+++rm -f pybuilddir.txt
+++
++ if test "$cross_compiling" = yes; then
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
++ $as_echo_n "checking for python interpreter for cross build... " >&6; }
++diff --git a/configure.ac b/configure.ac
++--- src/configure.ac
+++++ src/configure.ac
++@@ -16,6 +16,9 @@ AC_CANONICAL_HOST
++ AC_SUBST(build)
++ AC_SUBST(host)
++
+++# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
+++rm -f pybuilddir.txt
+++
++ if test "$cross_compiling" = yes; then
++ AC_MSG_CHECKING([for python interpreter for cross build])
++ if test -z "$PYTHON_FOR_BUILD"; then
++
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_pr192365 b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_pr192365
new file mode 100644
index 000000000000..1458f887102e
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_pr192365
@@ -0,0 +1,61 @@
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_pr192365 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,58 @@
++# Description: do not define __BSD_VISIBLE/_XOPEN_SOURCE/_POSIX_C_SOURCE
++# in include/python2.7/pyconfig.h
++# Submitted by: antoine
++
++--- src/configure.orig 2014-09-06 14:42:50 UTC
+++++ src/configure
++@@ -2919,13 +2919,6 @@
++
++
++ # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++-# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
++-# them.
++-
++-$as_echo "#define __BSD_VISIBLE 1" >>confdefs.h
++-
++-
++-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++ # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
++
++ $as_echo "#define _BSD_TYPES 1" >>confdefs.h
++@@ -3293,9 +3286,8 @@
++ # but used in struct sockaddr.sa_family. Reported by Tim Rice.
++ SCO_SV/3.2)
++ define_xopen_source=no;;
++- # On FreeBSD 4, the math functions C89 does not cover are never defined
++- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
++- FreeBSD/4.*)
+++ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment.
+++ FreeBSD/*)
++ define_xopen_source=no;;
++ # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
++ # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
++--- src/configure.ac.orig 2014-09-06 14:42:50 UTC
+++++ src/configure.ac
++@@ -88,11 +88,6 @@
++ AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
++
++ # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++-# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
++-# them.
++-AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
++-
++-# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
++ # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
++ AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
++
++@@ -426,9 +421,8 @@
++ # but used in struct sockaddr.sa_family. Reported by Tim Rice.
++ SCO_SV/3.2)
++ define_xopen_source=no;;
++- # On FreeBSD 4, the math functions C89 does not cover are never defined
++- # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
++- FreeBSD/4.*)
+++ # On FreeBSD, defining _XOPEN_SOURCE to 600 requests a strict environment.
+++ FreeBSD/*)
++ define_xopen_source=no;;
++ # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
++ # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
diff --git a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py
index e471a44cc634..4057b4072940 100644
--- a/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py
+++ b/math/sage/files/patch-build_pkgs_python_fbsd-patch-src_setup.py
@@ -1,60 +1,16 @@
---- /dev/null 2014-05-31 00:44:00.000000000 +0000
-+++ build/pkgs/python/fbsd-patch-src_setup.py 2014-05-31 00:38:21.000000000 +0000
-@@ -0,0 +1,74 @@
-+--- src/setup.py.orig 2013-04-06 18:02:41.000000000 +0400
-++++ src/setup.py 2013-04-07 10:52:47.000000000 +0400
-+@@ -755,7 +755,7 @@
-+ elif curses_library:
-+ readline_libs.append(curses_library)
-+ elif self.compiler.find_library_file(lib_dirs +
-+- ['/usr/lib/termcap'],
-++ ['/usr/lib', '/usr/lib/termcap'],
-+ 'termcap'):
-+ readline_libs.append('termcap')
-+ exts.append( Extension('readline', ['readline.c'],
-+@@ -862,6 +862,8 @@
-+ # OpenSSL doesn't do these until 0.9.8 so we'll bring our own hash
-+ exts.append( Extension('_sha256', ['sha256module.c']) )
-+ exts.append( Extension('_sha512', ['sha512module.c']) )
-++ else:
-++ open('.without_own_sha', 'w')
-+
-+ # Modules that provide persistent dictionary-like semantics. You will
-+ # probably want to arrange for at least one of them to be available on
-+@@ -1208,7 +1210,7 @@
-+ sysroot = macosx_sdk_root()
-+ f = os.path.join(sysroot, f[1:])
-+
-+- if os.path.exists(f) and not db_incs:
-++ if os.path.exists(f):
-+ data = open(f).read()
-+ m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
-+ if m is not None:
-+@@ -1540,7 +1544,7 @@
-+ macros = dict()
-+ libraries = []
-+
-+- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
-++ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10', 'freebsd11'):
-+ # FreeBSD's P1003.1b semaphore support is very experimental
-+ # and has many known problems. (as of June 2008)
-+ macros = dict()
-+@@ -1592,7 +1596,7 @@
-+ missing.append('linuxaudiodev')
-+
-+ if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
-+- 'freebsd7', 'freebsd8')
-++ 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10', 'freebsd11')
-+ or host_platform.startswith("gnukfreebsd")):
-+ exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
-+ else:
+--- /dev/null 2014-11-18 03:33:07.000000000 +0000
++++ build/pkgs/python/fbsd-patch-src_setup.py 2014-11-18 03:37:12.000000000 +0000
+@@ -0,0 +1,30 @@
++# Description: SEM option patch. If SEM is enabled, enable the build properly
++# Not upstreamed
++
+--- src/setup.py.orig 2013-04-07 11:07:43.000000000 +0400
++++ src/setup.py 2013-04-07 11:16:36.000000000 +0400
-+@@ -1544,10 +1544,22 @@
++@@ -1551,10 +1551,22 @@
+ macros = dict()
+ libraries = []
+
-+- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8', 'freebsd9', 'freebsd10', 'freebsd11'):
++- elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
++ elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6'):
+ # FreeBSD's P1003.1b semaphore support is very experimental
+ # and has many known problems. (as of June 2008)
diff --git a/math/sage/files/patch-build_pkgs_readline_fbsd-patch-src_support_shlib-install b/math/sage/files/patch-build_pkgs_readline_fbsd-patch-src_support_shlib-install
deleted file mode 100644
index c5f7f2d0390b..000000000000
--- a/math/sage/files/patch-build_pkgs_readline_fbsd-patch-src_support_shlib-install
+++ /dev/null
@@ -1,14 +0,0 @@
---- /dev/null 2014-02-05 02:11:00.000000000 +0000
-+++ build/pkgs/readline/fbsd-patch-src_support_shlib-install 2014-02-05 02:11:23.000000000 +0000
-@@ -0,0 +1,11 @@
-+--- src/support/shlib-install.orig 2009-10-28 13:30:18.000000000 +0000
-++++ src/support/shlib-install 2014-02-05 02:08:59.000000000 +0000
-+@@ -177,7 +177,7 @@
-+ fi
-+ ;;
-+
-+-freebsd[4-9]*|freebsdelf*|dragonfly*)
-++freebsd[4-9].*|freebsd1[0-9].*|freebsdelf*|dragonfly*)
-+ # libname.so -> libname.so.M
-+ ${echo} ${RM} ${INSTALLDIR}/$LINK1
-+ if [ -z "$uninstall" ]; then
diff --git a/math/sage/files/patch-build_pkgs_readline_patches_shobj-conf.patch b/math/sage/files/patch-build_pkgs_readline_patches_shobj-conf.patch
deleted file mode 100644
index d7b64f229abd..000000000000
--- a/math/sage/files/patch-build_pkgs_readline_patches_shobj-conf.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- build/pkgs/readline/patches/shobj-conf.patch-orig 2014-02-04 21:08:30.000000000 -0600
-+++ build/pkgs/readline/patches/shobj-conf.patch 2014-02-04 21:09:48.000000000 -0600
-@@ -43,7 +43,7 @@
- - SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
- -
- - SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
--+freebsdelf*|dragonfly*)
-++freebsd[4-9].*|freebsd1[0-9].*|freebsdelf*|dragonfly*)
- + SHOBJ_CFLAGS=-fPIC
- + SHOBJ_LD='${CC}'
- + SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
diff --git a/math/sage/files/patch-build_pkgs_zlib_spkg-install b/math/sage/files/patch-build_pkgs_zlib_spkg-install
new file mode 100644
index 000000000000..622b8c04ff11
--- /dev/null
+++ b/math/sage/files/patch-build_pkgs_zlib_spkg-install
@@ -0,0 +1,12 @@
+--- build/pkgs/zlib/spkg-install-orig 2014-12-06 21:41:30.000000000 +0000
++++ build/pkgs/zlib/spkg-install 2014-12-06 21:42:12.000000000 +0000
+@@ -1,5 +1,9 @@
+ #!/usr/bin/env bash
+
++# Use system zlibc because on FreeBSD the following doesn't build relocatable
++# libraries.
++exit 0
++
+ if [ -z "$SAGE_LOCAL" ]; then
+ echo >&2 "Error: SAGE_LOCAL undefined - exiting..."
+ echo >&2 "Maybe run 'sage -sh'?"