+commit 7e571ea62074243eef36110c240e192e5682a687
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Mar 1 17:57:08 2018 +0100
+
+ release
+
+ NEWS | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+commit 1138bc7e0aeb8d4e7354c6cfd5a63edaa724d3fb
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Tue Feb 27 12:46:11 2018 +0100
+
+ setup.py: fix distcheck
+
+ MANIFEST.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 79ee93ea667c7a2cdacf9c770c0e60dc624ced0b
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 23 18:15:55 2018 +0100
+
+ coverage: exclude external headers. See #168
+
+ While we could just pass --no-external we want the coverage of
+ the gobject-introspection files.
+
+ .gitlab-ci/coverage-docker.sh | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+commit 9ae49b49850dca86566b745966104bdd33914df7
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 23 17:33:55 2018 +0100
+
+ coverage.py: ignore errors
+
+ not sure where that path is comming from, it worked in the MR..
+
+ .gitlab-ci/coverage-docker.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 2d812a6bc4d0952997a3ed3c63c4b09d8c95c103
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 23 11:02:03 2018 +0100
+
+ gitlab-ci: Add Windows coverage support. See #168
+
+ Use coverage.py and cygwin lcov to generate coverage files.
+ In the report generation step fixup the Windows paths in the coverage
+ files to match the Linux/Docker ones.
+
+ .gitlab-ci.yml | 42
+ +++++++++++++++++++++++++++---------------
+ .gitlab-ci/coverage-docker.sh | 3 +++
+ .gitlab-ci/fixup-cov-paths.py | 35 +++++++++++++++++++++++++++++++++++
+ .gitlab-ci/test-docker.sh | 5 +++++
+ .gitlab-ci/test-msys2.sh | 33 +++++++++++++++++++++++++++++++--
+ 5 files changed, 101 insertions(+), 17 deletions(-)
+
+commit 1534289ce5934b73b5c980f8e246192009337776
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Tue Feb 20 16:38:25 2018 +0100
+
+ gitlab-ci: Add MSYS2 test jobs
+
+ This assumes a gitlab runner with a "win32" tag which has
+ MSYS2 installed in the default path and uses the "cmd" shell.
+
+ .gitlab-ci.yml | 32 +++++++++++++++++++++++++++-----
+ .gitlab-ci/test-msys2.sh | 28 ++++++++++++++++++++++++++++
+ 2 files changed, 55 insertions(+), 5 deletions(-)
+
+commit 20fa66387020877a3ae20a6b48bba52153c7bd6c
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Tue Feb 20 18:17:15 2018 +0100
+
+ tests: skip one more GdkAtom test on Windows
+
+ This has started to crash with newer gtk
+
+ tests/test_atoms.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+commit d3cd49ce8777312cbb91b82bd076c0e4b761c848
+Merge: 5ec1aea8 aab23dbd
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sun Feb 18 08:32:22 2018 +0000
+
+ Merge branch 'gilabissue123' into 'master'
+
+ Performance improvements to avoid GIL congestion
+
+ See merge request GNOME/pygobject!13
+
+commit 5ec1aea8ab4599a7a0945bd5754ce79c7c5cbef3
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Feb 17 18:13:47 2018 +0100
+
+ coverage: don't just use the major python version number for coverage
+ files names
+
+ all py3 jobs wrote to the same file, oops..
+
+ .gitlab-ci/test-docker.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit af7aa11acebd9a34e6aee41dc77c0d7c3000fd47
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Feb 17 15:23:49 2018 +0100
+
+ gitlab-ci: Add coverage reports
+
+ Use gcov/lcov and coverage.py; merge all results and provide
+ the final html reports as job artifacts.
+
+ .gitignore | 1 +
+ .gitlab-ci.yml | 18 ++++++++++++++++++
+ .gitlab-ci/Dockerfile | 1 +
+ .gitlab-ci/coverage-docker.sh | 17 +++++++++++++++++
+ .gitlab-ci/test-docker.sh | 20 ++++++++++++++++----
+ setup.cfg | 7 +++++++
+ 6 files changed, 60 insertions(+), 4 deletions(-)
+
+commit 8df9570b7f25ceaaa590c8da33952a7bdeade203
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Fri Feb 16 16:54:06 2018 +0100
+
+ array, list: always run items cleanup funcs
+
+ gi/pygi-array.c | 70
+ ++++++++++++++++++++++++++++++++-------------------------
+ gi/pygi-list.c | 37 +++++++++++++++---------------
+ 2 files changed, 58 insertions(+), 49 deletions(-)
+
+commit 9978b521450d9b2a038d48492550dcab49c7b113
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Fri Feb 16 00:49:25 2018 +0100
+
+ pygi-struct-marshal: perform boxed copy ...
+
+ when the cleanup marshaller will not be called, that is when
+ marshalling something that is not actually an argument.
+
+ Fixes #164
+
+ gi/pygi-struct-marshal.c | 48
+ ++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 32 insertions(+), 16 deletions(-)
+
+commit e41dd91e9e62eeaeaa0fee97b50500591a87b249
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Thu Feb 15 23:32:37 2018 +0100
+
+ Revert "Revert "to python struct marshalling: copy boxed during
+ cleanup""
+
+ This reverts commit 10c062001ddd948b0a70545cbf613b38ed6fa46c.
+
+ gi/pygi-struct-marshal.c | 34 +++++++++++++++++++++++++++-------
+ tests/test_gi.py | 1 -
+ 2 files changed, 27 insertions(+), 8 deletions(-)
+
+commit b1d1c8d9d8820fe405bddd8e9dea88b5ec2fcce2
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Thu Feb 15 23:32:20 2018 +0100
+
+ Revert "Revert "to python marshalling: collect cleanup data""
+
+ This reverts commit fa555767464fbe551b14cfbc121febc5290b1371.
+
+ gi/pygi-array.c | 24 ++++++++++++++++++------
+ gi/pygi-basictype.c | 8 +++++---
+ gi/pygi-basictype.h | 3 ++-
+ gi/pygi-cache.h | 13 ++++++++++---
+ gi/pygi-closure.c | 9 +++++++--
+ gi/pygi-enum-marshal.c | 6 ++++--
+ gi/pygi-error.c | 3 ++-
+ gi/pygi-hashtable.c | 13 +++++++++----
+ gi/pygi-invoke-state-struct.h | 3 +++
+ gi/pygi-invoke.c | 17 +++++++++++++----
+ gi/pygi-list.c | 38 +++++++++++++++++++++++++++++++-------
+ gi/pygi-marshal-cleanup.c | 13 ++++++++-----
+ gi/pygi-object.c | 8 +++++---
+ gi/pygi-struct-marshal.c | 5 +++--
+ 14 files changed, 120 insertions(+), 43 deletions(-)
+
+commit 26b7fc3fee55870cc944b0f718da8a75c75f4eae
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Fri Feb 16 00:45:40 2018 +0100
+
+ Revert "Revert "pygi-boxed: make in-place copy safer""
+
+ This reverts commit 700c785367975995d24a8ffd00b2aa028ccf77e8.
+
+ gi/pygi-boxed.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+commit d08e244d011121f8ffd5c21437e0f11fe9545bbf
+Author: Mathieu Duponchelle <mathieu@centricular.com>
+Date: Thu Feb 15 23:32:08 2018 +0100
+
+ Revert "Revert "Revert "Refactor boxed wrapper memory management
+ strategy"""
+
+ This reverts commit a506d5e3c64321c43a4ce7c2a72ca8d36e985999.
+
+ gi/gimodule.c | 6 +---
+ gi/overrides/GLib.py | 4 +++
+ gi/overrides/GObject.py | 3 --
+ gi/pygi-boxed.c | 32 +++++---------------
+ gi/pygi-boxed.h | 4 +--
+ gi/pygi-property.c | 6 +++-
+ gi/pygi-source.c | 6 ++--
+ gi/pygi-struct-marshal.c | 78
+ ++++--------------------------------------------
+ tests/test_gi.py | 1 +
+ tests/test_source.py | 8 ++---
+ 10 files changed, 29 insertions(+), 119 deletions(-)
+
+commit c56b4510649dae58519681c1a53aed85d598139e
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 16 17:43:00 2018 +0100
+
+ tests: add tests for boxed in GLists. See !24
+
+ tests/regressextra.c | 33 +++++++++++++++++++++++++++++++++
+ tests/regressextra.h | 4 ++++
+ tests/test_everything.py | 16 ++++++++++++++++
+ 3 files changed, 53 insertions(+)
+
+commit 9c3cb6b49c33f53d637e80aad68a67e89d0eb944
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 16 10:12:42 2018 +0100
+
+ gitlab-ci: use ccache
+
+ .gitlab-ci.yml | 9 +++++++++
+ .gitlab-ci/Dockerfile | 3 +++
+ .gitlab-ci/run-docker.sh | 6 ++++--
+ 3 files changed, 16 insertions(+), 2 deletions(-)
+
+commit 91a25c2aa1776e5e5757dc317a798615c31b3854
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 16 09:59:31 2018 +0100
+
+ tests: Add a test for a out transfer-none boxed array
+
+ Makes sure we copy the array items as well.
+
+ tests/regressextra.c | 18 ++++++++++++++++++
+ tests/regressextra.h | 3 +++
+ tests/test_everything.py | 6 ++++++
+ 3 files changed, 27 insertions(+)
+
+commit e00e38f9c44568f7fab643a069f86c576011ddcc
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 16 08:49:38 2018 +0100
+
+ tests: add a pytest hook for handling unhandled exception in closures
+
+ In PyGObject when an exception is raised in a closure called from
+ C then
+ the error gets passed to sys.excepthook (on the main thread at least)
+ and the error is by default printed to stdout. Since pytest by default
+ hides stdout, errors can be easily missed now.
+
+ To make these errors more visible add a test wrapper which checks
+ sys.excepthook for unhandled exceptions and reraises them.
+ This makes the tests fail and as a bonus also shows the right
+ stack trace instead of just the error message.
+
+ tests/Makefile.am | 1 +
+ tests/compathelper.py | 5 +++++
+ tests/conftest.py | 31 +++++++++++++++++++++++++++++++
+ tests/test_glib.py | 13 +++++++++++++
+ tests/test_mainloop.py | 28 ++++++++--------------------
+ tests/test_option.py | 18 +++++++-----------
+ 6 files changed, 65 insertions(+), 31 deletions(-)
+
+commit aae383cf44ee3eabcc4b4122049ea277524d5001
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Wed Feb 14 02:15:54 2018 +0100
+
+ version bump
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
commit 9c1d66be67008604206e336a0433c5cdf824b837
Author: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed Feb 14 01:47:12 2018 +0100
tests/test_everything.py | 31 +++++++++++++++++++++++++++++
5 files changed, 106 insertions(+), 3 deletions(-)
+commit aab23dbdb38c5c316c1939410e0301aa8b262143
+Author: Mikhail Fludkov <fludkov.me@gmail.com>
+Date: Wed Feb 7 16:03:42 2018 +0100
+
+ gi/pygtype.c: avoid GIL congestion in pyg_type_lookup
+
+ https://gitlab.gnome.org/GNOME/pygobject/issues/123
+
+ GIL congestion can be caused when many threads emit signals with
+ objects of
+ boxed type up to Python. The code in pyg_type_lookup imports a
+ python module
+ corresponding to gtype, which is expensive and can cause GIL
+ congestion. What
+ the proposed patch of pyg_type_lookup does:
+
+ - pygi_type_import_by_g_type is called only once per a gtype
+ - early NULL return. For example GStreamer types benefit greatly
+ from it.
+ Because pyg_register_gtype_custom is not used and pyg_type_lookup
+ always
+ returns NULL for such types.
+
+ gi/pygtype.c | 41 ++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 36 insertions(+), 5 deletions(-)
+
+commit 080e1a8e8c130a94b5662770621dea2ad1646b3a
+Author: Mikhail Fludkov <fludkov.me@gmail.com>
+Date: Wed Feb 7 16:36:26 2018 +0100
+
+ Use optimized version of PyImport_ImportModule
+
+ https://gitlab.gnome.org/GNOME/pygobject/issues/123
+
+ You would expect PyImport_ImportModule to import a module once, store
+ it's reference to sys.modules and the next time we call it with
+ the same
+ argument reuse the reference from sys.module. But it is not what is
+ happening unfortunately.
+
+ Everytime we call it it releases GIL, grabs global python import lock,
+ grabs GIL back. The proposed optimization looks at sys.modules
+ first and
+ uses the reference from there to avoid GIL congestion. pyg_type_lookup
+ is
+ a good example of a function which imports python modules at run
+ time and
+ can cause GIL congestion.
+
+ gi/pygi-error.c | 2 +-
+ gi/pygi-info.c | 2 +-
+ gi/pygi-type.c | 2 +-
+ gi/pyglib-python-compat.h | 17 +++++++++++++++++
+ 4 files changed, 20 insertions(+), 3 deletions(-)
+
commit ee79fef18748ad660d3a0471ed9a18ea11410849
Author: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed Feb 7 11:55:54 2018 +0100
recursive-include pygtkcompat *.am
recursive-include tests *.py *.c *.h *.xml *.supp *.am
recursive-include docs *.rst *.svg LICENSE *.ico *.png *.css *.py *.dia Makefile
-recursive-include .gitlab-ci *.sh *.rst Dockerfile
+recursive-include .gitlab-ci *.sh *.rst *.py Dockerfile
+3.27.5 - 2018-03-01
+-------------------
+
+* Re-revert transfer-none boxed copy changes (:mr:`23`). Now with more fixes
+ and tests. :mr:`24` (:user:`Mathieu Duponchelle <mathieudu>`)
+* Add caching for boxed type lookup and try to avoid the import lock. :mr:`13`
+ (:user:`Mikhail Fludkov <fludkov.me>`)
+
+
3.27.4 - 2018-02-14
-------------------
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.27.4
+Version: 3.27.5
Summary: Python bindings for GObject Introspection
Home-page: https://pygobject.readthedocs.io
Author: James Henstridge
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2017 Free Software Foundation, Inc.
+# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2017-11-07'
+timestamp='2018-02-24'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
+ ,,) echo "int x;" > "$dummy.c" ;
for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-case "${UNAME_SYSTEM}" in
+case "$UNAME_SYSTEM" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
+ eval "$set_cc_for_build"
+ cat <<-EOF > "$dummy.c"
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
LIBC=gnu
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
+
+ # If ldd exists, use it to detect musl libc.
+ if command -v ldd >/dev/null && \
+ ldd --version 2>&1 | grep -q ^musl
+ then
+ LIBC=musl
+ fi
;;
esac
# Note: order is significant - the case branches are not exclusive.
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
- /sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || \
+ "/sbin/$sysctl" 2>/dev/null || \
+ "/usr/sbin/$sysctl" 2>/dev/null || \
echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
+ case "$UNAME_MACHINE_ARCH" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
- machine=${arch}${endian}-unknown
+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+ machine="${arch}${endian}"-unknown
;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently (or will in the future) and ABI.
- case "${UNAME_MACHINE_ARCH}" in
+ case "$UNAME_MACHINE_ARCH" in
earm*)
os=netbsdelf
;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
+ eval "$set_cc_for_build"
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
;;
esac
# Determine ABI tags.
- case "${UNAME_MACHINE_ARCH}" in
+ case "$UNAME_MACHINE_ARCH" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
;;
esac
# The OS release
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
+ case "$UNAME_VERSION" in
Debian*)
release='-gnu'
;;
*)
- release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}${abi}"
+ echo "$machine-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
+ echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
exit ;;
*:LibertyBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
exit ;;
*:MidnightBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
exit ;;
*:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
exit ;;
*:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
exit ;;
macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
exit ;;
*:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
exit ;;
*:Sortix:*:*)
- echo ${UNAME_MACHINE}-unknown-sortix
+ echo "$UNAME_MACHINE"-unknown-sortix
exit ;;
*:Redox:*:*)
- echo ${UNAME_MACHINE}-unknown-redox
+ echo "$UNAME_MACHINE"-unknown-redox
exit ;;
+ mips:OSF1:*.*)
+ echo mips-dec-osf1
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
+ echo "$UNAME_MACHINE"-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
+ echo "$UNAME_MACHINE"-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
+ echo arm-acorn-riscix"$UNAME_RELEASE"
exit ;;
arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
exit ;;
sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
+ echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
+ eval "$set_cc_for_build"
SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
SUN_ARCH=x86_64
fi
fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
exit ;;
sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
+ echo m68k-sun-sunos"$UNAME_RELEASE"
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
+ echo m68k-sun-sunos"$UNAME_RELEASE"
;;
sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
+ echo sparc-sun-sunos"$UNAME_RELEASE"
;;
esac
exit ;;
aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
+ echo sparc-auspex-sunos"$UNAME_RELEASE"
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint"$UNAME_RELEASE"
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint"$UNAME_RELEASE"
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint"$UNAME_RELEASE"
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
+ echo m68k-milan-mint"$UNAME_RELEASE"
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
+ echo m68k-hades-mint"$UNAME_RELEASE"
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
+ echo m68k-unknown-mint"$UNAME_RELEASE"
exit ;;
m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
+ echo m68k-apple-machten"$UNAME_RELEASE"
exit ;;
powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
+ echo powerpc-apple-machten"$UNAME_RELEASE"
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
+ echo mips-dec-ultrix"$UNAME_RELEASE"
exit ;;
VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
+ echo vax-dec-ultrix"$UNAME_RELEASE"
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
+ echo clipper-intergraph-clix"$UNAME_RELEASE"
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
exit (-1);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
+ echo mips-mips-riscos"$UNAME_RELEASE"
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
+ if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
+ [ "$TARGET_BINARY_INTERFACE"x = x ]
then
- echo m88k-dg-dgux${UNAME_RELEASE}
+ echo m88k-dg-dgux"$UNAME_RELEASE"
else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ echo m88k-dg-dguxbcs"$UNAME_RELEASE"
fi
else
- echo i586-dg-dgux${UNAME_RELEASE}
+ echo i586-dg-dgux"$UNAME_RELEASE"
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
main()
exit(0);
}
EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
then
echo "$SYSTEM_NAME"
else
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ case "$UNAME_MACHINE" in
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
+ case "$sc_cpu_version" in
523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
+ case "$sc_kernel_bits" in
32) HP_ARCH=hppa2.0n ;;
64) HP_ARCH=hppa2.0w ;;
'') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ if [ "$HP_ARCH" = "" ]; then
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE
#include <stdlib.h>
exit (0);
}
EOF
- (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ ${HP_ARCH} = hppa2.0w ]
+ if [ "$HP_ARCH" = hppa2.0w ]
then
- eval $set_cc_for_build
+ eval "$set_cc_for_build"
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
HP_ARCH=hppa64
fi
fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
exit ;;
ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux"$HPUX_REV"
exit ;;
3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h>
int
main ()
exit (0);
}
EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
+ echo "$UNAME_MACHINE"-unknown-osf1mk
else
- echo ${UNAME_MACHINE}-unknown-osf1
+ echo "$UNAME_MACHINE"-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
exit ;;
sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
+ echo sparc-unknown-bsdi"$UNAME_RELEASE"
exit ;;
*:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
exit ;;
*:FreeBSD:*:*)
UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
+ case "$UNAME_PROCESSOR" in
amd64)
UNAME_PROCESSOR=x86_64 ;;
i386)
UNAME_PROCESSOR=i586 ;;
esac
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
exit ;;
i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
+ echo "$UNAME_MACHINE"-pc-cygwin
exit ;;
*:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
+ echo "$UNAME_MACHINE"-pc-mingw64
exit ;;
*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
+ echo "$UNAME_MACHINE"-pc-mingw32
exit ;;
*:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
+ echo "$UNAME_MACHINE"-pc-msys
exit ;;
i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
+ echo "$UNAME_MACHINE"-pc-pw32
exit ;;
*:Interix*:*)
- case ${UNAME_MACHINE} in
+ case "$UNAME_MACHINE" in
x86)
- echo i586-pc-interix${UNAME_RELEASE}
+ echo i586-pc-interix"$UNAME_RELEASE"
exit ;;
authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
+ echo x86_64-unknown-interix"$UNAME_RELEASE"
exit ;;
IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
+ echo ia64-unknown-interix"$UNAME_RELEASE"
exit ;;
esac ;;
i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
+ echo "$UNAME_MACHINE"-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
exit ;;
i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
+ echo "$UNAME_MACHINE"-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
arm*:Linux:*:*)
- eval $set_cc_for_build
+ eval "$set_cc_for_build"
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
exit ;;
e2k:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
k1om:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ eval "$set_cc_for_build"
+ sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
+ test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
;;
mips64el:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
+ echo or1k-unknown-linux-"$LIBC"
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
+ echo sparc-unknown-linux-"$LIBC"
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
+ echo hppa64-unknown-linux-"$LIBC"
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
+ PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
+ PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
+ *) echo hppa-unknown-linux-"$LIBC" ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
+ echo powerpc64-unknown-linux-"$LIBC"
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
+ echo powerpc-unknown-linux-"$LIBC"
exit ;;
ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
+ echo powerpc64le-unknown-linux-"$LIBC"
exit ;;
ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
+ echo powerpcle-unknown-linux-"$LIBC"
exit ;;
riscv32:Linux:*:* | riscv64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ if objdump -f /bin/sh | grep -q elf32-x86-64; then
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32
+ else
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
+ fi
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
+ echo "$UNAME_MACHINE"-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
+ echo "$UNAME_MACHINE"-unknown-stop
exit ;;
i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
+ echo "$UNAME_MACHINE"-unknown-atheos
exit ;;
i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
+ echo "$UNAME_MACHINE"-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
+ echo i386-unknown-lynxos"$UNAME_RELEASE"
exit ;;
i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ echo "$UNAME_MACHINE"-pc-msdosdjgpp
exit ;;
i*86:*:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
fi
exit ;;
i*86:*:5:[678]*)
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
else
- echo ${UNAME_MACHINE}-pc-sysv32
+ echo "$UNAME_MACHINE"-pc-sysv32
fi
exit ;;
pc:*:*:*)
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
+ echo m68k-unknown-lynxos"$UNAME_RELEASE"
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
+ echo sparc-unknown-lynxos"$UNAME_RELEASE"
exit ;;
rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ echo rs6000-unknown-lynxos"$UNAME_RELEASE"
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ echo powerpc-unknown-lynxos"$UNAME_RELEASE"
exit ;;
SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
+ echo mips-dde-sysv"$UNAME_RELEASE"
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
+ echo "$UNAME_MACHINE"-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
+ echo "$UNAME_MACHINE"-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
+ echo m68k-apple-aux"$UNAME_RELEASE"
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ echo mips-nec-sysv"$UNAME_RELEASE"
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ echo mips-unknown-sysv"$UNAME_RELEASE"
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
+ echo sx4-nec-superux"$UNAME_RELEASE"
exit ;;
SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
+ echo sx5-nec-superux"$UNAME_RELEASE"
exit ;;
SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
+ echo sx6-nec-superux"$UNAME_RELEASE"
exit ;;
SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
+ echo sx7-nec-superux"$UNAME_RELEASE"
exit ;;
SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
+ echo sx8-nec-superux"$UNAME_RELEASE"
exit ;;
SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
+ echo sx8r-nec-superux"$UNAME_RELEASE"
exit ;;
SX-ACE:SUPER-UX:*:*)
- echo sxace-nec-superux${UNAME_RELEASE}
+ echo sxace-nec-superux"$UNAME_RELEASE"
exit ;;
Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ echo powerpc-apple-rhapsody"$UNAME_RELEASE"
exit ;;
*:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
+ eval "$set_cc_for_build"
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-*:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
+ echo neo-tandem-nsk"$UNAME_RELEASE"
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
+ echo nse-tandem-nsk"$UNAME_RELEASE"
exit ;;
NSR-*:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
+ echo nsr-tandem-nsk"$UNAME_RELEASE"
+ exit ;;
+ NSV-*:NONSTOP_KERNEL:*:*)
+ echo nsv-tandem-nsk"$UNAME_RELEASE"
exit ;;
NSX-*:NONSTOP_KERNEL:*:*)
- echo nsx-tandem-nsk${UNAME_RELEASE}
+ echo nsx-tandem-nsk"$UNAME_RELEASE"
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
else
UNAME_MACHINE="$cputype"
fi
- echo ${UNAME_MACHINE}-unknown-plan9
+ echo "$UNAME_MACHINE"-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
+ echo mips-sei-seiux"$UNAME_RELEASE"
exit ;;
*:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
+ case "$UNAME_MACHINE" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
+ echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
exit ;;
i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
+ echo "$UNAME_MACHINE"-pc-rdos
exit ;;
i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
+ echo "$UNAME_MACHINE"-pc-aros
exit ;;
x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
+ echo "$UNAME_MACHINE"-unknown-esx
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
echo "$0: unable to guess system type" >&2
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}" in
+case "$UNAME_MACHINE:$UNAME_SYSTEM" in
mips:Linux | mips64:Linux)
# If we got here on MIPS GNU/Linux, output extra information.
cat >&2 <<EOF
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
+UNAME_MACHINE = "$UNAME_MACHINE"
+UNAME_RELEASE = "$UNAME_RELEASE"
+UNAME_SYSTEM = "$UNAME_SYSTEM"
+UNAME_VERSION = "$UNAME_VERSION"
EOF
exit 1
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2017 Free Software Foundation, Inc.
+# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2017-11-23'
+timestamp='2018-02-22'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2017 Free Software Foundation, Inc.
+Copyright 1992-2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
*local*)
# First pass through any local machine types.
- echo $1
+ echo "$1"
exit ;;
* )
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
android-linux)
os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
+ basic_machine=`echo "$1" | sed 's/-[^-]*$//'`
+ if [ "$basic_machine" != "$1" ]
+ then os=`echo "$1" | sed 's/.*-/-/'`
else os=; fi
;;
esac
;;
-sco6)
os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'`
;;
-lynx*178)
os=-lynxos178
os=-lynxos
;;
-ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'`
;;
-psos*)
os=-psos
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
+ | pdp10 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pru \
| pyramid \
basic_machine=$basic_machine-unknown
os=-none
;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65)
;;
ms1)
basic_machine=mt-unknown
;;
# Object if more than one company name word.
*-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
- basic_machine=i386-unknown
+ basic_machine=i386-pc
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=x86_64-pc
;;
amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-linux
;;
blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
os=-cnk
;;
c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=$os"spe"
;;
e500v[12]-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=$os"spe"
;;
ebmon29k)
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
- hppa-next)
- os=-nextstep3
- ;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
basic_machine=i370-ibm
;;
i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
- i386-vsta | vsta)
+ vsta)
basic_machine=i386-unknown
os=-vsta
;;
os=-sysv
;;
leon-*|leon[3-9]-*)
- basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+ basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
os=-mint
;;
mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`
;;
mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-msdos
;;
ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i686-pc
nsr-tandem)
basic_machine=nsr-tandem
;;
+ nsv-tandem)
+ basic_machine=nsv-tandem
+ ;;
nsx-tandem)
basic_machine=nsx-tandem
;;
os=-linux
;;
parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=i386-pc
;;
pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
ppc | ppcbe) basic_machine=powerpc-unknown
;;
ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
sequent)
basic_machine=i386-sequent
;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
sh5el)
basic_machine=sh5le-unknown
;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
+ simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
os=-sysv4
;;
strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
sun2)
basic_machine=m68000-sun
basic_machine=a29k-wrs
os=-vxworks
;;
- wasm32)
- basic_machine=wasm32-unknown
- ;;
w65*)
basic_machine=w65-wdc
os=-none
basic_machine=xps100-honeywell
;;
xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'`
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
none)
basic_machine=none-none
os=-none
vax)
basic_machine=vax-dec
;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
pdp11)
basic_machine=pdp11-dec
;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
cydra)
basic_machine=cydra-cydrome
;;
# Make sure to match an already-canonicalized machine name.
;;
*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'`
;;
*-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'`
;;
*)
;;
-solaris)
os=-solaris2
;;
- -svr4*)
- os=-sysv4
- ;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
+ # es1800 is here to avoid being matched by es* (a different OS)
+ -es1800*)
+ os=-ose
+ ;;
# Now accept the basic system types.
# The portable systems comes first.
# Each alternative MUST end in a * to match a version number.
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \
| -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -morphos* | -superux* | -rtmk* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
- | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \
+ | -midnightbsd*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ -sim | -xray | -os68k* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
+ os=`echo "$os" | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
-wince*)
os=-wince
;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
-utek*)
os=-bsd
;;
-oss*)
os=-sysv3
;;
- -svr4)
+ -svr4*)
os=-sysv4
;;
-svr3)
-ose*)
os=-ose
;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
- -aros*)
- os=-aros
- ;;
-zvmoe)
os=-zvmoe
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2
exit 1
;;
esac
*-be)
os=-beos
;;
- *-haiku)
- os=-haiku
- ;;
*-ibm)
os=-aix
;;
i370-*)
os=-mvs
;;
- *-next)
- os=-nextstep3
- ;;
*-gould)
os=-sysv
;;
vendor=stratus
;;
esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"`
;;
esac
-echo $basic_machine$os
+echo "$basic_machine$os"
exit
# Local variables:
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.27.4.
+# Generated by GNU Autoconf 2.69 for pygobject 3.27.5.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
#
# Identity of this package.
PACKAGE_NAME='pygobject'
PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.27.4'
-PACKAGE_STRING='pygobject 3.27.4'
+PACKAGE_VERSION='3.27.5'
+PACKAGE_STRING='pygobject 3.27.5'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pygobject 3.27.4 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.27.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pygobject 3.27.4:";;
+ short | recursive ) echo "Configuration of pygobject 3.27.5:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.27.4
+pygobject configure 3.27.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pygobject $as_me 3.27.4, which was
+It was created by pygobject $as_me 3.27.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MINOR_VERSION=27
-$as_echo "#define PYGOBJECT_MICRO_VERSION 4" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 5" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=4
+PYGOBJECT_MICRO_VERSION=5
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.27.4'
+ VERSION='3.27.5'
cat >>confdefs.h <<_ACEOF
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pygobject $as_me 3.27.4, which was
+This file was extended by pygobject $as_me 3.27.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pygobject config.status 3.27.4
+pygobject config.status 3.27.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
m4_define(pygobject_minor_version, 27)
-m4_define(pygobject_micro_version, 4)
+m4_define(pygobject_micro_version, 5)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
py_type = _pygi_type_import_by_name ("GLib", "VariantType");
- /* Pass the string directly and force a boxed copy. This works because
- * GVariantType is just a char pointer. */
- py_variant = _pygi_boxed_new ( (PyTypeObject *) py_type, type_string,
- TRUE, /* copy_boxed */
- 0); /* slice_allocated */
+ py_variant = _pygi_boxed_new ( (PyTypeObject *) py_type, type_string, FALSE, 0);
return py_variant;
}
def __init__(self, *args, **kwargs):
return super(Source, self).__init__()
+ def __del__(self):
+ if hasattr(self, '__pygi_custom_source'):
+ self.unref()
+
def set_callback(self, fn, user_data=None):
if hasattr(self, '__pygi_custom_source'):
# use our custom pyg_source_set_callback() if for a GSource object
if self._free_on_dealloc and self.g_type != TYPE_INVALID:
self.unset()
- # We must call base class __del__() after unset.
- super(Value, self).__del__()
-
def set_boxed(self, boxed):
# Workaround the introspection marshalers inability to know
# these methods should be marshaling boxed types. This is because
_pygi_marshal_to_py_array (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
GArray *array_;
PyObject *py_obj = NULL;
gsize item_size;
PyGIMarshalToPyFunc item_to_py_marshaller;
PyGIArgCache *item_arg_cache;
+ GPtrArray *item_cleanups;
py_obj = PyList_New (array_->len);
if (py_obj == NULL)
goto err;
+ item_cleanups = g_ptr_array_sized_new (array_->len);
+ *cleanup_data = item_cleanups;
item_arg_cache = seq_cache->item_cache;
item_to_py_marshaller = item_arg_cache->to_py_marshaller;
for (i = 0; i < array_->len; i++) {
GIArgument item_arg = {0};
PyObject *py_item;
+ gpointer item_cleanup_data = NULL;
/* If we are receiving an array of pointers, simply assign the pointer
* and move on, letting the per-item marshaler deal with the
py_item = item_to_py_marshaller ( state,
callable_cache,
item_arg_cache,
- &item_arg);
+ &item_arg,
+ &item_cleanup_data);
+
+ g_ptr_array_index (item_cleanups, i) = item_cleanup_data;
if (py_item == NULL) {
Py_CLEAR (py_obj);
if (array_cache->array_type == GI_ARRAY_TYPE_C)
g_array_unref (array_);
+ g_ptr_array_unref (item_cleanups);
+
goto err;
}
PyList_SET_ITEM (py_obj, i, py_item);
/* clean up unprocessed items */
if (seq_cache->item_cache->to_py_cleanup != NULL) {
guint j;
- PyGIMarshalCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup;
+ PyGIMarshalToPyCleanupFunc cleanup_func = seq_cache->item_cache->to_py_cleanup;
for (j = processed_items; j < array_->len; j++) {
cleanup_func (state,
seq_cache->item_cache,
static void
_pygi_marshal_cleanup_to_py_array (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
+ GArray *array_ = NULL;
+ GPtrArray *ptr_array_ = NULL;
+ PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
+ PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache;
+ gboolean free_array = FALSE;
+ gboolean free_array_full = TRUE;
+
if (arg_cache->transfer == GI_TRANSFER_EVERYTHING ||
arg_cache->transfer == GI_TRANSFER_CONTAINER) {
- GArray *array_ = NULL;
- GPtrArray *ptr_array_ = NULL;
- PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
- PyGIArgGArray *array_cache = (PyGIArgGArray *)arg_cache;
-
- /* If this isn't a garray create one to help process variable sized
- array elements */
- if (array_cache->array_type == GI_ARRAY_TYPE_C) {
- array_ = _wrap_c_array (state, array_cache, data);
+ free_array = TRUE;
+ }
- if (array_ == NULL)
- return;
+ /* If this isn't a garray create one to help process variable sized
+ array elements */
+ if (array_cache->array_type == GI_ARRAY_TYPE_C) {
+ array_ = _wrap_c_array (state, array_cache, data);
- } else if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) {
- ptr_array_ = (GPtrArray *) data;
- } else {
- array_ = (GArray *) data;
- }
+ if (array_ == NULL)
+ return;
- if (sequence_cache->item_cache->to_py_cleanup != NULL) {
- gsize i;
- guint len = (array_ != NULL) ? array_->len : ptr_array_->len;
+ free_array = TRUE;
+ free_array_full = FALSE;
+ } else if (array_cache->array_type == GI_ARRAY_TYPE_PTR_ARRAY) {
+ ptr_array_ = (GPtrArray *) data;
+ } else {
+ array_ = (GArray *) data;
+ }
- PyGIMarshalCleanupFunc cleanup_func = sequence_cache->item_cache->to_py_cleanup;
- for (i = 0; i < len; i++) {
- cleanup_func (state,
- sequence_cache->item_cache,
- NULL,
- (array_ != NULL) ? g_array_index (array_, gpointer, i) : g_ptr_array_index (ptr_array_, i),
- was_processed);
- }
+ if (sequence_cache->item_cache->to_py_cleanup != NULL) {
+ GPtrArray *item_cleanups = (GPtrArray *) cleanup_data;
+ gsize i;
+ guint len = (array_ != NULL) ? array_->len : ptr_array_->len;
+
+ PyGIMarshalToPyCleanupFunc cleanup_func = sequence_cache->item_cache->to_py_cleanup;
+ for (i = 0; i < len; i++) {
+ cleanup_func (state,
+ sequence_cache->item_cache,
+ g_ptr_array_index(item_cleanups, i),
+ (array_ != NULL) ? g_array_index (array_, gpointer, i) : g_ptr_array_index (ptr_array_, i),
+ was_processed);
}
+ g_ptr_array_unref (item_cleanups);
+ }
+ if (free_array) {
if (array_ != NULL)
- g_array_free (array_, TRUE);
+ g_array_free (array_, free_array_full);
else
- g_ptr_array_free (ptr_array_, TRUE);
+ g_ptr_array_free (ptr_array_, free_array_full);
}
}
_pygi_marshal_to_py_void (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
if (arg_cache->is_pointer) {
return PyLong_FromVoidPtr (arg->v_pointer);
_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
return _pygi_marshal_to_py_basic_type (arg,
arg_cache->type_tag,
static void
_pygi_marshal_cleanup_to_py_utf8 (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
PyObject *_pygi_marshal_to_py_basic_type_cache_adapter (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg);
+ GIArgument *arg,
+ gpointer *cleanup_data);
PyGIArgCache *pygi_arg_basic_type_new_from_info (GITypeInfo *type_info,
GIArgInfo *arg_info, /* may be null */
if ( ( (PyGBoxed *) self)->free_on_dealloc && boxed != NULL) {
if (self->slice_allocated) {
g_slice_free1 (self->size, boxed);
+ self->slice_allocated = FALSE;
+ self->size = 0;
} else {
g_type = pyg_type_from_object ( (PyObject *) self);
g_boxed_free (g_type, boxed);
goto out;
}
- self = (PyGIBoxed *) _pygi_boxed_new (type, boxed, FALSE, size);
+ self = (PyGIBoxed *) _pygi_boxed_new (type, boxed, TRUE, size);
if (self == NULL) {
g_slice_free1 (size, boxed);
goto out;
PYGLIB_DEFINE_TYPE("gi.Boxed", PyGIBoxed_Type, PyGIBoxed);
PyObject *
-_pygi_boxed_new (PyTypeObject *pytype,
+_pygi_boxed_new (PyTypeObject *type,
gpointer boxed,
- gboolean copy_boxed,
+ gboolean free_on_dealloc,
gsize allocated_slice)
{
PyGIBoxed *self;
- GType gtype;
if (!boxed) {
Py_RETURN_NONE;
}
- if (!PyType_IsSubtype (pytype, &PyGIBoxed_Type)) {
+ if (!PyType_IsSubtype (type, &PyGIBoxed_Type)) {
PyErr_SetString (PyExc_TypeError, "must be a subtype of gi.Boxed");
return NULL;
}
- gtype = pyg_type_from_object ((PyObject *)pytype);
-
- /* Boxed objects with slice allocation means they come from caller allocated
- * out arguments. In this case copy_boxed does not make sense because we
- * already own the slice allocated memory and we should be receiving full
- * ownership transfer. */
- if (copy_boxed) {
- g_assert (allocated_slice == 0);
- boxed = g_boxed_copy (gtype, boxed);
- }
-
- self = (PyGIBoxed *) pytype->tp_alloc (pytype, 0);
+ self = (PyGIBoxed *) type->tp_alloc (type, 0);
if (self == NULL) {
return NULL;
}
- /* We always free on dealloc because we always own the memory due to:
- * 1) copy_boxed == TRUE
- * 2) allocated_slice > 0
- * 3) otherwise the mode is assumed "transfer everything".
- */
- ((PyGBoxed *)self)->free_on_dealloc = TRUE;
- ((PyGBoxed *)self)->gtype = gtype;
+ ( (PyGBoxed *) self)->gtype = pyg_type_from_object ( (PyObject *) type);
+ ( (PyGBoxed *) self)->free_on_dealloc = free_on_dealloc;
pyg_boxed_set_ptr (self, boxed);
-
if (allocated_slice > 0) {
self->size = allocated_slice;
self->slice_allocated = TRUE;
_pygi_boxed_copy_in_place (PyGIBoxed *self)
{
PyGBoxed *pygboxed = (PyGBoxed *)self;
- gpointer copy = g_boxed_copy (pygboxed->gtype, pyg_boxed_get_ptr (self));
+ gpointer ptr = pyg_boxed_get_ptr (self);
+ gpointer copy = NULL;
+
+ if (ptr)
+ copy = g_boxed_copy (pygboxed->gtype, ptr);
boxed_del (self);
pyg_boxed_set_ptr (pygboxed, copy);
extern PyTypeObject PyGIBoxed_Type;
-PyObject * _pygi_boxed_new (PyTypeObject *pytype,
+PyObject * _pygi_boxed_new (PyTypeObject *type,
gpointer boxed,
- gboolean copy_boxed,
+ gboolean free_on_dealloc,
gsize allocated_slice);
void * _pygi_boxed_alloc (GIBaseInfo *info,
typedef PyObject *(*PyGIMarshalToPyFunc) (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg);
+ GIArgument *arg,
+ gpointer *cleanup_data);
typedef void (*PyGIMarshalCleanupFunc) (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *py_arg, /* always NULL for to_py cleanup */
+ PyObject *py_arg,
gpointer data,
gboolean was_processed);
+typedef void (*PyGIMarshalToPyCleanupFunc) (PyGIInvokeState *state,
+ PyGIArgCache *arg_cache,
+ gpointer cleanup_data,
+ gpointer data,
+ gboolean was_processed);
+
/* Argument meta types denote how we process the argument:
* - PYGI_META_ARG_TYPE_PARENT - parents may or may not have children
* but are always processed via the normal marshaller for their
PyGIMarshalToPyFunc to_py_marshaller;
PyGIMarshalCleanupFunc from_py_cleanup;
- PyGIMarshalCleanupFunc to_py_cleanup;
+ PyGIMarshalToPyCleanupFunc to_py_cleanup;
GDestroyNotify destroy_notify;
} else if (arg_cache->meta_type != PYGI_META_ARG_TYPE_PARENT) {
continue;
} else {
+ gpointer cleanup_data = NULL;
+
value = arg_cache->to_py_marshaller (state,
cache,
arg_cache,
- &state->args[i].arg_value);
+ &state->args[i].arg_value,
+ &cleanup_data);
+ state->args[i].to_py_arg_cleanup_data = cleanup_data;
if (value == NULL) {
pygi_marshal_cleanup_args_to_py_parameter_fail (state,
_pygi_marshal_to_py_interface_callback (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *arg_cleanup_data)
{
PyGICallbackCache *callback_cache = (PyGICallbackCache *) arg_cache;
gssize user_data_index;
_pygi_marshal_to_py_interface_enum (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
PyObject *py_obj = NULL;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
_pygi_marshal_to_py_interface_flags (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
PyObject *py_obj = NULL;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
_pygi_marshal_to_py_gerror (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
GError *error = arg->v_pointer;
PyObject *py_obj = NULL;
void
pygi_error_register_types (PyObject *module)
{
- PyObject *error_module = PyImport_ImportModule ("gi._error");
+ PyObject *error_module = PYGLIB_PyImport_ImportModule ("gi._error");
if (!error_module) {
return;
}
_pygi_marshal_to_py_ghash (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
GHashTable *hash_;
GHashTableIter hash_table_iter;
while (g_hash_table_iter_next (&hash_table_iter,
&key_arg.v_pointer,
&value_arg.v_pointer)) {
+ gpointer key_cleanup_data = NULL;
+ gpointer value_cleanup_data = NULL;
PyObject *py_key;
PyObject *py_value;
int retval;
py_key = key_to_py_marshaller ( state,
callable_cache,
key_arg_cache,
- &key_arg);
+ &key_arg,
+ &key_cleanup_data);
if (py_key == NULL) {
Py_CLEAR (py_obj);
py_value = value_to_py_marshaller ( state,
callable_cache,
value_arg_cache,
- &value_arg);
+ &value_arg,
+ &value_cleanup_data);
if (py_value == NULL) {
Py_CLEAR (py_obj);
static void
_pygi_marshal_cleanup_to_py_ghash (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
static PyObject *_py_generate_doc_string = NULL;
if (_py_generate_doc_string == NULL) {
- PyObject *mod = PyImport_ImportModule ("gi.docstring");
+ PyObject *mod = PYGLIB_PyImport_ImportModule ("gi.docstring");
if (!mod)
return NULL;
/* Holds from_py marshaler cleanup data. */
gpointer arg_cleanup_data;
+ /* Holds to_py marshaler cleanup data. */
+ gpointer to_py_arg_cleanup_data;
} PyGIInvokeArgState;
/* Memory to receive the result of the C ffi function call. */
GIArgument return_arg;
+ gpointer to_py_return_arg_cleanup_data;
/* A GError exception which is indirectly bound into the last position of
* the "args" array if the callable caches "throws" member is set.
if (cache->return_cache) {
if (!cache->return_cache->is_skipped) {
+ gpointer cleanup_data = NULL;
py_return = cache->return_cache->to_py_marshaller ( state,
cache,
cache->return_cache,
- &state->return_arg);
+ &state->return_arg,
+ &cleanup_data);
+ state->to_py_return_arg_cleanup_data = cleanup_data;
if (py_return == NULL) {
pygi_marshal_cleanup_args_return_fail (state,
cache);
}
} else {
if (cache->return_cache->transfer == GI_TRANSFER_EVERYTHING) {
- PyGIMarshalCleanupFunc to_py_cleanup =
+ PyGIMarshalToPyCleanupFunc to_py_cleanup =
cache->return_cache->to_py_cleanup;
if (to_py_cleanup != NULL)
} else if (!cache->has_return && n_out_args == 1) {
/* if we get here there is one out arg an no return */
PyGIArgCache *arg_cache = (PyGIArgCache *)cache->to_py_args->data;
+ gpointer cleanup_data = NULL;
py_out = arg_cache->to_py_marshaller (state,
cache,
arg_cache,
- state->args[arg_cache->c_arg_index].arg_pointer.v_pointer);
+ state->args[arg_cache->c_arg_index].arg_pointer.v_pointer,
+ &cleanup_data);
+ state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data = cleanup_data;
if (py_out == NULL) {
pygi_marshal_cleanup_args_to_py_parameter_fail (state,
cache,
for (; py_arg_index < tuple_len; py_arg_index++) {
PyGIArgCache *arg_cache = (PyGIArgCache *)cache_item->data;
+ gpointer cleanup_data = NULL;
PyObject *py_obj = arg_cache->to_py_marshaller (state,
cache,
arg_cache,
- state->args[arg_cache->c_arg_index].arg_pointer.v_pointer);
+ state->args[arg_cache->c_arg_index].arg_pointer.v_pointer,
+ &cleanup_data);
+ state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data = cleanup_data;
if (py_obj == NULL) {
if (cache->has_return)
_pygi_marshal_to_py_glist (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
GList *list_;
gsize length;
gsize i;
+ GPtrArray *item_cleanups;
PyGIMarshalToPyFunc item_to_py_marshaller;
PyGIArgCache *item_arg_cache;
if (py_obj == NULL)
return NULL;
+ item_cleanups = g_ptr_array_sized_new (length);
+ *cleanup_data = item_cleanups;
+
item_arg_cache = seq_cache->item_cache;
item_to_py_marshaller = item_arg_cache->to_py_marshaller;
for (i = 0; list_ != NULL; list_ = g_list_next (list_), i++) {
GIArgument item_arg;
PyObject *py_item;
+ gpointer item_cleanup_data = NULL;
item_arg.v_pointer = list_->data;
_pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_info);
py_item = item_to_py_marshaller (state,
callable_cache,
item_arg_cache,
- &item_arg);
+ &item_arg,
+ &item_cleanup_data);
+
+ g_ptr_array_index (item_cleanups, i) = item_cleanup_data;
if (py_item == NULL) {
Py_CLEAR (py_obj);
_PyGI_ERROR_PREFIX ("Item %zu: ", i);
+ g_ptr_array_unref (item_cleanups);
return NULL;
}
_pygi_marshal_to_py_gslist (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
GSList *list_;
gsize length;
gsize i;
+ GPtrArray *item_cleanups;
PyGIMarshalToPyFunc item_to_py_marshaller;
PyGIArgCache *item_arg_cache;
if (py_obj == NULL)
return NULL;
+ item_cleanups = g_ptr_array_sized_new (length);
+ *cleanup_data = item_cleanups;
+
item_arg_cache = seq_cache->item_cache;
item_to_py_marshaller = item_arg_cache->to_py_marshaller;
for (i = 0; list_ != NULL; list_ = g_slist_next (list_), i++) {
GIArgument item_arg;
PyObject *py_item;
+ gpointer item_cleanup_data = NULL;
item_arg.v_pointer = list_->data;
_pygi_hash_pointer_to_arg (&item_arg, item_arg_cache->type_info);
py_item = item_to_py_marshaller (state,
callable_cache,
item_arg_cache,
- &item_arg);
+ &item_arg,
+ &item_cleanup_data);
+ g_ptr_array_index (item_cleanups, i) = item_cleanup_data;
if (py_item == NULL) {
Py_CLEAR (py_obj);
_PyGI_ERROR_PREFIX ("Item %zu: ", i);
+ g_ptr_array_unref (item_cleanups);
return NULL;
}
static void
_pygi_marshal_cleanup_to_py_glist (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
+ GPtrArray *item_cleanups = (GPtrArray *) cleanup_data;
PyGISequenceCache *sequence_cache = (PyGISequenceCache *)arg_cache;
+ GSList *list_ = (GSList *)data;
+
+ if (sequence_cache->item_cache->to_py_cleanup != NULL) {
+ PyGIMarshalToPyCleanupFunc cleanup_func =
+ sequence_cache->item_cache->to_py_cleanup;
+ GSList *node = list_;
+ guint i = 0;
+
+ while (node != NULL) {
+ cleanup_func (state,
+ sequence_cache->item_cache,
+ g_ptr_array_index(item_cleanups, i),
+ node->data,
+ was_processed);
+ node = node->next;
+ i++;
+ }
+ }
+
if (arg_cache->transfer == GI_TRANSFER_EVERYTHING ||
arg_cache->transfer == GI_TRANSFER_CONTAINER) {
- GSList *list_ = (GSList *)data;
-
- if (sequence_cache->item_cache->to_py_cleanup != NULL) {
- PyGIMarshalCleanupFunc cleanup_func =
- sequence_cache->item_cache->to_py_cleanup;
- GSList *node = list_;
-
- while (node != NULL) {
- cleanup_func (state,
- sequence_cache->item_cache,
- NULL,
- node->data,
- was_processed);
- node = node->next;
- }
- }
if (arg_cache->type_tag == GI_TYPE_TAG_GLIST) {
g_list_free ( (GList *)list_);
g_assert_not_reached();
}
}
+
+ g_ptr_array_unref (item_cleanups);
}
static void
PyGICallableCache *cache)
{
GSList *cache_item;
+ guint i = 0;
+
/* clean up the return if available */
if (cache->return_cache != NULL) {
- PyGIMarshalCleanupFunc cleanup_func = cache->return_cache->to_py_cleanup;
+ PyGIMarshalToPyCleanupFunc cleanup_func = cache->return_cache->to_py_cleanup;
if (cleanup_func && state->return_arg.v_pointer != NULL)
cleanup_func (state,
cache->return_cache,
- NULL,
+ state->to_py_return_arg_cleanup_data,
state->return_arg.v_pointer,
TRUE);
}
cache_item = cache->to_py_args;
while (cache_item) {
PyGIArgCache *arg_cache = (PyGIArgCache *) cache_item->data;
- PyGIMarshalCleanupFunc cleanup_func = arg_cache->to_py_cleanup;
+ PyGIMarshalToPyCleanupFunc cleanup_func = arg_cache->to_py_cleanup;
gpointer data = state->args[arg_cache->c_arg_index].arg_value.v_pointer;
if (cleanup_func != NULL && data != NULL)
cleanup_func (state,
arg_cache,
- NULL,
+ state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data,
data,
TRUE);
else if (arg_cache->is_caller_allocates && data != NULL) {
_cleanup_caller_allocates (state,
arg_cache,
- NULL,
+ state->args[arg_cache->c_arg_index].to_py_arg_cleanup_data,
data,
TRUE);
}
+ i++;
cache_item = cache_item->next;
}
}
_pygi_marshal_to_py_called_from_c_interface_object_cache_adapter (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
return pygi_arg_gobject_to_py_called_from_c (arg, arg_cache->transfer);
}
_pygi_marshal_to_py_called_from_py_interface_object_cache_adapter (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
PyGIArgCache *arg_cache,
- GIArgument *arg)
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
return pygi_arg_gobject_to_py (arg, arg_cache->transfer);
}
static void
_pygi_marshal_cleanup_to_py_interface_object (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
GITypeInfo *type_info = NULL;
gboolean free_array = FALSE;
GIArgument arg = { 0, };
+ GITransfer transfer = GI_TRANSFER_NOTHING;
type_info = g_property_info_get_type (property_info);
arg = _pygi_argument_from_g_value (&value, type_info);
if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ARRAY) {
arg.v_pointer = _pygi_argument_to_array (&arg, NULL, NULL, NULL,
type_info, &free_array);
+ } else if (g_type_is_a (pspec->value_type, G_TYPE_BOXED)) {
+ arg.v_pointer = g_value_dup_boxed (&value);
+ transfer = GI_TRANSFER_EVERYTHING;
}
- py_value = _pygi_argument_to_object (&arg, type_info, GI_TRANSFER_NOTHING);
+ py_value = _pygi_argument_to_object (&arg, type_info, transfer);
if (free_array) {
g_array_free (arg.v_pointer, FALSE);
source = (PyGRealSource*) g_source_new (&pyg_source_funcs, sizeof (PyGRealSource));
py_type = _pygi_type_import_by_name ("GLib", "Source");
- /* Full ownership transfer of the source, this will be free'd with g_boxed_free. */
- source->obj = _pygi_boxed_new ( (PyTypeObject *) py_type, source,
- FALSE, /* copy_boxed */
- 0); /* slice_allocated */
+ /* g_source_new uses malloc, not slices */
+ source->obj = _pygi_boxed_new ( (PyTypeObject *) py_type, source, FALSE, 0);
return source->obj;
}
}
}
-
-PyObject *
-pygi_arg_struct_to_py_marshal (GIArgument *arg,
- GIInterfaceInfo *interface_info,
- GType g_type,
- PyObject *py_type,
- GITransfer transfer,
- gboolean is_allocated,
- gboolean is_foreign)
+static PyObject *
+pygi_arg_struct_to_py_marshaller (GIArgument *arg,
+ GIInterfaceInfo *interface_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign)
{
PyObject *py_obj = NULL;
arg->v_pointer);
} else if (g_type_is_a (g_type, G_TYPE_BOXED)) {
if (py_type) {
- /* Force a boxed copy if we are not transfered ownership and the
- * memory is not caller allocated. */
py_obj = _pygi_boxed_new ((PyTypeObject *) py_type,
arg->v_pointer,
- transfer == GI_TRANSFER_NOTHING && !is_allocated,
+ transfer == GI_TRANSFER_EVERYTHING || is_allocated,
is_allocated ?
g_struct_info_get_size(interface_info) : 0);
}
return py_obj;
}
-static PyObject *
-arg_struct_to_py_marshal_adapter (PyGIInvokeState *state,
- PyGICallableCache *callable_cache,
- PyGIArgCache *arg_cache,
- GIArgument *arg)
+PyObject *
+pygi_arg_struct_to_py_marshal (GIArgument *arg,
+ GIInterfaceInfo *interface_info,
+ GType g_type,
+ PyObject *py_type,
+ GITransfer transfer,
+ gboolean is_allocated,
+ gboolean is_foreign)
{
- PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
+ PyObject *ret = pygi_arg_struct_to_py_marshaller (arg, interface_info, g_type, py_type, transfer, is_allocated, is_foreign);
- return pygi_arg_struct_to_py_marshal (arg,
- iface_cache->interface_info,
- iface_cache->g_type,
- iface_cache->py_type,
- arg_cache->transfer,
- arg_cache->is_caller_allocates,
- iface_cache->is_foreign);
-}
+ if (ret && PyObject_IsInstance (ret, (PyObject *) &PyGIBoxed_Type) && transfer == GI_TRANSFER_NOTHING)
+ _pygi_boxed_copy_in_place ((PyGIBoxed *) ret);
+
+ return ret;
+};
static PyObject *
-arg_boxed_to_py_marshal_pass_by_ref (PyGIInvokeState *state,
- PyGICallableCache *callable_cache,
- PyGIArgCache *arg_cache,
- GIArgument *arg)
+arg_struct_to_py_marshal_adapter (PyGIInvokeState *state,
+ PyGICallableCache *callable_cache,
+ PyGIArgCache *arg_cache,
+ GIArgument *arg,
+ gpointer *cleanup_data)
{
- PyObject *py_obj = NULL;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
+ PyObject *ret;
- if (arg->v_pointer == NULL) {
- Py_RETURN_NONE;
- }
+ ret = pygi_arg_struct_to_py_marshaller (arg,
+ iface_cache->interface_info,
+ iface_cache->g_type,
+ iface_cache->py_type,
+ arg_cache->transfer,
+ arg_cache->is_caller_allocates,
+ iface_cache->is_foreign);
- if (g_type_is_a (iface_cache->g_type, G_TYPE_BOXED)) {
- if (iface_cache->py_type) {
- py_obj = _pygi_boxed_new ((PyTypeObject *) iface_cache->py_type,
- arg->v_pointer,
- FALSE, /* copy_boxed */
- 0); /* slice_alloc */
- ((PyGBoxed *)py_obj)->free_on_dealloc = FALSE;
- }
- } else {
- PyErr_Format (PyExc_NotImplementedError,
- "expected boxed type but got %s",
- g_type_name (iface_cache->g_type));
- }
+ *cleanup_data = ret;
- return py_obj;
+ return ret;
}
static void
arg_foreign_to_py_cleanup (PyGIInvokeState *state,
PyGIArgCache *arg_cache,
- PyObject *dummy,
+ gpointer cleanup_data,
gpointer data,
gboolean was_processed)
{
}
}
+static void
+arg_boxed_to_py_cleanup (PyGIInvokeState *state,
+ PyGIArgCache *arg_cache,
+ gpointer cleanup_data,
+ gpointer data,
+ gboolean was_processed)
+{
+ if (arg_cache->transfer == GI_TRANSFER_NOTHING)
+ _pygi_boxed_copy_in_place ((PyGIBoxed *) cleanup_data);
+}
+
static gboolean
arg_type_class_from_py_marshal (PyGIInvokeState *state,
PyGICallableCache *callable_cache,
static void
arg_struct_to_py_setup (PyGIArgCache *arg_cache,
GIInterfaceInfo *iface_info,
- GITransfer transfer,
- GIArgInfo *arg_info)
+ GITransfer transfer)
{
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
- /* HACK to force GtkTreeModel:iter_next() and iter_previous() vfunc implementations
- * to receive their Gtk.TreeIter argument as pass-by-reference. We create a new
- * PyGIBoxed wrapper which does not copy the memory and also does not free it.
- * This is needed to hack the noted vfunc implementations so they can continue
- * working with bug https://bugzilla.gnome.org/show_bug.cgi?id=722899
- * being fixed. This hack should be removed once GTK+ has fixed bug
- * https://bugzilla.gnome.org/show_bug.cgi?id=734465
- * and we've moved to a new major version.
- */
- if (arg_info && g_strcmp0 (iface_cache->type_name, "Gtk.TreeIter") == 0) {
-
- /* GICallbackInfo */
- GIBaseInfo *info = g_base_info_get_container (arg_info);
- if (info && g_base_info_get_type (info) == GI_INFO_TYPE_CALLBACK &&
- (g_strcmp0 (g_base_info_get_name (info), "iter_next") == 0 ||
- g_strcmp0 (g_base_info_get_name (info), "iter_previous") == 0)) {
-
- /* GITypeInfo */
- info = g_base_info_get_container (info);
- if (info && g_base_info_get_type (info) == GI_INFO_TYPE_TYPE &&
- g_type_info_get_tag ((GITypeInfo *)info) == GI_TYPE_TAG_INTERFACE) {
-
- /* GIFieldInfo */
- info = g_base_info_get_container (info);
- if (info && g_base_info_get_type (info) == GI_INFO_TYPE_FIELD) {
-
- /* GIStructInfo */
- info = g_base_info_get_container (info);
- if (info && g_base_info_get_type (info) == GI_INFO_TYPE_STRUCT &&
- g_strcmp0 (g_base_info_get_name (info), "TreeModelIface") == 0) {
- arg_cache->to_py_marshaller = arg_boxed_to_py_marshal_pass_by_ref;
- }
- }
- }
- }
- }
-
if (arg_cache->to_py_marshaller == NULL) {
arg_cache->to_py_marshaller = arg_struct_to_py_marshal_adapter;
}
+ iface_cache->is_foreign = g_struct_info_is_foreign ( (GIStructInfo*)iface_info);
+
if (iface_cache->is_foreign)
arg_cache->to_py_cleanup = arg_foreign_to_py_cleanup;
+ else if (!g_type_is_a (iface_cache->g_type, G_TYPE_VALUE) &&
+ iface_cache->py_type &&
+ g_type_is_a (iface_cache->g_type, G_TYPE_BOXED))
+ arg_cache->to_py_cleanup = arg_boxed_to_py_cleanup;
}
PyGIArgCache *
}
if (direction & PYGI_DIRECTION_TO_PYTHON) {
- arg_struct_to_py_setup (cache, iface_info, transfer, arg_info);
+ arg_struct_to_py_setup (cache, iface_info, transfer);
}
return cache;
module_name = g_strconcat ("gi.repository.", namespace_, NULL);
- py_module = PyImport_ImportModule (module_name);
+ py_module = PYGLIB_PyImport_ImportModule (module_name);
g_free (module_name);
return; \
PyDict_SetItemString(d, name, (PyObject *)&type);
+/* Better alternative to PyImport_ImportModule which tries to import from
+ * sys.modules first */
+static inline PyObject *
+PYGLIB_PyImport_ImportModule(const char *name)
+{
+ /* see PyImport_ImportModuleNoBlock
+ * https://github.com/python/cpython/blob/2.7/Python/import.c#L2166-L2206 */
+ PyObject *result = PyImport_ImportModuleNoBlock(name);
+ if (result)
+ return result;
+
+ PyErr_Clear();
+ return PyImport_ImportModule(name);
+}
+
#else
#define PYGLIB_MODULE_START(symbol, modname) \
return; \
PyDict_SetItemString(d, name, (PyObject *)&type);
+#define PYGLIB_PyImport_ImportModule PyImport_ImportModule
+
#define PYGLIB_PyBaseString_Check PyUnicode_Check
#define PYGLIB_PyUnicode_Check PyUnicode_Check
}
static GQuark pyg_type_marshal_key = 0;
+static GQuark pyg_type_marshal_helper_key = 0;
+
+typedef enum _marshal_helper_data_e marshal_helper_data_e;
+enum _marshal_helper_data_e {
+ MARSHAL_HELPER_NONE = 0,
+ MARSHAL_HELPER_RETURN_NULL,
+ MARSHAL_HELPER_IMPORT_DONE,
+};
PyGTypeMarshal *
pyg_type_lookup(GType type)
GType ptype = type;
PyGTypeMarshal *tm = NULL;
- /* recursively lookup types */
- while (ptype) {
- pygi_type_import_by_g_type (ptype);
+ if (type == G_TYPE_INVALID)
+ return NULL;
+
+ marshal_helper_data_e marshal_helper = GPOINTER_TO_INT (
+ g_type_get_qdata(type, pyg_type_marshal_helper_key));
+
+ /* If we called this function before with @type and nothing was found,
+ * return NULL early to not spend time in the loop below */
+ if (marshal_helper == MARSHAL_HELPER_RETURN_NULL)
+ return NULL;
+
+ /* Otherwise do recursive type lookup */
+ do {
+ if (marshal_helper == MARSHAL_HELPER_IMPORT_DONE)
+ pygi_type_import_by_g_type (ptype);
+
if ((tm = g_type_get_qdata(ptype, pyg_type_marshal_key)) != NULL)
break;
ptype = g_type_parent(ptype);
+ } while (ptype);
+
+ if (marshal_helper == MARSHAL_HELPER_NONE) {
+ marshal_helper = (tm == NULL) ?
+ MARSHAL_HELPER_RETURN_NULL:
+ MARSHAL_HELPER_IMPORT_DONE;
+ g_type_set_qdata(type, pyg_type_marshal_helper_key,
+ GINT_TO_POINTER(marshal_helper));
}
return tm;
}
{
PyGTypeMarshal *tm;
- if (!pyg_type_marshal_key)
- pyg_type_marshal_key = g_quark_from_static_string("PyGType::marshal");
+ if (!pyg_type_marshal_key) {
+ pyg_type_marshal_key = g_quark_from_static_string("PyGType::marshal");
+ pyg_type_marshal_helper_key = g_quark_from_static_string("PyGType::marshal-helper");
+ }
tm = g_new(PyGTypeMarshal, 1);
tm->fromvalue = from_func;
[flake8]
ignore=E501,E123,E124,E402,E731,E722
builtins=long,unicode,basestring
+
+[coverage:run]
+branch=True
+include=
+ gi/*
+ tests/*
+ pygtkcompat/*
test_resulttuple.py \
test_unknown.py \
test_ossig.py \
+ conftest.py \
__init__.py \
gi/__init__.py \
gi/overrides/__init__.py \
test_resulttuple.py \
test_unknown.py \
test_ossig.py \
+ conftest.py \
__init__.py \
gi/__init__.py \
gi/overrides/__init__.py \
from io import StringIO
StringIO
PY3 = True
+
+ def reraise(tp, value, tb):
+ raise tp(value).with_traceback(tb)
else:
_long = long
_basestring = basestring
from StringIO import StringIO
StringIO
PY2 = True
+
+ exec("def reraise(tp, value, tb):\n raise tp, value, tb")
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+
+import pytest
+
+from .compathelper import reraise
+
+
+@pytest.hookimpl(hookwrapper=True)
+def pytest_runtest_call(item):
+ """A pytest hook which takes over sys.excepthook and raises any uncaught
+ exception (with PyGObject this happesn often when we get called from C,
+ like any signal handler, vfuncs tc)
+ """
+
+ assert sys.excepthook is sys.__excepthook__
+
+ exceptions = []
+
+ def on_hook(type_, value, tback):
+ exceptions.append((type_, value, tback))
+
+ sys.excepthook = on_hook
+ try:
+ yield
+ finally:
+ assert sys.excepthook in (on_hook, sys.__excepthook__)
+ sys.excepthook = sys.__excepthook__
+ if exceptions:
+ reraise(*exceptions[0])
{
return self->cptr;
}
+
+/**
+ * regress_test_array_fixed_boxed_none_out
+ * @objs: (out) (array fixed-size=2) (transfer none): An array of #RegressTestBoxedC
+**/
+void
+regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs)
+{
+ static RegressTestBoxedC **arr;
+
+ if (arr == NULL) {
+ arr = g_new0 (RegressTestBoxedC *, 3);
+ arr[0] = regress_test_boxed_c_new ();
+ arr[1] = regress_test_boxed_c_new ();
+ }
+
+ *objs = arr;
+}
+
+/**
+ * regress_test_glist_boxed_none_return
+ * Return value: (element-type RegressTestBoxedC) (transfer none):
+**/
+GList *
+regress_test_glist_boxed_none_return (guint count)
+{
+ static GList *list = NULL;
+ if (!list) {
+ while (count > 0) {
+ list = g_list_prepend (list, regress_test_boxed_c_new ());
+ count--;
+ }
+ }
+
+ return list;
+}
+
+/**
+ * regress_test_glist_boxed_full_return
+ * Return value: (element-type RegressTestBoxedC) (transfer full):
+**/
+GList *
+regress_test_glist_boxed_full_return (guint count)
+{
+ GList *list = NULL;
+ while (count > 0) {
+ list = g_list_prepend (list, regress_test_boxed_c_new ());
+ count--;
+ }
+ return list;
+}
_GI_TEST_EXTERN
RegressTestBoxedC *regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *self);
+_GI_TEST_EXTERN
+void regress_test_array_fixed_boxed_none_out (RegressTestBoxedC ***objs);
+_GI_TEST_EXTERN
+GList *regress_test_glist_boxed_none_return (guint count);
+_GI_TEST_EXTERN
+GList *regress_test_glist_boxed_full_return (guint count);
+
#endif /* REGRESS_EXTRA_H */
from __future__ import absolute_import
+import os
import unittest
try:
self.assertEqual(repr(Gdk.SELECTION_CLIPBOARD), 'Gdk.Atom.intern("CLIPBOARD", False)')
+ @unittest.skipUnless(os.name != "nt", "not on Windows")
def test_in_single(self):
a_selection = Gdk.Atom.intern('test_clipboard', False)
clipboard = Gtk.Clipboard.get(a_selection)
self.assertEqual(obj.refcount, 1)
del obj
+ def test_array_fixed_boxed_none_out(self):
+ arr = Everything.test_array_fixed_boxed_none_out()
+ assert len(arr) == 2
+ assert arr[0].refcount == 2
+ assert arr[1].refcount == 2
+
+ def test_glist_boxed_none_return(self):
+ assert len(Everything.test_glist_boxed_none_return(0)) == 0
+
+ list_ = Everything.test_glist_boxed_none_return(2)
+ assert len(list_) == 2
+ assert list_[0].refcount == 2
+ assert list_[1].refcount == 2
+
+ def test_glist_boxed_full_return(self):
+ assert len(Everything.test_glist_boxed_full_return(0)) == 0
+
+ list_ = Everything.test_glist_boxed_full_return(2)
+ assert len(list_) == 2
+ assert list_[0].refcount == 1
+ assert list_[1].refcount == 1
+
class TestTortureProfile(unittest.TestCase):
def test_torture_profile(self):
import warnings
import subprocess
+import pytest
from gi.repository import GLib
from gi import PyGIDeprecationWarning
class TestGLib(unittest.TestCase):
+ @pytest.mark.xfail(strict=True)
+ def test_pytest_capture_error_in_closure(self):
+ # this test is supposed to fail
+ ml = GLib.MainLoop()
+
+ def callback():
+ ml.quit()
+ raise Exception("expected")
+
+ GLib.idle_add(callback)
+ ml.run()
+
@unittest.skipIf(os.name == "nt", "no bash on Windows")
def test_find_program_in_path(self):
bash_path = GLib.find_program_in_path('bash')
from __future__ import absolute_import
import os
-import sys
import select
import signal
import unittest
from gi.repository import GLib
+from .helper import capture_exceptions
+
class TestMainLoop(unittest.TestCase):
os.write(pipe_w, b"Y")
os.close(pipe_w)
- def excepthook(type, value, traceback):
- self.assertTrue(type is Exception)
- self.assertEqual(value.args[0], "deadbabe")
- sys.excepthook = excepthook
- try:
- got_exception = False
- try:
- loop.run()
- except:
- got_exception = True
- finally:
- sys.excepthook = sys.__excepthook__
-
- #
- # The exception should be handled (by printing it)
- # immediately on return from child_died() rather
- # than here. See bug #303573
- #
- self.assertFalse(got_exception)
+ with capture_exceptions() as exc:
+ loop.run()
+
+ assert len(exc) == 1
+ assert exc[0].type is Exception
+ assert exc[0].value.args[0] == "deadbabe"
@unittest.skipUnless(hasattr(os, "fork"), "no os.fork available")
def test_sigint(self):
from __future__ import absolute_import
import unittest
-import sys
# py3k has StringIO in a different module
try:
from gi.repository import GLib
+from .helper import capture_exceptions
+
class TestOption(unittest.TestCase):
- EXCEPTION_MESSAGE = "This callback fails"
def setUp(self):
self.parser = GLib.option.OptionParser("NAMES...",
def _create_group(self):
def option_callback(option, opt, value, parser):
- raise Exception(self.EXCEPTION_MESSAGE)
+ raise Exception("foo")
group = GLib.option.OptionGroup(
"unittest", "Unit test options", "Show all unittest options",
def test_standard_error(self):
self._create_group()
- sio = StringIO()
- old_stderr = sys.stderr
- sys.stderr = sio
- try:
+
+ with capture_exceptions() as exc:
self.parser.parse_args(
["test_option.py", "--callback-failure-test"])
- finally:
- sys.stderr = old_stderr
- assert (sio.getvalue().split('\n')[-2] ==
- "Exception: " + self.EXCEPTION_MESSAGE)
+ assert len(exc) == 1
+ assert exc[0].value.args[0] == "foo"
from __future__ import absolute_import
import sys
-import gc
import unittest
import warnings
return s
s = f()
- gc.collect()
self.assertTrue(s.is_destroyed())
def test_remove(self):
self.finalized = True
source = S()
- self.assertEqual(source.ref_count, 1)
- source.attach()
- self.assertEqual(source.ref_count, 2)
+ id = source.attach()
+ print('source id:', id)
self.assertFalse(self.finalized)
self.assertFalse(source.is_destroyed())
pass
source.destroy()
- self.assertEqual(source.ref_count, 1)
self.assertTrue(self.dispatched)
self.assertFalse(self.finalized)
self.assertTrue(source.is_destroyed())