Skip to content

bpo-45101: Add consistency in usage message IO between 2 versions of python-config #28162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add consistency in usage message IO between 2 versions of python-config.
3 changes: 2 additions & 1 deletion Misc/python-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',

def exit_with_usage(code=1):
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)

try:
Expand Down
7 changes: 6 additions & 1 deletion Misc/python-config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

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
}

Expand Down