From owner-svn-ports-head@FreeBSD.ORG Fri Feb 21 13:42:09 2014 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74170A76; Fri, 21 Feb 2014 13:42:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 54E7B1F6A; Fri, 21 Feb 2014 13:42:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1LDg9tI075230; Fri, 21 Feb 2014 13:42:09 GMT (envelope-from koobs@svn.freebsd.org) Received: (from koobs@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1LDg8s1075228; Fri, 21 Feb 2014 13:42:08 GMT (envelope-from koobs@svn.freebsd.org) Message-Id: <201402211342.s1LDg8s1075228@svn.freebsd.org> From: Kubilay Kocak Date: Fri, 21 Feb 2014 13:42:08 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r345444 - in head/lang/python31: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Feb 2014 13:42:09 -0000 Author: koobs Date: Fri Feb 21 13:42:08 2014 New Revision: 345444 URL: http://svnweb.freebsd.org/changeset/ports/345444 QAT: https://qat.redports.org/buildarchive/r345444/ Log: lang/python31: Backport fox for Python issue #8168 - Backport Python issue #8168 [1]: python3 py_compile does not ignore UTF-8 BOM characters This causes installation (during bytecode compilation) errors for Python ports with sources that contain BOM characters [2] The issue was fixed [3] in the default branch at the time (3.2) but was not backported to 3.1. Since Python 3.1 is now in security-fix-only mode (no new features or bug fixes), backporting is required. [1] http://bugs.python.org/issue8168 [2] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/186034 [3] http://hg.python.org/cpython/rev/e15a8a476494/ PR: ports/186034 Reported by: Mark Andrews Added: head/lang/python31/files/patch-Lib__py_compile.py (contents, props changed) Modified: head/lang/python31/Makefile Modified: head/lang/python31/Makefile ============================================================================== --- head/lang/python31/Makefile Fri Feb 21 13:40:33 2014 (r345443) +++ head/lang/python31/Makefile Fri Feb 21 13:42:08 2014 (r345444) @@ -2,7 +2,7 @@ PORTNAME= python31 PORTVERSION= 3.1.5 -PORTREVISION= 9 +PORTREVISION= 10 CATEGORIES= lang python ipv6 MASTER_SITES= PYTHON MASTER_SITE_SUBDIR= ${PYTHON_MASTER_SITE_SUBDIR} Added: head/lang/python31/files/patch-Lib__py_compile.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lang/python31/files/patch-Lib__py_compile.py Fri Feb 21 13:42:08 2014 (r345444) @@ -0,0 +1,49 @@ +# Description: python3 py_compile does not ignore UTF-8 BOM characters +# Issue: http://bugs.python.org/issue8168 +# Commit: http://hg.python.org/cpython/rev/e15a8a476494/ +# PR: ports/186034 + +--- ./Lib/py_compile.py.orig 2014-02-21 23:28:42.491208180 +1100 ++++ ./Lib/py_compile.py 2014-02-21 23:29:22.052513709 +1100 +@@ -7,8 +7,8 @@ + import imp + import marshal + import os +-import re + import sys ++import tokenize + import traceback + + MAGIC = imp.get_magic() +@@ -78,21 +78,6 @@ + (x >> 16) & 0xff, + (x >> 24) & 0xff])) + +-def read_encoding(file, default): +- """Read the first two lines of the file looking for coding: xyzzy.""" +- f = open(file, "rb") +- try: +- for i in range(2): +- line = f.readline() +- if not line: +- break +- m = re.match(br".*\bcoding:\s*(\S+)\b", line) +- if m: +- return m.group(1).decode("ascii") +- return default +- finally: +- f.close() +- + def compile(file, cfile=None, dfile=None, doraise=False): + """Byte-compile one Python source file to Python bytecode. + +@@ -128,7 +113,8 @@ + directories). + + """ +- encoding = read_encoding(file, "utf-8") ++ with open(file, "rb") as f: ++ encoding = tokenize.detect_encoding(f.readline)[0] + f = open(file, 'U', encoding=encoding) + try: + timestamp = int(os.fstat(f.fileno()).st_mtime)