[pypy-commit] pypy default: backport changes from py3.6 to minimize diff

mattip pypy.commits at gmail.com
Wed Nov 13 10:26:20 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r98043:65f80b74784f
Date: 2019-11-13 07:51 -0500
http://bitbucket.org/pypy/pypy/changeset/65f80b74784f/

Log:	backport changes from py3.6 to minimize diff

diff --git a/pypy/tool/build_cffi_imports.py b/pypy/tool/build_cffi_imports.py
--- a/pypy/tool/build_cffi_imports.py
+++ b/pypy/tool/build_cffi_imports.py
@@ -24,7 +24,19 @@
 # the OS, such as a recent openssl/libressl.
 curdir = os.path.abspath(os.path.dirname(__file__))
 deps_destdir = os.path.join(curdir, 'dest')
+configure_args = ['./configure',
+            '--prefix=/usr',
+            '--disable-shared',
+            '--enable-silent-rules',
+            '--disable-dependency-tracking',
+        ]
 cffi_dependencies = {
+    'lzma': ('https://tukaani.org/xz/xz-5.2.3.tar.gz',
+             '71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb',
+             [configure_args,
+              ['make', '-s', '-j', str(multiprocessing.cpu_count())],
+              ['make', 'install', 'DESTDIR={}/'.format(deps_destdir)],
+             ]),
     '_ssl': ('https://www.openssl.org/source/openssl-1.1.1c.tar.gz',
              'f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90',
              [['./config', '--prefix=/usr', 'no-shared'],
@@ -33,7 +45,7 @@
              ]),
     '_gdbm': ('http://ftp.gnu.org/gnu/gdbm/gdbm-1.13.tar.gz',
               '9d252cbd7d793f7b12bcceaddda98d257c14f4d1890d851c386c37207000a253',
-             [['./config', '--without-readline'],
+              [configure_args,
               ['make', '-s', '-j', str(multiprocessing.cpu_count())],
               ['make', 'install', 'DESTDIR={}/'.format(deps_destdir)],
              ]),
@@ -176,8 +188,11 @@
             status, stdout, stderr = run_subprocess(str(pypy_c), args,
                                                     cwd=cwd, env=env)
             if status != 0:
-                print(stdout, stderr, file=sys.stderr)
                 failures.append((key, module))
+                print("stdout:")
+                print(stdout, file=sys.stderr)
+                print("stderr:")
+                print(stderr, file=sys.stderr)
         except:
             import traceback;traceback.print_exc()
             failures.append((key, module))
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
@@ -30,6 +30,8 @@
 
 STDLIB_VER = "2.7"
 
+POSIX_EXE = 'pypy'
+
 from pypy.tool.build_cffi_imports import (create_cffi_import_libraries,
         MissingDependenciesError, cffi_build_scripts)
 
@@ -71,7 +73,7 @@
 
     basedir = py.path.local(basedir)
     if not override_pypy_c:
-        basename = 'pypy-c'
+        basename = POSIX_EXE + '-c'
         if sys.platform == 'win32':
             basename += '.exe'
         pypy_c = basedir.join('pypy', 'goal', basename)
@@ -106,10 +108,13 @@
 
     if (sys.platform != 'win32' and    # handled below
         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.
+        # This 'pypy_c' is very small, so it means it relies on a so/dll
         # If it would be bigger, it wouldn't.  That's a hack.
-        libpypy_name = ('libpypy-c.so' if not sys.platform.startswith('darwin')
-                                       else 'libpypy-c.dylib')
+        if sys.platform.startswith('darwin'):
+            ext = 'dylib'
+        else:
+            ext = 'so'
+        libpypy_name = 'lib' + POSIX_EXE + '-c.' + ext
         libpypy_c = pypy_c.new(basename=libpypy_name)
         if not libpypy_c.check():
             raise PyPyCNotFound('Expected pypy to be mostly in %r, but did '
@@ -134,8 +139,9 @@
             tgt = py.path.local(tgt)
             binaries.append((pypyw, tgt.new(purebasename=tgt.purebasename + 'w').basename, None))
             print("Picking %s" % str(pypyw))
-        # Can't rename a DLL: it is always called 'libpypy-c.dll'
-        win_extras = [('libpypy-c.dll', None), ('sqlite3.dll', lib_pypy)]
+        # Can't rename a DLL
+        win_extras = [('lib' + POSIX_EXE + '-c.dll', None),
+                      ('sqlite3.dll', lib_pypy)]
         if not options.no_tk:
             tkinter_dir = lib_pypy.join('_tkinter')
             win_extras += [('tcl85.dll', tkinter_dir), ('tk85.dll', tkinter_dir)]
@@ -155,9 +161,7 @@
             print('Picking %s (and contents)' % libsdir)
             shutil.copytree(str(libsdir), str(pypydir.join('libs')))
         else:
-            print('"libs" dir with import library not found.')
-            print('You have to create %r' % (str(libsdir),))
-            print('and copy libpypy-c.lib in there, renamed to python27.lib')
+            raise RuntimError('"libs" dir with import library not found.')
             # XXX users will complain that they cannot compile capi (cpyext)
             # modules for windows, also embedding pypy (i.e. in cffi)
             # will fail.
@@ -223,6 +227,14 @@
         else:
             open(str(archive), 'wb').close()
         os.chmod(str(archive), 0755)
+    #if not _fake and not sys.platform == 'win32':
+    #    # create the pypy3 symlink
+    #    old_dir = os.getcwd()
+    #    os.chdir(str(bindir))
+    #    try:
+    #        os.symlink(POSIX_EXE, 'pypy3')
+    #    finally:
+    #        os.chdir(old_dir)
     fix_permissions(pypydir)
 
     old_dir = os.getcwd()
@@ -292,9 +304,9 @@
             setattr(ns, self.dest, option[2:4] != 'no')
 
     if sys.platform == 'win32':
-        pypy_exe = 'pypy.exe'
+        pypy_exe = POSIX_EXE + '.exe'
     else:
-        pypy_exe = 'pypy'
+        pypy_exe = POSIX_EXE
     parser = argparse.ArgumentParser()
     args = list(args)
     if args:
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
@@ -1,4 +1,4 @@
-
+import os
 import py
 from pypy import pypydir
 from pypy.tool.release import package
@@ -15,8 +15,8 @@
             cls.exe_name_in_archive = 'pypy-c.exe'
         else:
             basename = 'pypy-c'
-            cls.rename_pypy_c = 'pypy'
-            cls.exe_name_in_archive = 'bin/pypy'
+            cls.rename_pypy_c = package.POSIX_EXE
+            cls.exe_name_in_archive = os.path.join('bin', package.POSIX_EXE)
         cls.pypy_c = py.path.local(pypydir).join('goal', basename)
 
     def test_dir_structure(self, test='test'):
diff --git a/rpython/rlib/rstring.py b/rpython/rlib/rstring.py
--- a/rpython/rlib/rstring.py
+++ b/rpython/rlib/rstring.py
@@ -601,6 +601,11 @@
         assert i >= self.start
         self.i = i
         c = self.s[i]
+        if self.allow_underscores and c == '_':
+            i = self.i - 1
+            assert i >= 0
+            self.i = i
+            c = self.s[i]
         digit = ord(c)
         if '0' <= c <= '9':
             digit -= ord('0')
diff --git a/rpython/rlib/rwin32.py b/rpython/rlib/rwin32.py
--- a/rpython/rlib/rwin32.py
+++ b/rpython/rlib/rwin32.py
@@ -114,6 +114,7 @@
                        WC_NO_BEST_FIT_CHARS STD_INPUT_HANDLE STD_OUTPUT_HANDLE
                        STD_ERROR_HANDLE HANDLE_FLAG_INHERIT FILE_TYPE_CHAR
                        LOAD_WITH_ALTERED_SEARCH_PATH
+                       CP_ACP CP_UTF8 CP_UTF7 CP_OEMCP MB_ERR_INVALID_CHARS
                     """
         from rpython.translator.platform import host_factory
         static_platform = host_factory()


More information about the pypy-commit mailing list