[pypy-commit] pypy fix-package-py: fix minor bug in package.py
Author: Dan Crosta dcro...@late.am Branch: fix-package-py Changeset: r72750:fdc893a448eb Date: 2014-08-01 17:32 -0400 http://bitbucket.org/pypy/pypy/changeset/fdc893a448eb/ Log:fix minor bug in package.py diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -74,7 +74,7 @@ dirs = glob.glob(options.license_base + / +pat) if not dirs: raise ValueError, Could not find + options.license_base + / + pat -if len(dirs) 2: +if len(dirs) 1: raise ValueError, Multiple copies of +pat dir = dirs[0] with open(os.path.join(dir, fname)) as fid: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Merged in dcrosta/pypy/fix-package-py (pull request #260)
Author: Armin Rigo armin.r...@gmail.com Branch: Changeset: r72751:78232ee06e08 Date: 2014-08-11 15:24 +0200 http://bitbucket.org/pypy/pypy/changeset/78232ee06e08/ Log:Merged in dcrosta/pypy/fix-package-py (pull request #260) fix minor bug in package.py diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -74,7 +74,7 @@ dirs = glob.glob(options.license_base + / +pat) if not dirs: raise ValueError, Could not find + options.license_base + / + pat -if len(dirs) 2: +if len(dirs) 1: raise ValueError, Multiple copies of +pat dir = dirs[0] with open(os.path.join(dir, fname)) as fid: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Clean up.
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r72752:9eb10c16e25a Date: 2014-08-11 15:41 +0200 http://bitbucket.org/pypy/pypy/changeset/9eb10c16e25a/ Log:Clean up. diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -52,13 +52,18 @@ sep_template = \nThis copy of PyPy includes a copy of %s, which is licensed under the following terms:\n\n -def generate_license_linux(basedir, options): +def generate_license(basedir, options): base_file = str(basedir.join('LICENSE')) with open(base_file) as fid: txt = fid.read() -searches = [(bzip2,libbz2-*, copyright, '-'), -(openssl, openssl*, copyright, 'LICENSE ISSUES'), - ] +if sys.platform == 'win32': +# shutil.copyfileobj(open(crtlicense.txt), out) # We do not ship +# msvc runtime files, but otherwise we'd need this on Windows +searches = [(bzip2,bzip2-*, LICENSE, ''), +(openssl, openssl-*, LICENSE, '')] +else: +searches = [(bzip2,libbz2-*dev, copyright, '-'), +(openssl, openssl*, copyright, 'LICENSE ISSUES')] if not options.no_tk: name = 'Tcl/Tk' txt += License for '%s' %name @@ -73,9 +78,9 @@ txt += sep_template % name dirs = glob.glob(options.license_base + / +pat) if not dirs: -raise ValueError, Could not find + options.license_base + / + pat +raise ValueError, Could not find %s/%s % (options.license_base, pat) if len(dirs) 1: -raise ValueError, Multiple copies of +pat +raise ValueError, Multiple copies of %r: %r % (pat, dirs) dir = dirs[0] with open(os.path.join(dir, fname)) as fid: # Read up to the line dividing the packaging header from the actual copyright @@ -92,43 +97,6 @@ txt += gdbm_bit return txt -def generate_license_windows(basedir, options): -base_file = str(basedir.join('LICENSE')) -with open(base_file) as fid: -txt = fid.read() -# shutil.copyfileobj(open(crtlicense.txt), out) # We do not ship msvc runtime files -if not options.no_tk: -name = 'Tcl/Tk' -txt += License for '%s' %name -txt += '\n' + =*(14 + len(name)) + '\n' -txt += sep_template % name -base_file = str(basedir.join('lib_pypy/_tkinter/license.terms')) -with open(base_file, 'r') as fid: -txt += fid.read() -for name, pat, file in ((bzip2,bzip2-*, LICENSE), - (openssl, openssl-*, LICENSE)): -txt += sep_template % name -dirs = glob.glob(options.license_base + / +pat) -if not dirs: -raise ValueError, Could not find + options.license_base + / + pat -if len(dirs) 2: -raise ValueError, Multiple copies of +pat -dir = dirs[0] -with open(os.path.join(dir, file)) as fid: -txt += fid.read() -return txt - -def generate_license_darwin(basedir, options): -# where are copyright files on macos? -return generate_license_linux(basedir, options) - -if sys.platform == 'win32': -generate_license = generate_license_windows -elif sys.platform == 'darwin': -generate_license = generate_license_darwin -else: -generate_license = generate_license_linux - def create_cffi_import_libraries(pypy_c, options): modules = ['_sqlite3'] subprocess.check_call([str(pypy_c), '-c', 'import _sqlite3']) @@ -396,7 +364,9 @@ The gdbm module includes code from gdbm.h, which is distributed under the terms -of the GPL license version 2 or any later version. +of the GPL license version 2 or any later version. Thus the gdbm module, provided in +the file lib_pypy/gdbm.py, is redistributed under the terms of the GPL license as +well. ''' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy default: Fix the outdated docstring
Author: Armin Rigo ar...@tunes.org Branch: Changeset: r72753:20ca991cc414 Date: 2014-08-11 16:22 +0200 http://bitbucket.org/pypy/pypy/changeset/20ca991cc414/ Log:Fix the outdated docstring diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -3,9 +3,8 @@ It uses 'pypy/goal/pypy-c' and parts of the rest of the working copy. Usage: -package.py [--options] +package.py [--options] pypy-VER-PLATFORM -Usually you would do: package.py --version-name pypy-VER-PLATFORM The output is found in the directory from --builddir, by default /tmp/usession-YOURNAME/build/. ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy utf8-unicode2: Handle newlines as ascii strings in W_TextIOWrapper
Author: Tyler Wade way...@gmail.com Branch: utf8-unicode2 Changeset: r72755:8f5d79d24198 Date: 2014-08-11 12:58 -0500 http://bitbucket.org/pypy/pypy/changeset/8f5d79d24198/ Log:Handle newlines as ascii strings in W_TextIOWrapper diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py --- a/pypy/module/_io/interp_textio.py +++ b/pypy/module/_io/interp_textio.py @@ -372,6 +372,7 @@ newline = None else: newline = space.unicode_w(w_newline) + if (newline is not None and len(newline) 0 and not (utf8.EQ(newline, Utf8Str('\n')) or utf8.EQ(newline, Utf8Str('\r\n')) or @@ -379,20 +380,23 @@ r = space.str_w(space.repr(w_newline)) raise OperationError(space.w_ValueError, space.wrap( illegal newline value: %s % (r,))) +elif newline is not None: +# newline is guaranteed to be either empty or ascii +newline = newline.bytes self.line_buffering = line_buffering -self.readuniversal = newline is None or len(newline) == 0 +self.readuniversal = not newline self.readtranslate = newline is None self.readnl = newline -self.writetranslate = newline is None or len(newline) == 0 +self.writetranslate = (newline is not None and newline != '') if not self.readuniversal: self.writenl = self.readnl -if utf8.EQ(self.writenl, Utf8Str('\n')): +if self.writenl == '\n': self.writenl = None elif _WINDOWS: -self.writenl = Utf8Str(\r\n) +self.writenl = \r\n else: self.writenl = None diff --git a/pypy/module/_io/test/test_textio.py b/pypy/module/_io/test/test_textio.py --- a/pypy/module/_io/test/test_textio.py +++ b/pypy/module/_io/test/test_textio.py @@ -192,6 +192,26 @@ assert got_line == exp_line assert len(got_lines) == len(exp_lines) +def test_newlines_output(self): +import _io +import os +testdict = { +: bAAA\nBBB\nCCC\nX\rY\r\nZ, +\n: bAAA\nBBB\nCCC\nX\rY\r\nZ, +\r: bAAA\rBBB\rCCC\rX\rY\r\rZ, +\r\n: bAAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ, +} +tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) +for newline, expected in tests: +buf = _io.BytesIO() +txt = _io.TextIOWrapper(buf, encoding=ascii, newline=newline) +txt.write(uAAA\nB) +txt.write(uBB\nCCC\n) +txt.write(uX\rY\r\nZ) +txt.flush() +assert buf.closed == False +assert buf.getvalue() == expected + def test_readline(self): import _io ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy utf8-unicode2: Fix text_index when run on a translated PyPy
Author: Tyler Wade way...@gmail.com Branch: utf8-unicode2 Changeset: r72754:42f8daeaba72 Date: 2014-08-11 03:06 -0500 http://bitbucket.org/pypy/pypy/changeset/42f8daeaba72/ Log:Fix text_index when run on a translated PyPy diff --git a/pypy/interpreter/utf8.py b/pypy/interpreter/utf8.py --- a/pypy/interpreter/utf8.py +++ b/pypy/interpreter/utf8.py @@ -174,9 +174,14 @@ return pos def __getitem__(self, char_pos): -if not isinstance(char_pos, int): -raise TypeError(string index must be an integer, not %r % - type(char_pos)) +if not we_are_translated(): +if hasattr(char_pos, '__index__'): +char_pos = char_pos.__index__() + +if not isinstance(char_pos, (int, long)): +raise TypeError(string index must be an integer, not %r % +type(char_pos)) + # This if statement is needed for [-1:0] to slice correctly if char_pos = self._len: raise IndexError() ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy.org extradoc: update the values
Author: Armin Rigo ar...@tunes.org Branch: extradoc Changeset: r522:8ca06ef29c45 Date: 2014-08-11 21:57 +0200 http://bitbucket.org/pypy/pypy.org/changeset/8ca06ef29c45/ Log:update the values diff --git a/don1.html b/don1.html --- a/don1.html +++ b/don1.html @@ -9,13 +9,13 @@ script $(function() { $(#progressbar).progressbar({ - value: 49.6 + value: 49.8 }); }); /script !-- Income:PyPy:Donations:Py3k / 0.95 -- - $52126 of $105000 (49.6%) + $52294 of $105000 (49.8%) div id=progressbar /div diff --git a/don3.html b/don3.html --- a/don3.html +++ b/don3.html @@ -9,13 +9,13 @@ script $(function() { $(#progressbar).progressbar({ - value: 80.6 + value: 80.7 }); }); /script !-- Income:PyPy:Donations:Numpy / 0.95 -- - $48374 of $6 (80.6%) + $48398 of $6 (80.7%) div id=progressbar /div diff --git a/don4.html b/don4.html --- a/don4.html +++ b/don4.html @@ -17,7 +17,7 @@ 2nd call: !-- Income:PyPy:Donations:Transactional Memory from April 8, 2014, divided by 0.9 -- - $13463 of $8 (16.8%) + $13478 of $8 (16.8%) div id=progressbar /div ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy.org extradoc: document numpy installation
Author: Matti Picus matti.pi...@gmail.com Branch: extradoc Changeset: r523:b87c15bb2467 Date: 2014-08-11 23:43 +0300 http://bitbucket.org/pypy/pypy.org/changeset/b87c15bb2467/ Log:document numpy installation diff --git a/compat.html b/compat.html --- a/compat.html +++ b/compat.html @@ -67,6 +67,7 @@ litt class=docutils literalcPickle, _csv, ctypes, datetime, dbm, _functools, grp, pwd, readline, resource, sqlite3, syslog, tputil/tt/li /ul pAll modules that are pure python in CPython of course work./p +pNumpy support is not complete. We maintain our own fork of numpy for now, further instructions can be found at a class=reference external href=https://bitbucket.org/pypy/numpy.git;https://bitbucker.org/pypy/numpy.git/a./p pPython libraries known to work under PyPy (the list is not exhaustive). A community maintained a class=reference external href=https://bitbucket.org/pypy/compatibility/wiki/Home;compatibility wiki/a is hosted on bitbucket:/p ul class=simple diff --git a/source/compat.txt b/source/compat.txt --- a/source/compat.txt +++ b/source/compat.txt @@ -31,6 +31,10 @@ All modules that are pure python in CPython of course work. +Numpy support is not complete. We maintain our own fork of numpy for now, further instructions can be found at `https://bitbucker.org/pypy/numpy.git`__. + +.. __: https://bitbucket.org/pypy/numpy.git + Python libraries known to work under PyPy (the list is not exhaustive). A community maintained `compatibility wiki`_ is hosted on bitbucket: ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit
[pypy-commit] pypy py3k: merge default
Author: Philip Jenvey pjen...@underboss.org Branch: py3k Changeset: r72756:87910b468690 Date: 2014-08-11 17:12 -0700 http://bitbucket.org/pypy/pypy/changeset/87910b468690/ Log:merge default diff too long, truncating to 2000 out of 10648 lines diff --git a/_pytest/__init__.py b/_pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.4.dev2' +__version__ = '2.5.2' diff --git a/_pytest/_argcomplete.py b/_pytest/_argcomplete.py new file mode 100644 --- /dev/null +++ b/_pytest/_argcomplete.py @@ -0,0 +1,104 @@ + +allow bash-completion for argparse with argcomplete if installed +needs argcomplete=0.5.6 for python 3.2/3.3 (older versions fail +to find the magic string, so _ARGCOMPLETE env. var is never set, and +this does not need special code. + +argcomplete does not support python 2.5 (although the changes for that +are minor). + +Function try_argcomplete(parser) should be called directly before +the call to ArgumentParser.parse_args(). + +The filescompleter is what you normally would use on the positional +arguments specification, in order to get dirname/ after dirnTAB +instead of the default dirname : + + optparser.add_argument(Config._file_or_dir, nargs='*' + ).completer=filescompleter + +Other, application specific, completers should go in the file +doing the add_argument calls as they need to be specified as .completer +attributes as well. (If argcomplete is not installed, the function the +attribute points to will not be used). + +SPEEDUP +=== +The generic argcomplete script for bash-completion +(/etc/bash_completion.d/python-argcomplete.sh ) +uses a python program to determine startup script generated by pip. +You can speed up completion somewhat by changing this script to include + # PYTHON_ARGCOMPLETE_OK +so the the python-argcomplete-check-easy-install-script does not +need to be called to find the entry point of the code and see if that is +marked with PYTHON_ARGCOMPLETE_OK + +INSTALL/DEBUGGING += +To include this support in another application that has setup.py generated +scripts: +- add the line: +# PYTHON_ARGCOMPLETE_OK + near the top of the main python entry point +- include in the file calling parse_args(): +from _argcomplete import try_argcomplete, filescompleter + , call try_argcomplete just before parse_args(), and optionally add + filescompleter to the positional arguments' add_argument() +If things do not work right away: +- switch on argcomplete debugging with (also helpful when doing custom + completers): +export _ARC_DEBUG=1 +- run: +python-argcomplete-check-easy-install-script $(which appname) +echo $? + will echo 0 if the magic line has been found, 1 if not +- sometimes it helps to find early on errors using: +_ARGCOMPLETE=1 _ARC_DEBUG=1 appname + which should throw a KeyError: 'COMPLINE' (which is properly set by the + global argcomplete script). + + +import sys +import os +from glob import glob + +class FastFilesCompleter: +'Fast file completer class' +def __init__(self, directories=True): +self.directories = directories + +def __call__(self, prefix, **kwargs): +only called on non option completions +if os.path.sep in prefix[1:]: # +prefix_dir = len(os.path.dirname(prefix) + os.path.sep) +else: +prefix_dir = 0 +completion = [] +globbed = [] +if '*' not in prefix and '?' not in prefix: +if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash +globbed.extend(glob(prefix + '.*')) +prefix += '*' +globbed.extend(glob(prefix)) +for x in sorted(globbed): +if os.path.isdir(x): +x += '/' +# append stripping the prefix (like bash, not like compgen) +completion.append(x[prefix_dir:]) +return completion + +if os.environ.get('_ARGCOMPLETE'): +# argcomplete 0.5.6 is not compatible with python 2.5.6: print/with/format +if sys.version_info[:2] (2, 6): +sys.exit(1) +try: +import argcomplete.completers +except ImportError: +sys.exit(-1) +filescompleter = FastFilesCompleter() + +def try_argcomplete(parser): +argcomplete.autocomplete(parser) +else: +def try_argcomplete(parser): pass +filescompleter = None diff --git a/_pytest/assertion/__init__.py b/_pytest/assertion/__init__.py --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -3,7 +3,6 @@ import py import sys -import pytest from _pytest.monkeypatch import monkeypatch from _pytest.assertion import util @@ -19,8 +18,8 @@ to provide assert expression information. ) group.addoption('--no-assert', action=store_true, default=False, dest=noassert, help=DEPRECATED equivalent to --assert=plain) -group.addoption('--nomagic', action=store_true, default=False, -dest=nomagic,
[pypy-commit] pypy py3k: merge default
Author: Philip Jenvey pjen...@underboss.org Branch: py3k Changeset: r72757:2ccf30804e12 Date: 2014-08-11 17:13 -0700 http://bitbucket.org/pypy/pypy/changeset/2ccf30804e12/ Log:merge default diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -3,9 +3,8 @@ It uses 'pypy/goal/pypy-c' and parts of the rest of the working copy. Usage: -package.py [--options] +package.py [--options] pypy-VER-PLATFORM -Usually you would do: package.py --version-name pypy-VER-PLATFORM The output is found in the directory from --builddir, by default /tmp/usession-YOURNAME/build/. @@ -52,13 +51,18 @@ sep_template = \nThis copy of PyPy includes a copy of %s, which is licensed under the following terms:\n\n -def generate_license_linux(basedir, options): +def generate_license(basedir, options): base_file = str(basedir.join('LICENSE')) with open(base_file) as fid: txt = fid.read() -searches = [(bzip2,libbz2-*, copyright, '-'), -(openssl, openssl*, copyright, 'LICENSE ISSUES'), - ] +if sys.platform == 'win32': +# shutil.copyfileobj(open(crtlicense.txt), out) # We do not ship +# msvc runtime files, but otherwise we'd need this on Windows +searches = [(bzip2,bzip2-*, LICENSE, ''), +(openssl, openssl-*, LICENSE, '')] +else: +searches = [(bzip2,libbz2-*dev, copyright, '-'), +(openssl, openssl*, copyright, 'LICENSE ISSUES')] if not options.no_tk: name = 'Tcl/Tk' txt += License for '%s' %name @@ -73,9 +77,9 @@ txt += sep_template % name dirs = glob.glob(options.license_base + / +pat) if not dirs: -raise ValueError, Could not find + options.license_base + / + pat -if len(dirs) 2: -raise ValueError, Multiple copies of +pat +raise ValueError, Could not find %s/%s % (options.license_base, pat) +if len(dirs) 1: +raise ValueError, Multiple copies of %r: %r % (pat, dirs) dir = dirs[0] with open(os.path.join(dir, fname)) as fid: # Read up to the line dividing the packaging header from the actual copyright @@ -92,43 +96,6 @@ txt += gdbm_bit return txt -def generate_license_windows(basedir, options): -base_file = str(basedir.join('LICENSE')) -with open(base_file) as fid: -txt = fid.read() -# shutil.copyfileobj(open(crtlicense.txt), out) # We do not ship msvc runtime files -if not options.no_tk: -name = 'Tcl/Tk' -txt += License for '%s' %name -txt += '\n' + =*(14 + len(name)) + '\n' -txt += sep_template % name -base_file = str(basedir.join('lib_pypy/_tkinter/license.terms')) -with open(base_file, 'r') as fid: -txt += fid.read() -for name, pat, file in ((bzip2,bzip2-*, LICENSE), - (openssl, openssl-*, LICENSE)): -txt += sep_template % name -dirs = glob.glob(options.license_base + / +pat) -if not dirs: -raise ValueError, Could not find + options.license_base + / + pat -if len(dirs) 2: -raise ValueError, Multiple copies of +pat -dir = dirs[0] -with open(os.path.join(dir, file)) as fid: -txt += fid.read() -return txt - -def generate_license_darwin(basedir, options): -# where are copyright files on macos? -return generate_license_linux(basedir, options) - -if sys.platform == 'win32': -generate_license = generate_license_windows -elif sys.platform == 'darwin': -generate_license = generate_license_darwin -else: -generate_license = generate_license_linux - def create_cffi_import_libraries(pypy_c, options): modules = ['_sqlite3'] subprocess.check_call([str(pypy_c), '-c', 'import _sqlite3']) @@ -406,7 +373,9 @@ The _gdbm module includes code from gdbm.h, which is distributed under the terms -of the GPL license version 2 or any later version. +of the GPL license version 2 or any later version. Thus the _gdbm module, provided in +the file lib_pypy/_gdbm.py, is redistributed under the terms of the GPL license as +well. ''' ___ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit