From 4fdf08e51cf60ee5bd04886c321773ba297b3145 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Wed, 10 Jan 2018 10:05:39 -0600 Subject: [PATCH] Update to py 1.4.34 (#6789) * Update to the latest version of py * Revert back to py 1.4.34 --- lib/spack/external/py/AUTHORS | 24 ------------------------ lib/spack/external/py/LICENSE | 19 ------------------- lib/spack/external/py/README.rst | 21 --------------------- lib/spack/external/py/__init__.py | 6 ++++-- lib/spack/external/py/_code/code.py | 2 +- lib/spack/external/py/_path/common.py | 14 ++++++++++---- lib/spack/external/py/_path/local.py | 14 ++++++++------ lib/spack/external/py/_path/svnurl.py | 2 +- lib/spack/external/py/_path/svnwc.py | 2 +- 9 files changed, 25 insertions(+), 79 deletions(-) delete mode 100644 lib/spack/external/py/AUTHORS delete mode 100644 lib/spack/external/py/LICENSE delete mode 100644 lib/spack/external/py/README.rst diff --git a/lib/spack/external/py/AUTHORS b/lib/spack/external/py/AUTHORS deleted file mode 100644 index 8c0cf9b71b..0000000000 --- a/lib/spack/external/py/AUTHORS +++ /dev/null @@ -1,24 +0,0 @@ -Holger Krekel, holger at merlinux eu -Benjamin Peterson, benjamin at python org -Ronny Pfannschmidt, Ronny.Pfannschmidt at gmx de -Guido Wesdorp, johnny at johnnydebris net -Samuele Pedroni, pedronis at openend se -Carl Friedrich Bolz, cfbolz at gmx de -Armin Rigo, arigo at tunes org -Maciek Fijalkowski, fijal at genesilico pl -Brian Dorsey, briandorsey at gmail com -Floris Bruynooghe, flub at devork be -merlinux GmbH, Germany, office at merlinux eu - -Contributors include:: - -Ross Lawley -Ralf Schmitt -Chris Lamb -Harald Armin Massa -Martijn Faassen -Ian Bicking -Jan Balster -Grig Gheorghiu -Bob Ippolito -Christian Tismer diff --git a/lib/spack/external/py/LICENSE b/lib/spack/external/py/LICENSE deleted file mode 100644 index 31ecdfb1db..0000000000 --- a/lib/spack/external/py/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - diff --git a/lib/spack/external/py/README.rst b/lib/spack/external/py/README.rst deleted file mode 100644 index e836b7b50a..0000000000 --- a/lib/spack/external/py/README.rst +++ /dev/null @@ -1,21 +0,0 @@ -.. image:: https://img.shields.io/pypi/pyversions/pytest.svg - :target: https://pypi.org/project/py -.. image:: https://img.shields.io/travis/pytest-dev/py.svg - :target: https://travis-ci.org/pytest-dev/py - -The py lib is a Python development support library featuring -the following tools and modules: - -* ``py.path``: uniform local and svn path objects -* ``py.apipkg``: explicit API control and lazy-importing -* ``py.iniconfig``: easy parsing of .ini files -* ``py.code``: dynamic code generation and introspection - -NOTE: prior to the 1.4 release this distribution used to -contain py.test which is now its own package, see http://pytest.org - -For questions and more information please visit http://pylib.readthedocs.org - -Bugs and issues: https://github.com/pytest-dev/py - -Authors: Holger Krekel and others, 2004-2016 diff --git a/lib/spack/external/py/__init__.py b/lib/spack/external/py/__init__.py index c2273a2e64..85af650f5c 100644 --- a/lib/spack/external/py/__init__.py +++ b/lib/spack/external/py/__init__.py @@ -1,5 +1,5 @@ """ -py.test and pylib: rapid testing and development utils +pylib: rapid testing and development utils this module uses apipkg.py for lazy-loading sub modules and classes. The initpkg-dictionary below specifies @@ -8,13 +8,15 @@ (c) Holger Krekel and others, 2004-2014 """ -__version__ = '1.4.32' +__version__ = '1.4.34' from py import _apipkg # so that py.error.* instances are picklable import sys sys.modules['py.error'] = _apipkg.AliasModule("py.error", "py._error", 'error') +import py.error # "Dereference" it now just to be safe (issue110) + _apipkg.initpkg(__name__, attr={'_apipkg': _apipkg}, exportdefs={ # access to all standard lib modules diff --git a/lib/spack/external/py/_code/code.py b/lib/spack/external/py/_code/code.py index f14c562a29..20fd965c97 100644 --- a/lib/spack/external/py/_code/code.py +++ b/lib/spack/external/py/_code/code.py @@ -419,7 +419,7 @@ def __str__(self): def __unicode__(self): entry = self.traceback[-1] loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly()) - return unicode(loc) + return loc.__unicode__() class FormattedExcinfo(object): diff --git a/lib/spack/external/py/_path/common.py b/lib/spack/external/py/_path/common.py index bf42ed5092..5512e51efe 100644 --- a/lib/spack/external/py/_path/common.py +++ b/lib/spack/external/py/_path/common.py @@ -1,6 +1,7 @@ """ """ import os, sys, posixpath +import fnmatch import py # Moved from local.py. @@ -169,11 +170,16 @@ def read(self, mode='r'): def readlines(self, cr=1): """ read and return a list of lines from the path. if cr is False, the newline will be removed from the end of each line. """ + if sys.version_info < (3, ): + mode = 'rU' + else: # python 3 deprecates mode "U" in favor of "newline" option + mode = 'r' + if not cr: - content = self.read('rU') + content = self.read(mode) return content.split('\n') else: - f = self.open('rU') + f = self.open(mode) try: return f.readlines() finally: @@ -378,7 +384,7 @@ def samefile(self, other): return self.strpath == str(other) def __fspath__(self): - return str(self) + return self.strpath class Visitor: def __init__(self, fil, rec, ignore, bf, sort): @@ -436,4 +442,4 @@ def __call__(self, path): name = str(path) # path.strpath # XXX svn? if not os.path.isabs(pattern): pattern = '*' + path.sep + pattern - return py.std.fnmatch.fnmatch(name, pattern) + return fnmatch.fnmatch(name, pattern) diff --git a/lib/spack/external/py/_path/local.py b/lib/spack/external/py/_path/local.py index 0d4e4c93d1..2ffdaddf06 100644 --- a/lib/spack/external/py/_path/local.py +++ b/lib/spack/external/py/_path/local.py @@ -10,7 +10,7 @@ from py._path.common import iswin32, fspath from stat import S_ISLNK, S_ISDIR, S_ISREG -from os.path import abspath, normpath, isabs, exists, isdir, isfile, islink, dirname +from os.path import abspath, normcase, normpath, isabs, exists, isdir, isfile, islink, dirname if sys.version_info > (3,0): def map_as_list(func, iter): @@ -205,14 +205,14 @@ def remove(self, rec=1, ignore_errors=False): if rec: # force remove of readonly files on windows if iswin32: - self.chmod(448, rec=1) # octcal 0700 + self.chmod(0o700, rec=1) py.error.checked_call(py.std.shutil.rmtree, self.strpath, ignore_errors=ignore_errors) else: py.error.checked_call(os.rmdir, self.strpath) else: if iswin32: - self.chmod(448) # octcal 0700 + self.chmod(0o700) py.error.checked_call(os.remove, self.strpath) def computehash(self, hashtype="md5", chunksize=524288): @@ -801,12 +801,13 @@ def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3, if rootdir is None: rootdir = cls.get_temproot() + nprefix = normcase(prefix) def parse_num(path): """ parse the number out of a path (if it matches the prefix) """ - bn = path.basename - if bn.startswith(prefix): + nbasename = normcase(path.basename) + if nbasename.startswith(nprefix): try: - return int(bn[len(prefix):]) + return int(nbasename[len(nprefix):]) except ValueError: pass @@ -898,6 +899,7 @@ def try_remove_lockfile(): return udir make_numbered_dir = classmethod(make_numbered_dir) + def copymode(src, dest): """ copy permission from src to dst. """ py.std.shutil.copymode(src, dest) diff --git a/lib/spack/external/py/_path/svnurl.py b/lib/spack/external/py/_path/svnurl.py index 78d71317ac..6589a71d09 100644 --- a/lib/spack/external/py/_path/svnurl.py +++ b/lib/spack/external/py/_path/svnurl.py @@ -315,7 +315,7 @@ class InfoSvnCommand: # locked, see 'svn help ls' lspattern = re.compile( r'^ *(?P\d+) +(?P.+?) +(0? *(?P\d+))? ' - '*(?P\w+ +\d{2} +[\d:]+) +(?P.*)$') + r'*(?P\w+ +\d{2} +[\d:]+) +(?P.*)$') def __init__(self, line): # this is a typical line from 'svn ls http://...' #_ 1127 jum 0 Jul 13 15:28 branch/ diff --git a/lib/spack/external/py/_path/svnwc.py b/lib/spack/external/py/_path/svnwc.py index 00d3b4bbaf..992223c04a 100644 --- a/lib/spack/external/py/_path/svnwc.py +++ b/lib/spack/external/py/_path/svnwc.py @@ -327,7 +327,7 @@ def fixlocale(): return '' # some nasty chunk of code to solve path and url conversion and quoting issues -ILLEGAL_CHARS = '* | \ / : < > ? \t \n \x0b \x0c \r'.split(' ') +ILLEGAL_CHARS = '* | \\ / : < > ? \t \n \x0b \x0c \r'.split(' ') if os.sep in ILLEGAL_CHARS: ILLEGAL_CHARS.remove(os.sep) ISWINDOWS = sys.platform == 'win32'