aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-05-29 20:29:28 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2018-03-19 23:45:43 +0200
commitd012b5b997e917a971bca1236a065453493c780d (patch)
treeb7e0737ea9d22d2a6b0b3a0a29bdc7c78d824ea5 /mesonbuild/backend/ninjabackend.py
parente984e1072b28abfa4ac278992a8ef6d138c15608 (diff)
downloadmeson-d012b5b997e917a971bca1236a065453493c780d.zip
meson-d012b5b997e917a971bca1236a065453493c780d.tar.gz
meson-d012b5b997e917a971bca1236a065453493c780d.tar.bz2
Create a helper for checking if a string has a path component
This is used in a number of places, and in some places it is incomplete. Use a helper to ensure it's used properly.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index ba249ed..9500d69 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -27,7 +27,7 @@ from .. import compilers
from ..compilers import CompilerArgs
from ..linkers import ArLinker
from ..mesonlib import File, MesonException, OrderedSet
-from ..mesonlib import get_compiler_for_source
+from ..mesonlib import get_compiler_for_source, has_path_sep
from .backends import CleanTrees, InstallData
from ..build import InvalidArguments
@@ -1335,7 +1335,7 @@ int dummy;
# Set runtime-paths so we can run executables without needing to set
# LD_LIBRARY_PATH, etc in the environment. Doesn't work on Windows.
- if '/' in target.name or '\\' in target.name:
+ if has_path_sep(target.name):
# Target names really should not have slashes in them, but
# unfortunately we did not check for that and some downstream projects
# now have them. Once slashes are forbidden, remove this bit.
@@ -2324,7 +2324,7 @@ rule FORTRAN_DEP_HACK
# FIXME FIXME: The usage of this is a terrible and unreliable hack
if isinstance(fname, File):
return fname.subdir != ''
- return '/' in fname or '\\' in fname
+ return has_path_sep(fname)
# Fortran is a bit weird (again). When you link against a library, just compiling a source file
# requires the mod files that are output when single files are built. To do this right we would need to
@@ -2370,7 +2370,7 @@ rule FORTRAN_DEP_HACK
pch = target.get_pch(lang)
if not pch:
continue
- if '/' not in pch[0] or '/' not in pch[-1]:
+ if not has_path_sep(pch[0]) or not has_path_sep(pch[-1]):
msg = 'Precompiled header of {!r} must not be in the same ' \
'directory as source, please put it in a subdirectory.' \
''.format(target.get_basename())
@@ -2547,7 +2547,7 @@ rule FORTRAN_DEP_HACK
commands += linker.get_option_link_args(self.environment.coredata.compiler_options)
# Set runtime-paths so we can run executables without needing to set
# LD_LIBRARY_PATH, etc in the environment. Doesn't work on Windows.
- if '/' in target.name or '\\' in target.name:
+ if has_path_sep(target.name):
# Target names really should not have slashes in them, but
# unfortunately we did not check for that and some downstream projects
# now have them. Once slashes are forbidden, remove this bit.