From owner-svn-ports-head@freebsd.org Tue Jun 30 18:25:01 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 449D1990D5D; Tue, 30 Jun 2015 18:25:01 +0000 (UTC) (envelope-from antoine@FreeBSD.org) 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)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 347701D1A; Tue, 30 Jun 2015 18:25:01 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5UIP1ef046180; Tue, 30 Jun 2015 18:25:01 GMT (envelope-from antoine@FreeBSD.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5UIP0Rl046166; Tue, 30 Jun 2015 18:25:00 GMT (envelope-from antoine@FreeBSD.org) Message-Id: <201506301825.t5UIP0Rl046166@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: antoine set sender to antoine@FreeBSD.org using -f From: Antoine Brodin Date: Tue, 30 Jun 2015 18:25:00 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r390980 - in head/devel/py-ply: . 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.20 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: Tue, 30 Jun 2015 18:25:01 -0000 Author: antoine Date: Tue Jun 30 18:24:59 2015 New Revision: 390980 URL: https://svnweb.freebsd.org/changeset/ports/390980 Log: Add patches from upstream to fix issue 63: https://github.com/dabeaz/ply/issues/63 This unbreaks www/chromium Reported by: pkg-fallout With hat: portmgr Added: head/devel/py-ply/files/ head/devel/py-ply/files/patch-CHANGES (contents, props changed) head/devel/py-ply/files/patch-ply_lex.py (contents, props changed) head/devel/py-ply/files/patch-ply_yacc.py (contents, props changed) Modified: head/devel/py-ply/Makefile Modified: head/devel/py-ply/Makefile ============================================================================== --- head/devel/py-ply/Makefile Tue Jun 30 18:13:50 2015 (r390979) +++ head/devel/py-ply/Makefile Tue Jun 30 18:24:59 2015 (r390980) @@ -3,6 +3,7 @@ PORTNAME= ply PORTVERSION= 3.6 +PORTREVISION= 1 CATEGORIES= devel python MASTER_SITES= http://www.dabeaz.com/ply/ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} Added: head/devel/py-ply/files/patch-CHANGES ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/py-ply/files/patch-CHANGES Tue Jun 30 18:24:59 2015 (r390980) @@ -0,0 +1,12 @@ +--- CHANGES.orig 2015-04-25 14:15:57 UTC ++++ CHANGES +@@ -1,3 +1,9 @@ ++Version 3.7 ++--------------------- ++05/07/15: beazley ++ Fixed regression in handling of table modules if specified as module ++ objects. See https://github.com/dabeaz/ply/issues/63 ++ + Version 3.6 + --------------------- + 04/25/15: beazley Added: head/devel/py-ply/files/patch-ply_lex.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/py-ply/files/patch-ply_lex.py Tue Jun 30 18:24:59 2015 (r390980) @@ -0,0 +1,82 @@ +--- ply/lex.py.orig 2015-04-26 21:17:41 UTC ++++ ply/lex.py +@@ -171,7 +171,10 @@ class Lexer: + # ------------------------------------------------------------ + # writetab() - Write lexer information to a table file + # ------------------------------------------------------------ +- def writetab(self, basetabmodule, outputdir=''): ++ def writetab(self, lextab, outputdir=''): ++ if isinstance(lextab, types.ModuleType): ++ raise IOError("Won't overwrite existing lextab module") ++ basetabmodule = lextab.split('.')[-1] + filename = os.path.join(outputdir, basetabmodule) + '.py' + with open(filename, 'w') as tf: + tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__)) +@@ -856,6 +859,10 @@ class LexerReflect(object): + # ----------------------------------------------------------------------------- + def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', + reflags=0, nowarn=False, outputdir=None, debuglog=None, errorlog=None): ++ ++ if lextab is None: ++ lextab = 'lextab' ++ + global lexer + + ldict = None +@@ -885,29 +892,13 @@ def lex(module=None, object=None, debug= + else: + ldict = get_caller_module_dict(2) + +- if outputdir is None: +- # If no output directory is set, the location of the output files +- # is determined according to the following rules: +- # - If lextab specifies a package, files go into that package directory +- # - Otherwise, files go in the same directory as the specifying module +- if '.' not in lextab: +- srcfile = ldict['__file__'] +- else: +- parts = lextab.split('.') +- pkgname = '.'.join(parts[:-1]) +- exec('import %s' % pkgname) +- srcfile = getattr(sys.modules[pkgname], '__file__', '') +- outputdir = os.path.dirname(srcfile) +- + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = ldict.get('__package__') +- if pkg: ++ if pkg and isinstance(lextab, str): + if '.' not in lextab: + lextab = pkg + '.' + lextab + +- baselextab = lextab.split('.')[-1] +- + # Collect parser information from the dictionary + linfo = LexerReflect(ldict, log=errorlog, reflags=reflags) + linfo.get_all() +@@ -1029,8 +1020,24 @@ def lex(module=None, object=None, debug= + + # If in optimize mode, we write the lextab + if lextab and optimize: ++ if outputdir is None: ++ # If no output directory is set, the location of the output files ++ # is determined according to the following rules: ++ # - If lextab specifies a package, files go into that package directory ++ # - Otherwise, files go in the same directory as the specifying module ++ if isinstance(lextab, types.ModuleType): ++ srcfile = lextab.__file__ ++ else: ++ if '.' not in lextab: ++ srcfile = ldict['__file__'] ++ else: ++ parts = lextab.split('.') ++ pkgname = '.'.join(parts[:-1]) ++ exec('import %s' % pkgname) ++ srcfile = getattr(sys.modules[pkgname], '__file__', '') ++ outputdir = os.path.dirname(srcfile) + try: +- lexobj.writetab(baselextab, outputdir) ++ lexobj.writetab(lextab, outputdir) + except IOError as e: + errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) + Added: head/devel/py-ply/files/patch-ply_yacc.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/py-ply/files/patch-ply_yacc.py Tue Jun 30 18:24:59 2015 (r390980) @@ -0,0 +1,79 @@ +--- ply/yacc.py.orig 2015-04-26 21:19:12 UTC ++++ ply/yacc.py +@@ -2692,7 +2692,11 @@ class LRGeneratedTable(LRTable): + # This function writes the LR parsing tables to a file + # ----------------------------------------------------------------------------- + +- def write_table(self, basemodulename, outputdir='', signature=''): ++ def write_table(self, tabmodule, outputdir='', signature=''): ++ if isinstance(tabmodule, types.ModuleType): ++ raise IOError("Won't overwrite existing tabmodule") ++ ++ basemodulename = tabmodule.split('.')[-1] + filename = os.path.join(outputdir, basemodulename) + '.py' + try: + f = open(filename, 'w') +@@ -2705,7 +2709,7 @@ _tabversion = %r + _lr_method = %r + + _lr_signature = %r +- ''' % (filename, __tabversion__, self.lr_method, signature)) ++ ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature)) + + # Change smaller to 0 to go back to original tables + smaller = 1 +@@ -3179,6 +3183,9 @@ def yacc(method='LALR', debug=yaccdebug, + check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file, + outputdir=None, debuglog=None, errorlog=None, picklefile=None): + ++ if tabmodule is None: ++ tabmodule = tab_module ++ + # Reference to the parsing method of the last built parser + global parse + +@@ -3204,22 +3211,26 @@ def yacc(method='LALR', debug=yaccdebug, + # is determined according to the following rules: + # - If tabmodule specifies a package, files go into that package directory + # - Otherwise, files go in the same directory as the specifying module +- if '.' not in tabmodule: +- srcfile = pdict['__file__'] ++ if isinstance(tabmodule, types.ModuleType): ++ srcfile = tabmodule.__file__ + else: +- parts = tabmodule.split('.') +- pkgname = '.'.join(parts[:-1]) +- exec('import %s' % pkgname) +- srcfile = getattr(sys.modules[pkgname], '__file__', '') ++ if '.' not in tabmodule: ++ srcfile = pdict['__file__'] ++ else: ++ parts = tabmodule.split('.') ++ pkgname = '.'.join(parts[:-1]) ++ exec('import %s' % pkgname) ++ srcfile = getattr(sys.modules[pkgname], '__file__', '') + outputdir = os.path.dirname(srcfile) + + # Determine if the module is package of a package or not. + # If so, fix the tabmodule setting so that tables load correctly + pkg = pdict.get('__package__') +- if pkg and '.' not in tabmodule: +- tabmodule = pkg + '.' + tabmodule ++ if pkg and isinstance(tabmodule, str): ++ if '.' not in tabmodule: ++ tabmodule = pkg + '.' + tabmodule ++ + +- basetabmodule = tabmodule.split('.')[-1] + + # Set start symbol if it's specified directly using an argument + if start is not None: +@@ -3432,7 +3443,7 @@ def yacc(method='LALR', debug=yaccdebug, + # Write the table file if requested + if write_tables: + try: +- lr.write_table(basetabmodule, outputdir, signature) ++ lr.write_table(tabmodule, outputdir, signature) + except IOError as e: + errorlog.warning("Couldn't create %r. %s" % (tabmodule, e)) +