Prevent creation of targets with names that could lead to collisions.

pull/15/head
Jussi Pakkanen 12 years ago
parent bbed8ec3d1
commit f010ec624c
  1. 11
      coredata.py
  2. 6
      interpreter.py

@ -55,3 +55,14 @@ def save(obj, filename):
if obj.version != version:
raise RuntimeError('Fatal version mismatch corruption.')
pickle.dump(obj, open(filename, 'wb'))
forbidden_target_names = {'clean': None,
'coverage-text': None,
'coverage-xml': None,
'coverage-html': None,
'phony': None,
'all': None,
'test': None,
'install': None,
'build.ninja': None
}

@ -17,6 +17,7 @@
import mparser
import nodes
import environment
import coredata
import os, sys, platform
import shutil
@ -662,7 +663,7 @@ class Interpreter():
libname = args[0]
if libname in self.coredata.ext_libs and\
self.coredata.ext_libs[libname].found():
return ExternalLibraryHolder(self.coredata.ext_progs[libname])
return ExternalLibraryHolder(self.coredata.ext_libs[libname])
result = self.environment.find_library(libname)
extlib = environment.ExternalLibrary(libname, result)
libobj = ExternalLibraryHolder(extlib)
@ -789,6 +790,9 @@ class Interpreter():
args = self.flatten(args)
name = args[0]
sources = args[1:]
if name in coredata.forbidden_target_names:
raise InvalidArguments('Line %d: target name "%s" is reserved for Meson\'s internal use. Please rename.'\
% (node.lineno(), name))
try:
kw_src = self.flatten(kwargs['sources'])
if not isinstance(kw_src, list):

Loading…
Cancel
Save