mirror of https://github.com/python/cpython
bpo-45101: Add consistency in usage message IO between 2 versions of python-config (GH-28162)
On --help output to stdout. On error output to stderr.
This commit is contained in:
parent
da382aaf52
commit
de2a73dc46
|
@ -0,0 +1 @@
|
||||||
|
Add consistency in usage message IO between 2 versions of python-config.
|
|
@ -13,7 +13,8 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
|
||||||
|
|
||||||
def exit_with_usage(code=1):
|
def exit_with_usage(code=1):
|
||||||
print("Usage: {0} [{1}]".format(
|
print("Usage: {0} [{1}]".format(
|
||||||
sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr)
|
sys.argv[0], '|'.join('--'+opt for opt in valid_opts)),
|
||||||
|
file=sys.stdout if code == 0 else sys.stderr)
|
||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
|
|
||||||
exit_with_usage ()
|
exit_with_usage ()
|
||||||
{
|
{
|
||||||
echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
local USAGE="Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed"
|
||||||
|
if [[ "$1" -eq 0 ]]; then
|
||||||
|
echo "$USAGE"
|
||||||
|
else
|
||||||
|
echo "$USAGE" >&2
|
||||||
|
fi
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue