forked from mumble-voip/mumble
-
Notifications
You must be signed in to change notification settings - Fork 0
/
python.pri
72 lines (70 loc) · 2.17 KB
/
python.pri
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright 2005-2016 The Mumble Developers. All rights reserved.
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file at the root of the
# Mumble source tree or at <https://www.mumble.info/LICENSE>.
# This .pri files finds a suitable Python binary on the system.
#
# It exposes the found Python binary as the 'PYTHON' qmake variable.
# This variable contains the absolute path to a working Python binary.
#
# Why do we need to do this?
#
# Some systems (for example, OpenBSD's Python port), are not
# PEP 394 (https://www.python.org/dev/peps/pep-0394/) compliant.
#
# This means that there is no 'python', 'python2' or 'python3'
# binaries in the $PATH.
#
# On those systems, we can't rely on a '#!/usr/bin/env python2'
# or similar shebang. We have to query the system for versioned
# Python binaries like "python2.7" instead.
#
# This file does that, by searching in $PATH using the 'which'
# tool.
#
# If no binary is found, an error is shown to the user.
#
# This script also supports setting a MUMBLE_PYTHON environment
# variable to specify an absolute path to a Python binary to use.
# Setting this environment variable overrides any querying.
win32 {
PYTHON = $$(MUMBLE_PYTHON)
isEmpty(PYTHON) {
PYTHON=python
}
} else {
PYTHON = $$(MUMBLE_PYTHON)
isEmpty(PYTHON) {
PYTHON=$$system(which python 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python2 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python2.7 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.0 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.1 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.2 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.3 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.4 2>/dev/null)
}
isEmpty(PYTHON) {
PYTHON=$$system(which python3.5 2>/dev/null)
}
isEmpty(PYTHON) {
error("Unable to find the system's Python binary. Some scripts invoked during the Mumble build use Python. You can manually specify it via the MUMBLE_PYTHON environment variable (either 2 or 3).")
}
}