diff options
author | 2020-09-08 15:53:45 +0300 | |
---|---|---|
committer | 2020-09-08 15:53:45 +0300 | |
commit | 3e5014879efe38c80d4a2be1761e4be90ab5a480 (patch) | |
tree | 79258246961046307164dcd48c25c31370760df1 | |
parent | fix packaging tool (diff) | |
download | pypy-release-pypy3.6-v7.3.2rc1.tar.gz pypy-release-pypy3.6-v7.3.2rc1.tar.bz2 pypy-release-pypy3.6-v7.3.2rc1.zip |
remerge packaging script from py3.6release-pypy3.6-v7.3.2rc1
-rwxr-xr-x | pypy/tool/release/package.py | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py index a5e0992ebb..d76ee64978 100755 --- a/pypy/tool/release/package.py +++ b/pypy/tool/release/package.py @@ -66,11 +66,14 @@ def fix_permissions(dirname): os.system("chmod -R g-w %s" % dirname) -def pypy_runs(pypy_c, quiet=False): - kwds = {} +def get_python_ver(pypy_c, quiet=False): + kwds = {'universal_newlines': True} if quiet: - kwds['stderr'] = subprocess.PIPE - return subprocess.call([str(pypy_c), '-c', 'pass'], **kwds) == 0 + kwds['stderr'] = subprocess.NULL + ver = subprocess.check_output([str(pypy_c), '-c', + 'import sysconfig as s; print(s.get_python_version())'], **kwds) + return ver.strip() + def create_package(basedir, options, _fake=False): retval = 0 @@ -95,8 +98,10 @@ def create_package(basedir, options, _fake=False): ' Please compile pypy first, using translate.py,' ' or check that you gave the correct path' ' with --override_pypy_c' % pypy_c) - if not _fake and not pypy_runs(pypy_c): - raise OSError("Running %r failed!" % (str(pypy_c),)) + if _fake: + python_ver = '3.6' + else: + python_ver = get_python_ver(pypy_c) if not options.no_cffi: failures = create_cffi_import_libraries( str(pypy_c), options, str(basedir), @@ -238,15 +243,16 @@ def create_package(basedir, options, _fake=False): shutil.copy(str(source), str(archive)) else: open(str(archive), 'wb').close() - os.chmod(str(archive), 0o755) - #if not _fake and not ARCH == 'win32': - # # create the pypy3 symlink - # old_dir = os.getcwd() - # os.chdir(str(bindir)) - # try: - # os.symlink(POSIX_EXE, 'pypy3') - # finally: - # os.chdir(old_dir) + os.chmod(str(archive), 0755) + if not _fake and not ARCH == 'win32': + # create a link to pypy, python + old_dir = os.getcwd() + os.chdir(str(bindir)) + try: + os.symlink(POSIX_EXE, 'pypy') + os.symlink(POSIX_EXE, 'pypy{}'.format(python_ver)) + finally: + os.chdir(old_dir) fix_permissions(pypydir) old_dir = os.getcwd() @@ -323,8 +329,6 @@ def package(*args, **kwds): args = list(args) if args: args[0] = str(args[0]) - else: - args.append('--help') for key, module in sorted(cffi_build_scripts.items()): if module is not None: parser.add_argument('--without-' + key, @@ -353,7 +357,8 @@ def package(*args, **kwds): '(default on OS X)') parser.add_argument('--make-portable', dest='make_portable', - action='store_true', + action=NegateAction, + default=(ARCH in ('darwin',)), help='make the package portable by shipping ' 'dependent shared objects and mangling RPATH') options = parser.parse_args(args) |