Bug 1293253 - part 8 - factor out a unique binary check function; r=chmanchester

We'll need this for Rust programs as well.
This commit is contained in:
Nathan Froyd 2016-11-28 11:20:39 -05:00
Родитель 0ffe72f61e
Коммит 0464790919
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -540,14 +540,16 @@ class TreeMetadataEmitter(LoggingMixin):
else:
linkables.append(prog)
def check_unique_binary(program, kind):
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" as %s name, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
for kind, cls in [('PROGRAM', Program), ('HOST_PROGRAM', HostProgram)]:
program = context.get(kind)
if program:
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" as %s name, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
check_unique_binary(program, kind)
self._binaries[program] = cls(context, program)
self._linkage.append((context, self._binaries[program],
kind.replace('PROGRAM', 'USE_LIBS')))