Author: Matti Picus <matti.pi...@gmail.com> Branch: py3.6 Changeset: r97475:f29a87447d84 Date: 2019-09-14 15:27 +0300 http://bitbucket.org/pypy/pypy/changeset/f29a87447d84/
Log: merge and fix build script 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 @@ -1,6 +1,7 @@ from __future__ import print_function import sys, shutil, os, tempfile, hashlib from os.path import join +import multiprocessing class MissingDependenciesError(Exception): pass @@ -24,17 +25,34 @@ } # for distribution, we may want to fetch dependencies not provided by -# the OS, such as a recent openssl/libressl or liblzma/xz. +# 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', - ['no-shared']), + 'f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90', + [['./config', 'no-shared'], + ['make', '-s', '-j', str(multiprocessing.cpu_count())], + ['make', 'install', 'DESTDIR={}/'.format(deps_destdir)], + ]), '_gdbm': ('http://ftp.gnu.org/gnu/gdbm/gdbm-1.13.tar.gz', '9d252cbd7d793f7b12bcceaddda98d257c14f4d1890d851c386c37207000a253', - ['--without-readline']), + [configure_args, + ['make', '-s', '-j', str(multiprocessing.cpu_count())], + ['make', 'install', 'DESTDIR={}/'.format(deps_destdir)], + ]), } @@ -60,8 +78,7 @@ return dgst.hexdigest() -def _build_dependency(name, destdir, patches=[]): - import multiprocessing +def _build_dependency(name, patches=[]): import shutil import subprocess @@ -73,7 +90,7 @@ from urllib import urlretrieve try: - url, dgst, args = cffi_dependencies[name] + url, dgst, build_cmds = cffi_dependencies[name] except KeyError: return 0, None, None @@ -91,13 +108,10 @@ # extract the archive into our destination directory print('unpacking archive', archive, file=sys.stderr) - _unpack_tarfile(archive, destdir) + _unpack_tarfile(archive, deps_destdir) - sources = os.path.join( - destdir, - os.path.basename(archive)[:-7], - ) - + sources = os.path.join(deps_destdir, os.path.basename(archive)[:-7]) + # apply any patches if patches: for patch in patches: @@ -108,44 +122,14 @@ if status != 0: return status, stdout, stderr - - print('configuring', sources, file=sys.stderr) - - # configure & build it - status, stdout, stderr = run_subprocess( - './config', - [ - '--prefix=/usr', - ] + args, - cwd=sources, - ) - - if status != 0: - return status, stdout, stderr - - print('building', sources, file=sys.stderr) - - status, stdout, stderr = run_subprocess( - 'make', - [ - '-s', '-j' + str(multiprocessing.cpu_count()), - ], - cwd=sources, - ) - if status != 0: - return status, stdout, stderr - - print('installing to', destdir, file=sys.stderr) - status, stdout, stderr = run_subprocess( - 'make', - [ - 'install', 'DESTDIR={}/'.format(destdir), - ], - cwd=sources, - ) + for args in build_cmds: + print('running', ' '.join(args), 'in', sources, file=sys.stderr) + status, stdout, stderr = run_subprocess(args[0], args[1:], + cwd=sources,) + if status != 0: + break return status, stdout, stderr - def create_cffi_import_libraries(pypy_c, options, basedir, only=None, embed_dependencies=False, rebuild=False): from rpython.tool.runsubprocess import run_subprocess @@ -183,13 +167,12 @@ print('*', ' '.join(args), file=sys.stderr) if embed_dependencies: - curdir = os.path.abspath(os.path.dirname(__file__)) - destdir = os.path.join(curdir, 'dest') + destdir = deps_destdir shutil.rmtree(destdir, ignore_errors=True) os.makedirs(destdir) - status, stdout, stderr = _build_dependency(key, destdir) + status, stdout, stderr = _build_dependency(key) if status != 0: failures.append((key, module)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit