From owner-svn-ports-all@freebsd.org Fri Dec 11 08:44:49 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F4A64A8D86; Fri, 11 Dec 2020 08:44:49 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cskqj0DdXz3Gq2; Fri, 11 Dec 2020 08:44:49 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEFC427BDB; Fri, 11 Dec 2020 08:44:48 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BB8imiA090478; Fri, 11 Dec 2020 08:44:48 GMT (envelope-from mandree@FreeBSD.org) Received: (from mandree@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BB8ijDE090461; Fri, 11 Dec 2020 08:44:45 GMT (envelope-from mandree@FreeBSD.org) Message-Id: <202012110844.0BB8ijDE090461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mandree set sender to mandree@FreeBSD.org using -f From: Matthias Andree Date: Fri, 11 Dec 2020 08:44:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r557705 - in head/lang: . tauthon tauthon/files X-SVN-Group: ports-head X-SVN-Commit-Author: mandree X-SVN-Commit-Paths: in head/lang: . tauthon tauthon/files X-SVN-Commit-Revision: 557705 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2020 08:44:49 -0000 Author: mandree Date: Fri Dec 11 08:44:45 2020 New Revision: 557705 URL: https://svnweb.freebsd.org/changeset/ports/557705 Log: [NEW] lang/tauthon: Backwards-compatible fork of Python 2.7 interpreter with Python 3.x features ------------------------------------------------------------------------------ Note this is not fully connected yet, and needs further changes to integrate with flavors, addition to Mk/Uses/python.mk (or some equivalent USES=tauthon) that may need discussion first, for instance, on the package name prefix. This is committed to serve as a common test bed and for experimentation. ------------------------------------------------------------------------------ Maintainer: olce.freebsd.ports@certner.fr (Olivier Certner) Tauthon is a backward-compatible fork of Python's 2.7.18 interpreter with new syntax, builtins, and libraries backported from Python 3.x. Python code and C-extensions targeting Python 2.7 or below are expected to run unmodified on Tauthon and produce the same output. But with Tauthon, that code can now use some of the new features from Python 3.x. This is not an official Python release. Because of its new features, while preserving 2.7 compatibility, Tauthon reports 2.8 as its major/minor versions. Non-exhaustive list of new features: - Function Annotations - Keyword-Only Arguments - "async" and "await" Syntax - Argument-less "super" - New Metaclass Syntax - "nonlocal" - "yield from" Syntax - "concurrent.futures" Module - UTF-8 as the default source encoding WWW: https://github.com/naftaliharris/tauthon (Committed with minor changes over submission, particularly a few reorderings in Makefile to appease portlint -CA.) PR: 251019 Submitted by: Olivier Certner (maintainer) Added: head/lang/tauthon/ head/lang/tauthon/Makefile (contents, props changed) head/lang/tauthon/distinfo (contents, props changed) head/lang/tauthon/files/ head/lang/tauthon/files/patch-Doc__library__fcntl.rst (contents, props changed) head/lang/tauthon/files/patch-Lib_distutils_command_build__scripts.py (contents, props changed) head/lang/tauthon/files/patch-Lib_distutils_command_install__lib.py (contents, props changed) head/lang/tauthon/files/patch-Lib_distutils_tests_test__install__lib.py (contents, props changed) head/lang/tauthon/files/patch-Makefile.pre.in (contents, props changed) head/lang/tauthon/files/patch-Misc_python-config.in (contents, props changed) head/lang/tauthon/files/patch-Modules__fcntlmodule.c (contents, props changed) head/lang/tauthon/files/patch-Modules_posixmodule.c (contents, props changed) head/lang/tauthon/files/patch-pr192365 (contents, props changed) head/lang/tauthon/files/patch-setup.py (contents, props changed) head/lang/tauthon/files/patch-setup_metadata.py (contents, props changed) head/lang/tauthon/pkg-descr (contents, props changed) head/lang/tauthon/pkg-message (contents, props changed) head/lang/tauthon/pkg-plist (contents, props changed) Modified: head/lang/Makefile Modified: head/lang/Makefile ============================================================================== --- head/lang/Makefile Fri Dec 11 08:40:40 2020 (r557704) +++ head/lang/Makefile Fri Dec 11 08:44:45 2020 (r557705) @@ -344,6 +344,7 @@ SUBDIR += squeak SUBDIR += squirrel SUBDIR += swi-pl + SUBDIR += tauthon SUBDIR += tcbasic SUBDIR += tcc SUBDIR += tcl-manual Added: head/lang/tauthon/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/Makefile Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,176 @@ +# $FreeBSD$ + +# This Makefile was copied from lang/python27 and then gradually +# adapted/cleaned-up for Tauthon. +# As for lang/python27, some core modules with extraneous dependencies are +# disabled, and should be made available in other ports if the need arises (see +# 'pkg-message'). +# -- Olivier Certner +PORTNAME= tauthon +DISTVERSION= 2.8.2 +CATEGORIES= lang python + +MAINTAINER= olce.freebsd.ports@certner.fr +COMMENT= Backward-compatible fork of Python 2.7 interpreter with Python 3.x features + +LICENSE= PSFL + +USES= pathfix shebangfix autoreconf ncurses pkgconfig readline:port ssl tar:xz +PATHFIX_MAKEFILEIN= Makefile.pre.in + +USE_GITHUB= yes +GH_ACCOUNT= naftaliharris +GH_PROJECT= tauthon +GH_TAGNAME= v${DISTVERSION} + +USE_LDCONFIG= yes +# Piggyback on Python support in shebangfix +python_CMD= ${PREFIX}/bin/${NAME_VERSION} +# Better be safe than sorry +.for _DIRS in Demo/cgi Demo/comparisons Demo/curses Demo/parser Demo/pdist \ + Demo/pysvr Demo/scripts Demo/sockets Demo/tkinter/guido Demo/turtle \ + Demo/zlib Doc/includes Doc/tools Lib Lib/encodings Lib/ensurepip \ + Lib/idlelib Lib/lib2to3/pgen2 Lib/lib2to3/tests \ + Lib/lib2to3/tests/data Lib/plat-mac Lib/test Lib/test/crashers \ + Mac/BuildScript Mac/scripts Mac/Tools Modules/_ctypes/libffi \ + Parser PCbuild Python Tools/compiler Tools/faqwiz Tools/freeze \ + Tools/gdb Tools/i18n Tools/nuget Tools/pybench Tools/scripts \ + Tools/ssl Tools/unicode Tools/webchecker +SHEBANG_FILES+= ${_DIRS}/*.py +.endfor + +GNU_CONFIGURE= yes +CONFIGURE_ARGS+= --enable-shared +CONFIGURE_ENV+= ac_cv_opt_olimit_ok=no OPT="" # Null out OPT to respect user CFLAGS and remove optimizations + +INSTALL_TARGET= altinstall # Don't want cloberring of unprefixed files + +TEST_TARGET= buildbottest +TEST_ARGS= TESTOPTS=-j${MAKE_JOBS_NUMBER} + +MAKE_ARGS+= INSTALL_SHARED="${INSTALL_LIB}" # Strip shared library + +PLIST_SUB= ABI=${ABIFLAGS} \ + PORTVERSION=${PORTVERSION} \ + VERSION_NOMICRO=${VERSION_NOMICRO} \ + OSMAJOR=${OSVERSION:C/([0-9]*)[0-9]{5}/\1/} # For plat-freebsd* in pkg-plist. https://bugs.python.org/issue19554 + +OPTIONS_DEFINE= DEBUG IPV6 LIBFFI LTO NLS OPTIMIZATIONS PYMALLOC THREADS +OPTIONS_DEFAULT= LIBFFI PYMALLOC THREADS UCS4 +OPTIONS_SINGLE= UNICODE +OPTIONS_SINGLE_UNICODE= UCS2 UCS4 +OPTIONS_SUB= yes + +LIBFFI_DESC= Use libffi from ports instead of bundled version +LTO_DESC= Apply Link-Time Optimizations (needs OPTIMIZATIONS) +NLS_DESC= Enable gettext support for the locale module +OPTIMIZATIONS_DESC= Enable code optimizations and PGO (BROKEN) +UCS2_DESC= Enable UCS2 Unicode Strings +UCS4_DESC= Enable UCS4 Unicode Strings +PYMALLOC_DESC= Enable specialized mallocs + +DEBUG_CONFIGURE_WITH= pydebug +IPV6_CONFIGURE_ENABLE= ipv6 +LIBFFI_CONFIGURE_WITH= system-ffi +LIBFFI_LIB_DEPENDS= libffi.so:devel/libffi + +LTO_IMPLIES= OPTIMIZATIONS +LTO_CONFIGURE_WITH= lto + +# Use CPPFLAGS over CFLAGS due to -I ordering, causing elementtree and pyexpat +# to break in Python 2.7, or preprocessor complaints in Python >= 3.3 +# Upstream Issue: https://bugs.python.org/issue6299 +NLS_USES= gettext +NLS_CPPFLAGS= -I${LOCALBASE}/include +NLS_LIBS= -L${LOCALBASE}/lib -lintl +NLS_CONFIGURE_ENV_OFF= ac_cv_lib_intl_textdomain=no ac_cv_header_libintl_h=no + +OPTIMIZATIONS_CONFIGURE_ENABLE= optimizations +OPTIMIZATIONS_BROKEN= Please disable OPTIMIZATIONS option for now\ + (some tests fail and no PGO profile is computed) + +PYMALLOC_CONFIGURE_WITH=pymalloc + +THREADS_CONFIGURE_WITH= threads +THREADS_LDFLAGS= -lpthread + +UCS2_CONFIGURE_ENABLE= unicode=ucs2 +UCS4_CONFIGURE_ENABLE= unicode=ucs4 + +PYTHON_PORTVERSION= ${DISTVERSION} + +VERSION_NOMICRO= ${DISTVERSION:R} +NAME_VERSION= tauthon${VERSION_NOMICRO} + +.include + +# https://bugs.python.org/issue22521 +# https://bugs.python.org/issue23042 +.if !${PORT_OPTIONS:MLIBFFI} && ${ARCH} == i386 +BROKEN= You must use libffi from ports on i386. Enable the LIBFFI option +.endif + +.if ${ARCH} == i386 +PLIST_SUB+= X86_ONLY="" +.else +PLIST_SUB+= X86_ONLY="@comment " +.endif + +.if ${ARCH:M*64*} +PLIST_SUB+= 32BIT_ONLY="@comment " +.else +PLIST_SUB+= 32BIT_ONLY="" +.endif + +.if ${ARCH} == powerpc64 +MAKE_ENV+= UNAME_m="powerpc64" +.endif + +.if ${ARCH} == sparc64 +CFLAGS+= -DPYTHON_DEFAULT_RECURSION_LIMIT=900 +.endif + +# See https://bugs.freebsd.org/115940 and https://bugs.freebsd.org/193650 +.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS) +PLIST_SUB+= NO_NIS="@comment " +.else +PLIST_SUB+= NO_NIS="" +.endif + +post-patch: + @${REINPLACE_CMD} -e 's|/usr/local/bin/python|${python_CMD}|' \ + ${WRKSRC}/Lib/cgi.py + +.if !exists(/usr/bin/ypcat) || defined(WITHOUT_NIS) + @${REINPLACE_CMD} -e 's/disabled_module_list =[^]]*/&, "nis"/' \ + ${WRKSRC}/setup.py +.endif + +post-install: +# Create symlink for tauthon executable + ${RLN} ${STAGEDIR}${PREFIX}/bin/${NAME_VERSION} \ + ${STAGEDIR}${PREFIX}/bin/tauthon +# Strip shared extensions + for i in ${STAGEDIR}${PREFIX}/lib/${NAME_VERSION}/lib-dynload/*.so; do \ + ${STRIP_CMD} $$i; done +# This code block exists for the qemu-user enabled cross build environment. +# When using this environment in poudriere, CC is not set to the default +# of /usr/bin/cc and a cross-compile toolchain is used. We need to hand +# edit this so that the run time configuration for python matches what the +# FreeBSD base system provides. sbruno 02Aug2017 +.if ${CC} == /nxb-bin/usr/bin/cc + @${REINPLACE_CMD} -e 's=/nxb-bin==' \ + ${STAGEDIR}${PREFIX}/lib/${NAME_VERSION}/_sysconfigdata.py + @cd ${WRKSRC} && ${SETENV} LD_LIBRARY_PATH=${WRKSRC} \ + ./tauthon -E -m compileall -d ${PREFIX}/lib/${NAME_VERSION} \ + ${STAGEDIR}${PREFIX}/lib/${NAME_VERSION}/_sysconfigdata.py + @cd ${WRKSRC} && ${SETENV} LD_LIBRARY_PATH=${WRKSRC} \ + ./tauthon -E -O -m compileall -d ${PREFIX}/lib/${NAME_VERSION} \ + ${STAGEDIR}${PREFIX}/lib/${NAME_VERSION}/_sysconfigdata.py + @${REINPLACE_CMD} -e 's=/nxb-bin==' \ + ${STAGEDIR}${PREFIX}/lib/${NAME_VERSION}/config/Makefile +.endif + ${INSTALL_DATA} ${WRKSRC}/Tools/gdb/libpython.py \ + ${STAGEDIR}${PREFIX}/lib/lib${NAME_VERSION}.so.1-gdb.py + +.include Added: head/lang/tauthon/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/distinfo Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,3 @@ +TIMESTAMP = 1604584539 +SHA256 (naftaliharris-tauthon-2.8.2-v2.8.2_GH0.tar.gz) = 9423756fcb0afb652ae1ce3c7f0ac195e731e3a4f535a703991cf76bcb3ce267 +SIZE (naftaliharris-tauthon-2.8.2-v2.8.2_GH0.tar.gz) = 17701363 Added: head/lang/tauthon/files/patch-Doc__library__fcntl.rst ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Doc__library__fcntl.rst Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,10 @@ +--- ./Doc/library/fcntl.rst.orig 2014-07-03 21:53:41.473098625 +1000 ++++ ./Doc/library/fcntl.rst 2014-07-03 21:54:04.342833056 +1000 +@@ -50,7 +50,6 @@ The module defines the following functio + 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. + 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. Added: head/lang/tauthon/files/patch-Lib_distutils_command_build__scripts.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Lib_distutils_command_build__scripts.py Fri Dec 11 08:44:45 2020 (r557705) @@ -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 + +--- Lib/distutils/command/build_scripts.py.orig 2014-07-26 09:52:20.000000000 UTC ++++ Lib/distutils/command/build_scripts.py 2014-07-26 09:52:56.000000000 UTC +@@ -126,6 +126,9 @@ class build_scripts (Command): + file, oldmode, newmode) + os.chmod(file, newmode) + ++ # XXX should we modify self.outfiles? ++ return outfiles ++ + # copy_scripts () + + # class build_scripts Added: head/lang/tauthon/files/patch-Lib_distutils_command_install__lib.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Lib_distutils_command_install__lib.py Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,34 @@ +From 9934ce31b8447667f71c211e559a8de71e8263db Mon Sep 17 00:00:00 2001 +From: Brendan Molloy +Date: Mon, 4 Jan 2016 23:14:06 +1100 +Subject: [PATCH] Check bytecode file actually exists and tests + +Should solve issue 20397, where using the --record argument results +in files that failed to generate bytecode files are added to the +record file nonetheless. +--- + Lib/distutils/command/install_lib.py | 17 +++++++++++++---- + Lib/distutils/tests/test_install_lib.py | 8 ++++++-- + 2 files changed, 19 insertions(+), 6 deletions(-) + +--- Lib/distutils/command/install_lib.py.orig 2015-12-05 19:46:56 UTC ++++ Lib/distutils/command/install_lib.py +@@ -168,10 +168,14 @@ class install_lib(Command): + ext = os.path.splitext(os.path.normcase(py_file))[1] + if ext != PYTHON_SOURCE_EXTENSION: + continue +- if self.compile: +- bytecode_files.append(py_file + "c") +- if self.optimize > 0: +- bytecode_files.append(py_file + "o") ++ ++ pyc_file = py_file + "c" ++ if self.compile and os.path.isfile(pyc_file): ++ bytecode_files.append(pyc_file) ++ ++ pyo_file = py_file + "o" ++ if self.optimize > 0 and os.path.isfile(pyo_file): ++ bytecode_files.append(pyo_file) + + return bytecode_files + Added: head/lang/tauthon/files/patch-Lib_distutils_tests_test__install__lib.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Lib_distutils_tests_test__install__lib.py Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,30 @@ +From 9934ce31b8447667f71c211e559a8de71e8263db Mon Sep 17 00:00:00 2001 +From: Brendan Molloy +Date: Mon, 4 Jan 2016 23:14:06 +1100 +Subject: [PATCH] Check bytecode file actually exists and tests + +Should solve issue 20397, where using the --record argument results +in files that failed to generate bytecode files are added to the +record file nonetheless. +--- + Lib/distutils/command/install_lib.py | 17 +++++++++++++---- + Lib/distutils/tests/test_install_lib.py | 8 ++++++-- + 2 files changed, 19 insertions(+), 6 deletions(-) + +--- Lib/distutils/tests/test_install_lib.py.orig 2015-12-05 19:46:57 UTC ++++ Lib/distutils/tests/test_install_lib.py +@@ -64,8 +64,12 @@ class InstallLibTestCase(support.Tempdir + cmd.distribution.packages = [pkg_dir] + cmd.distribution.script_name = 'setup.py' + +- # get_output should return 4 elements +- self.assertGreaterEqual(len(cmd.get_outputs()), 2) ++ # Create rubbish, uncompilable file ++ f = os.path.join(pkg_dir, 'rubbish.py') ++ self.write_file(f, 'rubbish()') ++ ++ # get_output should return 3 elements ++ self.assertEqual(len(cmd.get_outputs()), 3) + + def test_get_inputs(self): + pkg_dir, dist = self.create_dist() Added: head/lang/tauthon/files/patch-Makefile.pre.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Makefile.pre.in Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,19 @@ +# Taken and adapted from lang/python27 port +# Description: Link scripts in the same way Python3 does +# Submitted by: mva + +--- Makefile.pre.in.orig 2014-06-30 04:05:39.000000000 +0200 ++++ Makefile.pre.in 2014-07-26 11:09:46.000000000 +0200 +@@ -900,6 +900,12 @@ bininstall: altbininstall + (cd $(DESTDIR)$(LIBPC); $(LN) -s tauthon-$(VERSION).pc tauthon2.pc) + -rm -f $(DESTDIR)$(LIBPC)/tauthon.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s tauthon2.pc tauthon.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) + + # Install the interpreter with $(VERSION) affixed + # This goes into $(exec_prefix) Added: head/lang/tauthon/files/patch-Misc_python-config.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Misc_python-config.in Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,21 @@ +# pythonx.y-config --ldflags out of /usr and missing -L +# https://bugs.python.org/issue7352 + +--- Misc/python-config.in.orig 2015-10-18 07:24:01 UTC ++++ Misc/python-config.in +@@ -21,6 +21,7 @@ except getopt.error: + if not opts: + exit_with_usage() + ++libdir = sysconfig.EXEC_PREFIX + '/lib' + pyver = sysconfig.get_config_var('VERSION') + getvar = sysconfig.get_config_var + +@@ -50,6 +51,7 @@ for opt in opt_flags: + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags': ++ libs.insert(0, '-L' + libdir) + if not getvar('Py_ENABLE_SHARED'): + libs.insert(0, '-L' + getvar('LIBPL')) + if not getvar('PYTHONFRAMEWORK'): Added: head/lang/tauthon/files/patch-Modules__fcntlmodule.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Modules__fcntlmodule.c Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,53 @@ +--- ./Modules/fcntlmodule.c.orig 2014-07-03 21:57:10.429953240 +1000 ++++ ./Modules/fcntlmodule.c 2014-07-03 21:59:36.517210444 +1000 +@@ -98,20 +98,15 @@ fcntl_ioctl(PyObject *self, PyObject *ar + { + #define IOCTL_BUFSZ 1024 + int fd; +- /* In PyArg_ParseTuple below, we use the unsigned non-checked 'I' ++ /* In PyArg_ParseTuple below, we use the unsigned non-checked 'k' + format for the 'code' parameter because Python turns 0x8000000 + into either a large positive number (PyLong or PyInt on 64-bit + platforms) or a negative number on others (32-bit PyInt) + 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 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 +- special casing based on the platform being built on. ++ various platforms. + */ +- unsigned int code; ++ unsigned long code; + int arg; + int ret; + char *str; +@@ -119,7 +114,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + int mutate_arg = 1; + char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ + +- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl", ++ if (PyArg_ParseTuple(args, "O&kw#|i:ioctl", + conv_descriptor, &fd, &code, + &str, &len, &mutate_arg)) { + char *arg; +@@ -170,7 +165,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + } + + PyErr_Clear(); +- if (PyArg_ParseTuple(args, "O&Is#:ioctl", ++ if (PyArg_ParseTuple(args, "O&ks#:ioctl", + conv_descriptor, &fd, &code, &str, &len)) { + if (len > IOCTL_BUFSZ) { + PyErr_SetString(PyExc_ValueError, +@@ -192,7 +187,7 @@ fcntl_ioctl(PyObject *self, PyObject *ar + PyErr_Clear(); + arg = 0; + if (!PyArg_ParseTuple(args, +- "O&I|i;ioctl requires a file or file descriptor," ++ "O&k|i;ioctl requires a file or file descriptor," + " an integer and optionally an integer or buffer argument", + conv_descriptor, &fd, &code, &arg)) { + return NULL; Added: head/lang/tauthon/files/patch-Modules_posixmodule.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-Modules_posixmodule.c Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,27 @@ +# Add closefrom(2) support +# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242274 +# https://bugs.python.org/issue38061 +# TODO: Upstream + +--- Modules/posixmodule.c.orig 2019-10-19 18:38:44 UTC ++++ Modules/posixmodule.c +@@ -6676,9 +6676,16 @@ posix_closerange(PyObject *self, PyObject *args) + 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); ++#ifdef __FreeBSD__ ++ if (fd_to >= sysconf(_SC_OPEN_MAX)) { ++ closefrom(fd_from); ++ } else ++#endif ++ { ++ for (i = fd_from; i < fd_to; i++) ++ if (_PyVerify_fd(i)) ++ close(i); ++ } + Py_END_ALLOW_THREADS + Py_RETURN_NONE; + } Added: head/lang/tauthon/files/patch-pr192365 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-pr192365 Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,58 @@ +# Description: do not define __BSD_VISIBLE/_XOPEN_SOURCE/_POSIX_C_SOURCE +# in include/python2.7/pyconfig.h +# Submitted by: antoine + +--- configure.orig 2014-09-06 14:42:50 UTC ++++ 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 +--- configure.ac.orig 2014-09-06 14:42:50 UTC ++++ 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 Added: head/lang/tauthon/files/patch-setup.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-setup.py Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,93 @@ +# Description: Partial script installation backport from Python3 +# Submitted by: mva + +# Description: Some modules are installed via other ports + +# Description: ossaudiodev detection fix backport + +--- setup.py.orig 2017-04-22 03:42:03 UTC ++++ setup.py +@@ -15,6 +15,7 @@ from distutils.core import Extension, se + from distutils.command.build_ext import build_ext + from distutils.command.install import install + from distutils.command.install_lib import install_lib ++from distutils.command.build_scripts import build_scripts + from distutils.spawn import find_executable + + cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ +@@ -33,7 +34,7 @@ host_platform = get_platform() + 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 = [] ++disabled_module_list = ["_bsddb", "_sqlite3", "_tkinter", "gdbm", "mpz"] + + def add_dir_to_list(dirlist, dir): + """Add the directory 'dir' to the list 'dirlist' (at the front) if +@@ -1234,7 +1235,7 @@ class PyBuildExt(build_ext): + 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: +@@ -1624,9 +1625,10 @@ class PyBuildExt(build_ext): + else: + missing.append('linuxaudiodev') + +- if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', +- 'freebsd7', 'freebsd8') +- or host_platform.startswith("gnukfreebsd")): ++# Initial backport of https://hg.python.org/cpython/rev/50f1922bc1d5 ++ ++ if any(sys.platform.startswith(prefix) ++ for prefix in ("linux", "freebsd", "gnukfreebsd")): + exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) + else: + missing.append('ossaudiodev') +@@ -2200,6 +2202,22 @@ class PyBuildInstallLib(install_lib): + def is_chmod_supported(self): + return hasattr(os, 'chmod') + ++class PyBuildScripts(build_scripts): ++ def copy_scripts(self): ++ outfiles = build_scripts.copy_scripts(self) ++ fullversion = '{0[0]}.{0[1]}'.format(sys.version_info) ++ newoutfiles = [] ++ for filename in outfiles: ++ if filename.endswith('2to3'): ++ newfilename = filename + '-' + fullversion ++ else: ++ newfilename = filename + fullversion ++ log.info('renaming {} to {}'.format(filename, newfilename)) ++ os.rename(filename, newfilename) ++ newoutfiles.append(newfilename) ++ return newoutfiles ++ ++ + SUMMARY = """ + Python is an interpreted, interactive, object-oriented programming + language. It is often compared to Tcl, Perl, Scheme or Java. +@@ -2245,7 +2263,9 @@ def main(): + platforms = ["Many"], + + # Build info +- cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, ++ cmdclass = {'build_ext':PyBuildExt, ++ 'build_scripts':PyBuildScripts, ++ 'install':PyBuildInstall, + 'install_lib':PyBuildInstallLib}, + # The struct module is defined here, because build_ext won't be + # called unless there's at least one extension module defined. +@@ -2253,8 +2273,7 @@ def main(): + + # Scripts to install + scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', +- 'Tools/scripts/2to3', +- 'Lib/smtpd.py'] ++ 'Tools/scripts/2to3'] + ) + + # --install-platlib Added: head/lang/tauthon/files/patch-setup_metadata.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/files/patch-setup_metadata.py Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,29 @@ +--- setup.py 2020-11-10 14:32:40.701965000 +0000 ++++ setup.py 2020-11-10 14:53:04.048189000 +0000 +@@ -2329,6 +2329,10 @@ + listed here, it may still be supported, if there's a C compiler for + it. Ask around on comp.lang.python -- or just try compiling Python + yourself. ++ ++This implementation, Tauthon, is a backward-compatible fork of ++Python's 2.7.18 interpreter with new syntax, builtins, and libraries ++backported from Python 3.x. + """ + + CLASSIFIERS = """ +@@ -2345,12 +2349,12 @@ + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) + setup(# PyPI Metadata (PEP 301) + name = "Python", + version = sys.version.split()[0], +- url = "http://www.python.org/%s" % sys.version[:3], +- maintainer = "Guido van Rossum and the Python community", +- maintainer_email = "python-dev@python.org", ++ url = "https://github.com/naftaliharris/tauthon", ++ maintainer = "Guido van Rossum, the Python community \ ++and the Tauthon developers", + description = "A high-level object-oriented programming language", + long_description = SUMMARY.strip(), + license = "PSF license", + classifiers = filter(None, CLASSIFIERS.split("\n")), Added: head/lang/tauthon/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/pkg-descr Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,22 @@ +Tauthon is a backward-compatible fork of Python's 2.7.18 interpreter with new +syntax, builtins, and libraries backported from Python 3.x. + +Python code and C-extensions targeting Python 2.7 or below are expected to run +unmodified on Tauthon and produce the same output. But with Tauthon, that code +can now use some of the new features from Python 3.x. + +This is not an official Python release. Because of its new features, while +preserving 2.7 compatibility, Tauthon reports 2.8 as its major/minor versions. + +Non-exhaustive list of new features: +- Function Annotations +- Keyword-Only Arguments +- "async" and "await" Syntax +- Argument-less "super" +- New Metaclass Syntax +- "nonlocal" +- "yield from" Syntax +- "concurrent.futures" Module +- UTF-8 as the default source encoding + +WWW: https://github.com/naftaliharris/tauthon Added: head/lang/tauthon/pkg-message ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/tauthon/pkg-message Fri Dec 11 08:44:45 2020 (r557705) @@ -0,0 +1,13 @@ +[ +{ type: install + message: <