Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r77553:e6c259d25dc6 Date: 2015-05-25 21:22 +0200 http://bitbucket.org/pypy/pypy/changeset/e6c259d25dc6/
Log: Fix the test by adding a _fake option that doesn't rely on a pypy-c and libpypy-c.so to be actually built 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 @@ -89,7 +89,7 @@ kwds['stderr'] = subprocess.PIPE return subprocess.call([str(pypy_c), '-c', 'pass'], **kwds) == 0 -def create_package(basedir, options): +def create_package(basedir, options, _fake=False): retval = 0 name = options.name if not name: @@ -105,13 +105,13 @@ pypy_c = basedir.join('pypy', 'goal', basename) else: pypy_c = py.path.local(override_pypy_c) - if not pypy_c.check(): + if not _fake and not pypy_c.check(): raise PyPyCNotFound( 'Expected but did not find %s.' ' Please compile pypy first, using translate.py,' ' or check that you gave the correct path' ' with --override_pypy_c' % pypy_c) - if not pypy_runs(pypy_c): + if not _fake and not pypy_runs(pypy_c): raise OSError("Running %r failed!" % (str(pypy_c),)) if not options.no_cffi: try: @@ -124,7 +124,7 @@ binaries = [(pypy_c, rename_pypy_c)] if (sys.platform != 'win32' and # handled below - os.path.getsize(str(pypy_c)) < 500000): + not _fake and os.path.getsize(str(pypy_c)) < 500000): # This pypy-c is very small, so it means it relies on libpypy_c.so. # If it would be bigger, it wouldn't. That's a hack. libpypy_name = ('libpypy-c.so' if not sys.platform.startswith('darwin') @@ -227,7 +227,11 @@ bindir.ensure(dir=True) for source, target in binaries: archive = bindir.join(target) - shutil.copy(str(source), str(archive)) + if not _fake: + shutil.copy(str(source), str(archive)) + else: + open(str(archive), 'wb').close() + os.chmod(str(archive), 0755) fix_permissions(pypydir) old_dir = os.getcwd() @@ -276,7 +280,7 @@ print "Ready in %s" % (builddir,) return retval, builddir # for tests -def package(*args): +def package(*args, **kwds): try: import argparse except ImportError: @@ -337,7 +341,7 @@ from rpython.tool.udir import udir options.builddir = udir.ensure("build", dir=True) assert '/' not in options.pypy_c - return create_package(basedir, options) + return create_package(basedir, options, **kwds) if __name__ == '__main__': diff --git a/pypy/tool/release/test/test_package.py b/pypy/tool/release/test/test_package.py --- a/pypy/tool/release/test/test_package.py +++ b/pypy/tool/release/test/test_package.py @@ -16,25 +16,10 @@ rename_pypy_c = 'pypy' exe_name_in_archive = 'bin/pypy' pypy_c = py.path.local(pypydir).join('goal', basename) - if not pypy_c.check(): - if sys.platform == 'win32': - import os, shutil - for d in os.environ['PATH'].split(';'): - if os.path.exists(os.path.join(d, 'cmd.exe')): - shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c)) - break - else: - assert False, 'could not find cmd.exe' - else: - pypy_c.write("#!/bin/sh") - pypy_c.chmod(0755) - fake_pypy_c = True - else: - fake_pypy_c = False try: retval, builddir = package.package( '--without-cffi', str(py.path.local(pypydir).dirpath()), - test, rename_pypy_c) + test, rename_pypy_c, _fake=True) assert retval == 0 prefix = builddir.join(test) cpyver = '%d.%d' % CPYTHON_VERSION[:2] @@ -79,8 +64,7 @@ check_include('pypy_decl.h') check_include('numpy/arrayobject.h') finally: - if fake_pypy_c: - pypy_c.remove() + pass # to keep the indentation def test_with_zipfile_module(): prev = package.USE_ZIPFILE_MODULE _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit