File: python-config-wrapper

package info (click to toggle)
pyotherside 1.5.9-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 836 kB
  • sloc: cpp: 2,850; python: 468; makefile: 144; sh: 32
file content (38 lines) | stat: -rwxr-xr-x 763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# python3-config wrapper script to support Python 3.8
# Works around https://bugs.python.org/issue36721

set -e

usage() {
    echo "Usage: $0 [python3-config] (--libs|--includes)"
    exit 1
}

if [ $# -ne 2 ]; then
    usage
fi

PYTHON_CONFIG="$1"
shift

WHICH_FLAG="$1"
shift

case "$WHICH_FLAG" in
    --libs)
        # Python 3.8 needs --embed, but previous versions do not have it:
        # https://github.com/python/cpython/pull/13500
        if "$PYTHON_CONFIG" --ldflags --libs --embed >/dev/null 2>&1; then
            "$PYTHON_CONFIG" --ldflags --libs --embed
        else
            "$PYTHON_CONFIG" --ldflags --libs
        fi
        ;;
    --includes)
        "$PYTHON_CONFIG" --includes
        ;;
    *)
        usage
        ;;
esac