aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/envconfig.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-11 13:37:11 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-01-11 11:15:07 -0800
commit0076db6ff9309a34e2b86a6ae3fd85ff34b8f9f3 (patch)
treee3f544c4911ab7adb96b2f468a2ea19231e7d2e7 /mesonbuild/envconfig.py
parentf3fcbba1f89f0b2a323dd596a3caf4fce5a1611e (diff)
downloadmeson-0076db6ff9309a34e2b86a6ae3fd85ff34b8f9f3.zip
meson-0076db6ff9309a34e2b86a6ae3fd85ff34b8f9f3.tar.gz
meson-0076db6ff9309a34e2b86a6ae3fd85ff34b8f9f3.tar.bz2
move get_env_var_pair to environment
This is only used in environment, so it should live there too.
Diffstat (limited to 'mesonbuild/envconfig.py')
-rw-r--r--mesonbuild/envconfig.py36
1 files changed, 2 insertions, 34 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index 596defe..c133ec9 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -12,20 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os, subprocess
+import subprocess
import typing as T
from enum import Enum
from . import mesonlib
-from .mesonlib import EnvironmentException, MachineChoice, PerMachine, split_args
+from .mesonlib import EnvironmentException
from . import mlog
from pathlib import Path
-_T = T.TypeVar('_T')
-
-if T.TYPE_CHECKING:
- from .environment import Environment
-
# These classes contains all the data pulled from configuration files (native
# and cross file currently), and also assists with the reading environment
@@ -136,33 +131,6 @@ class CMakeSkipCompilerTest(Enum):
NEVER = 'never'
DEP_ONLY = 'dep_only'
-
-def get_env_var_pair(for_machine: MachineChoice,
- is_cross: bool,
- var_name: str) -> T.Optional[T.Tuple[str, str]]:
- """
- Returns the exact env var and the value.
- """
- candidates = PerMachine(
- # The prefixed build version takes priority, but if we are native
- # compiling we fall back on the unprefixed host version. This
- # allows native builds to never need to worry about the 'BUILD_*'
- # ones.
- ([var_name + '_FOR_BUILD'] if is_cross else [var_name]),
- # Always just the unprefixed host verions
- [var_name]
- )[for_machine]
- for var in candidates:
- value = os.environ.get(var)
- if value is not None:
- break
- else:
- formatted = ', '.join(['{!r}'.format(var) for var in candidates])
- mlog.debug('None of {} are defined in the environment, not changing global flags.'.format(formatted))
- return None
- mlog.debug('Using {!r} from environment with value: {!r}'.format(var, value))
- return var, value
-
class Properties:
def __init__(
self,