1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29

media / ffmpeg / scripts / fake_linker.py [blame]

#!/usr/bin/env python
#
# Copyright 2018 The Chromium Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Find '-o' and create a file with that name if it doesn't already exist.
# Ignore everything else.

import os
import sys

for idx, arg in enumerate(sys.argv[1:]):
    filename = None
    if arg == '-o':
        # Hopefully there is an |idx+1|.
        filename = sys.argv[1:][idx + 1]
    if arg.startswith('-out:'):
        # also handle lld-link argument
        filename = arg.split(':')[-1]
    if filename != None:
        # If the file exists, then take no action.
        if not os.path.exists(filename):
            print("creating fake linker output file: %s" % filename)
            open(filename, "w+").close()
        sys.exit(0)

print("Please supply a '-o filename\' somewhere on the command line")
sys.exit(1)