aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-04-17 01:23:44 +0300
committerGitHub <noreply@github.com>2018-04-17 01:23:44 +0300
commitf7a7059250ab9cf71c68ca78812a24a35ee745f6 (patch)
treec45c26cc197ca98312243f4c3804914301ecc6f9 /mesonbuild/build.py
parentc58dd64f8e947f4659bcbc47d75e86e65043e714 (diff)
parenta64d16c6bb048a2f2b35bc91abdfad21a8b65f6b (diff)
downloadmeson-f7a7059250ab9cf71c68ca78812a24a35ee745f6.zip
meson-f7a7059250ab9cf71c68ca78812a24a35ee745f6.tar.gz
meson-f7a7059250ab9cf71c68ca78812a24a35ee745f6.tar.bz2
Merge pull request #3246 from sarum9in/non-unique-target-names
Allow same target names in different subdirectories
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 47c40a2..e707053 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -310,11 +310,16 @@ a hard error in the future.''' % name)
def get_id(self):
# This ID must also be a valid file name on all OSs.
# It should also avoid shell metacharacters for obvious
- # reasons.
- base = self.name + self.type_suffix()
- if self.subproject == '':
- return base
- return self.subproject + '@@' + base
+ # reasons. '@' is not used as often as '_' in source code names.
+ # In case of collisions consider using checksums.
+ # FIXME replace with assert when slash in names is prohibited
+ name_part = self.name.replace('/', '@').replace('\\', '@')
+ assert not has_path_sep(self.type_suffix())
+ myid = name_part + self.type_suffix()
+ if self.subdir:
+ subdir_part = self.subdir.replace('/', '@').replace('\\', '@')
+ myid = subdir_part + '@@' + myid
+ return myid
def process_kwargs(self, kwargs):
if 'build_by_default' in kwargs: