diff -Nru pypy-7.3.1+dfsg/debian/changelog pypy-7.3.1+dfsg/debian/changelog --- pypy-7.3.1+dfsg/debian/changelog 2020-04-10 23:42:33.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/changelog 2020-04-23 02:39:53.000000000 +0000 @@ -1,11 +1,20 @@ -pypy (7.3.1+dfsg-1~ppa1~ubuntu14.04) trusty; urgency=medium +pypy (7.3.1+dfsg-2~ppa1~ubuntu14.04) trusty; urgency=medium - * Rebuild for PyPy PPA. + * Build for the PyPy PPA. * The python2 binary package didn't exist yet, use python. * Drop versioned provides, they require dpkg 1.17.11. * Drop stage1 build profile tags, they require dpkg 1.17.14. - -- Stefano Rivera Fri, 10 Apr 2020 16:42:33 -0700 + -- Stefano Rivera Wed, 22 Apr 2020 19:39:53 -0700 + +pypy (7.3.1+dfsg-2) unstable; urgency=medium + + * Point to the installed stdlib in the pypy-local sysconfig layout, to + support virtualenv 20. + * Build out autopkgtests a little. Test: cffi lib importability, local + package installation, virtualenvs, byte-compilation. + + -- Stefano Rivera Mon, 20 Apr 2020 15:35:45 -0700 pypy (7.3.1+dfsg-1) unstable; urgency=medium diff -Nru pypy-7.3.1+dfsg/debian/patches/distutils-install-layout pypy-7.3.1+dfsg/debian/patches/distutils-install-layout --- pypy-7.3.1+dfsg/debian/patches/distutils-install-layout 2020-04-10 19:33:52.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/patches/distutils-install-layout 2020-04-20 22:35:45.000000000 +0000 @@ -249,7 +249,7 @@ elif os.sep == '/': sitepackages.append(os.path.join(prefix, "lib", diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py -index 8f71ee7..85e7669 100644 +index 8f71ee7..6bfe991 100644 --- a/lib-python/2.7/sysconfig.py +++ b/lib-python/2.7/sysconfig.py @@ -36,6 +36,26 @@ _INSTALL_SCHEMES = { @@ -267,12 +267,12 @@ + 'data' : '{base}', + }, + 'pypy-local': { -+ 'stdlib': '{base}/../../local/lib/pypy{py_version_short}/lib-python', -+ 'platstdlib': '{base}/../../local/lib/pypy{py_version_short}/lib-python', ++ 'stdlib': '{base}/lib-python/{py_version_short}', ++ 'platstdlib': '{base}/lib-python/{py_version_short}', + 'purelib': '{base}/../../local/lib/pypy{py_version_short}/lib-python', + 'platlib': '{base}/../../local/lib/pypy{py_version_short}/lib-python', -+ 'include': '{base}/../../local/include', -+ 'platinclude': '{base}/../../local/include', ++ 'include': '{base}/include', ++ 'platinclude': '{base}/include', + 'scripts': '{base}/../../local/bin', + 'data' : '{base}/../../local', + }, diff -Nru pypy-7.3.1+dfsg/debian/tests/byte-compilation pypy-7.3.1+dfsg/debian/tests/byte-compilation --- pypy-7.3.1+dfsg/debian/tests/byte-compilation 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/byte-compilation 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,45 @@ +#!/bin/sh + +base="$AUTOPKGTEST_TMP/module" +tag=$(pypy -c 'import imp; print(imp.get_tag())') + +setUp() { + mkdir -p $base/a + touch $base/a/__init__.py + touch $base/a/a_impl.py + touch $base/b.py +} + +tearDown() { + rm -rf "$base" +} + +testDirectory() { + pypycompile "$base" + assertTrue $? + assertTrue 'base __pycache__ exists' "[ -d $base/__pycache__ ]" + assertTrue 'a __pycache__ exists' "[ -d $base/a/__pycache__ ]" + assertTrue 'b compiled' "[ -f $base/__pycache__/b.$tag.pyc ]" + assertTrue 'a compiled' "[ -f $base/a/__pycache__/__init__.$tag.pyc ]" + assertTrue 'a.a_impl compiled' "[ -f $base/a/__pycache__/a_impl.$tag.pyc ]" + + pypyclean "$base" + assertTrue $? + assertTrue 'base __pycache__ cleaned' "[ ! -d $base/__pycache__ ]" + assertTrue 'a __pycache__ cleaned' "[ ! -d $base/a/__pycache__ ]" + assertTrue 'b cleaned' "[ ! -f $base/__pycache__/b.$tag.pyc ]" + assertTrue 'a cleaned' "[ ! -f $base/a/__pycache__/__init__.$tag.pyc ]" + assertTrue 'a.a_impl cleaned' "[ ! -f $base/a/__pycache__/a_impl.$tag.pyc ]" +} + +testDirectoryExclude() { + pypycompile "$base" -X '.*_impl' + assertTrue $? + assertTrue 'base __pycache__ exists' "[ -d $base/__pycache__ ]" + assertTrue 'a __pycache__ exists' "[ -d $base/a/__pycache__ ]" + assertTrue 'b compiled' "[ -f $base/__pycache__/b.$tag.pyc ]" + assertTrue 'a compiled' "[ -f $base/a/__pycache__/__init__.$tag.pyc ]" + assertTrue 'a.a_impl NOT compiled' "[ ! -f $base/a/__pycache__/a_impl.$tag.pyc ]" +} + +. shunit2 diff -Nru pypy-7.3.1+dfsg/debian/tests/command-line pypy-7.3.1+dfsg/debian/tests/command-line --- pypy-7.3.1+dfsg/debian/tests/command-line 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/command-line 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,56 @@ +#!/bin/sh + +# Superficial execution tests + +testPrintFromStdin() { + stdout=$(echo 'print("Hello")' | pypy) + assertEquals 'Execute code from stdin' Hello "$stdout" +} + +testPrintFromMinusC() { + stdout=$(pypy -c 'print("Hello")') + assertEquals 'Execute code from -c' Hello "$stdout" +} + +# Stdlib + +testImportStdLib() { + pypy -c 'import os.path' + assertTrue 'Import os.path' $? +} + +testImportTk() { + # Tkinter's cffi library lives in a separate binary package, to keep + # Depends manageable. Check that we point users to it. + if dpkg-query -f '${db:Status-Abbrev}\n' -W pypy-tk | grep -q ^.i; then + # autopkgtest can't Conflict, so we just skip if it's present + startSkipping + fi + stderr=$(pypy -c 'import Tkinter' 2>&1) + assertFalse 'Fail to import Tk when not installed' $? + echo "$stderr" | grep -Fq 'please install the pypy-tk package' + assertTrue 'Suggest installing pypy-tk' $? +} + +testImportCFFI() { + # Are all the modules that use cffi importable? + # They're built separately, and often link to shared libs + pypy -c 'import audioop' + assertTrue 'Import audioop' $? + pypy -c 'import curses' + assertTrue 'Import curses' $? + pypy -c 'import gdbm' + assertTrue 'Import gdbm' $? + pypy -c 'import pwd, grp' + assertTrue 'Import pwd, grp' $? + pypy -c 'import ssl' + assertTrue 'Import ssl' $? + pypy -c 'import resource' + assertTrue 'Import resource' $? + pypy -c 'import sqlite3' + assertTrue 'Import sqlite3' $? + pypy -c 'import syslog' + assertTrue 'Import syslog' $? +} + +. shunit2 diff -Nru pypy-7.3.1+dfsg/debian/tests/control pypy-7.3.1+dfsg/debian/tests/control --- pypy-7.3.1+dfsg/debian/tests/control 2020-04-10 19:33:52.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/control 2020-04-20 22:35:45.000000000 +0000 @@ -1,15 +1,20 @@ -Test-Command: echo 'print "Hello"' | pypy | grep Hello -Depends: pypy -Restrictions: superficial +Tests: byte-compilation +Depends: pypy, shunit2 -Test-Command: pypy -c 'print "Hello"' | grep Hello -Depends: pypy +Tests: command-line +Depends: pypy, shunit2 Restrictions: superficial -Test-Command: pypy -c 'import os.path' -Depends: pypy +Tests: pypy-tk +Depends: pypy-tk, shunit2 Restrictions: superficial -Test-Command: pypy -c 'import Tkinter' -Depends: pypy-tk -Restrictions: superficial +Tests: module-install-local +Depends: build-essential, pypy-dev, pypy-setuptools, shunit2 +Restrictions: needs-root + +Tests: module-install-user +Depends: build-essential, pypy-dev, pypy-setuptools, shunit2 + +Tests: module-install-virtualenv +Depends: build-essential, pypy-dev, shunit2, virtualenv diff -Nru pypy-7.3.1+dfsg/debian/tests/module-install-local pypy-7.3.1+dfsg/debian/tests/module-install-local --- pypy-7.3.1+dfsg/debian/tests/module-install-local 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/module-install-local 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,43 @@ +#!/bin/sh + +cp -a debian/tests/packages "$AUTOPKGTEST_TMP" + +setUp() { + mount -t tmpfs tmpfs /usr/local/lib/pypy2.7/dist-packages +} + +tearDown() { + umount /usr/local/lib/pypy2.7/dist-packages +} + +testFibPy() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + pypy setup.py install + assertTrue 'Install fibpy in /usr/local' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -m fibpy 5) + assertTrue 'Execute fibpy from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibC() { + cd "$AUTOPKGTEST_TMP/packages/fibc" + pypy setup.py install + assertTrue 'Install fibc in /usr/local' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -c 'from fibc import fib; print(fib(5))') + assertTrue 'Execute fibc from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibCFFI() { + cd "$AUTOPKGTEST_TMP/packages/fibcffi" + pypy setup.py install + assertTrue 'Install fibcffi in /usr/local' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -m fibcffi 5) + assertTrue 'Execute fibcffi from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +. shunit2 diff -Nru pypy-7.3.1+dfsg/debian/tests/module-install-user pypy-7.3.1+dfsg/debian/tests/module-install-user --- pypy-7.3.1+dfsg/debian/tests/module-install-user 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/module-install-user 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,43 @@ +#!/bin/sh + +cp -a debian/tests/packages "$AUTOPKGTEST_TMP" + +HOME="$AUTOPKGTEST_TMP/home" +mkdir "$HOME" + +tearDown() { + # Remove the --user install directory + rm -rf "$HOME/.local/lib/pypy2.7/site-packages" +} + +testFibPy() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + pypy setup.py install --user + assertTrue 'Install fibpy in --user' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -m fibpy 5) + assertTrue 'Execute fibpy from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibC() { + cd "$AUTOPKGTEST_TMP/packages/fibc" + pypy setup.py install --user + assertTrue 'Install fibc in --user' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -c 'from fibc import fib; print(fib(5))') + assertTrue 'Execute fibc from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibCFFI() { + cd "$AUTOPKGTEST_TMP/packages/fibcffi" + pypy setup.py install --user + assertTrue 'Install fibcffi in --user' $? + cd "$AUTOPKGTEST_TMP" + stdout=$(pypy -m fibcffi 5) + assertTrue 'Execute fibcffi from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +. shunit2 diff -Nru pypy-7.3.1+dfsg/debian/tests/module-install-virtualenv pypy-7.3.1+dfsg/debian/tests/module-install-virtualenv --- pypy-7.3.1+dfsg/debian/tests/module-install-virtualenv 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/module-install-virtualenv 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,40 @@ +#!/bin/sh + +cp -a debian/tests/packages "$AUTOPKGTEST_TMP" +HOME="$AUTOPKGTEST_TMP/home" +mkdir -p "$HOME" +virtualenv -p pypy "$AUTOPKGTEST_TMP/pypyve" + +VP="$AUTOPKGTEST_TMP/pypyve/bin/python" + +testFibPy() { + cd "$AUTOPKGTEST_TMP/packages/fibpy" + $VP setup.py install + assertTrue 'Install fibpy in a virtualenv' $? + cd "$AUTOPKGTEST_TMP" + stdout=$($VP -m fibpy 5) + assertTrue 'Execute fibpy from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibC() { + cd "$AUTOPKGTEST_TMP/packages/fibc" + $VP setup.py install + assertTrue 'Install fibc in a virtualenv' $? + cd "$AUTOPKGTEST_TMP" + stdout=$($VP -c 'from fibc import fib; print(fib(5))') + assertTrue 'Execute fibc from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +testFibCFFI() { + cd "$AUTOPKGTEST_TMP/packages/fibcffi" + $VP setup.py install + assertTrue 'Install fibcffi in a virtualenv' $? + cd "$AUTOPKGTEST_TMP" + stdout=$($VP -m fibcffi 5) + assertTrue 'Execute fibcffi from a virtualenv' $? + assertEquals 'Correct result' 8 "$stdout" +} + +. shunit2 diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibc/fibc.c pypy-7.3.1+dfsg/debian/tests/packages/fibc/fibc.c --- pypy-7.3.1+dfsg/debian/tests/packages/fibc/fibc.c 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibc/fibc.c 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,30 @@ +#include + +int fib(int n) { + if (n < 0) { + return -1; // Raise + } + if (n < 2) { + return 1; + } + return fib(n - 1) + fib(n - 2); +} + +static PyObject * fibc_fib(PyObject *self, PyObject *args) { + int sts; + int n; + + if (!PyArg_ParseTuple(args, "i", &n)) + return NULL; + int r = fib(n); + return Py_BuildValue("i", r); +} + +static PyMethodDef FibcMethods[] = { + {"fib", fibc_fib, METH_VARARGS, "Calculate a fibonacci sequence value."}, + {NULL, NULL, 0, NULL}, +}; + +PyMODINIT_FUNC initfibc(void) { + (void) Py_InitModule("fibc", FibcMethods); +}; diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibc/setup.py pypy-7.3.1+dfsg/debian/tests/packages/fibc/setup.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibc/setup.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibc/setup.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +from setuptools import setup, Extension + +setup( + name='fibc', + version='42.0.0', + description='C Fibonacci', + ext_modules=[Extension( + 'fibc', + sources=['fibc.c'], + )], + zip_safe=True, +) diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi_build.py pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi_build.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi_build.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi_build.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,25 @@ +#!/usr/bin/env python +from cffi import FFI + + +ffibuilder = FFI() +ffibuilder.set_source('_fib', + """ + int fib(int n) { + if (n < 0) { + return -1; // Raise + } + if (n < 2) { + return 1; + } + return fib(n - 1) + fib(n - 2); + } + """, + libraries=[]) +ffibuilder.cdef(""" + int fib(int n); +""") + + +if __name__ == '__main__': + ffibuilder.compile(verbose=True) diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi.py pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/fibcffi.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,7 @@ +import sys + +from _fib import lib + + +if __name__ == '__main__': + print(lib.fib(int(sys.argv[1]))) diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/setup.py pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/setup.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/setup.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibcffi/setup.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from setuptools import setup + +setup( + name='fibcffi', + version='42.0.0', + description='CFFI Fibonacci', + py_modules=['fibcffi'], + cffi_modules=['fibcffi_build.py:ffibuilder'], + zip_safe=True, +) diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibpy/fibpy.py pypy-7.3.1+dfsg/debian/tests/packages/fibpy/fibpy.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibpy/fibpy.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibpy/fibpy.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,13 @@ +import sys + + +def fib(n): + if n < 0: + raise ValueError() + if n < 2: + return 1 + return fib(n - 1) + fib(n - 2) + + +if __name__ == '__main__': + print(fib(int(sys.argv[1]))) diff -Nru pypy-7.3.1+dfsg/debian/tests/packages/fibpy/setup.py pypy-7.3.1+dfsg/debian/tests/packages/fibpy/setup.py --- pypy-7.3.1+dfsg/debian/tests/packages/fibpy/setup.py 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/packages/fibpy/setup.py 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from setuptools import setup + +setup( + name='fibpy', + version='42.0.0', + description='Pure Python Fibonacci', + py_modules=['fibpy'], + zip_safe=True, +) diff -Nru pypy-7.3.1+dfsg/debian/tests/pypy-tk pypy-7.3.1+dfsg/debian/tests/pypy-tk --- pypy-7.3.1+dfsg/debian/tests/pypy-tk 1970-01-01 00:00:00.000000000 +0000 +++ pypy-7.3.1+dfsg/debian/tests/pypy-tk 2020-04-20 22:35:45.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/sh + +testImportTk() { + pypy -c 'import Tkinter' + assertTrue 'Tkinter is importable' $? +} + +. shunit2