|
Kevin Kofler |
17d0457 |
#!/usr/bin/python
|
|
Kevin Kofler |
17d0457 |
# Copyright 2013 Tomas Popela <tpopela@redhat.com>
|
|
Kevin Kofler |
17d0457 |
# Permission is hereby granted, free of charge, to any person obtaining
|
|
Kevin Kofler |
17d0457 |
# a copy of this software and associated documentation files (the
|
|
Kevin Kofler |
17d0457 |
# "Software"), to deal in the Software without restriction, including
|
|
Kevin Kofler |
17d0457 |
# without limitation the rights to use, copy, modify, merge, publish,
|
|
Kevin Kofler |
17d0457 |
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
Kevin Kofler |
17d0457 |
# permit persons to whom the Software is furnished to do so, subject to
|
|
Kevin Kofler |
17d0457 |
# the following conditions:
|
|
Kevin Kofler |
17d0457 |
#
|
|
Kevin Kofler |
17d0457 |
# The above copyright notice and this permission notice shall be included
|
|
Kevin Kofler |
17d0457 |
# in all copies or substantial portions of the Software.
|
|
Kevin Kofler |
17d0457 |
#
|
|
Kevin Kofler |
17d0457 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
Kevin Kofler |
17d0457 |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Kevin Kofler |
17d0457 |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
Kevin Kofler |
17d0457 |
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
Kevin Kofler |
17d0457 |
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
Kevin Kofler |
17d0457 |
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
Kevin Kofler |
17d0457 |
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
Kevin Kofler |
17d0457 |
|
|
Kevin Kofler |
17d0457 |
import sys
|
|
Kevin Kofler |
17d0457 |
import re
|
|
Kevin Kofler |
17d0457 |
|
|
Kevin Kofler |
17d0457 |
if __name__ == "__main__":
|
|
Kevin Kofler |
17d0457 |
path = "%s/ffmpeg_generated.gypi" % sys.argv[1]
|
|
Kevin Kofler |
17d0457 |
with open(path, "r") as input_file:
|
|
Kevin Kofler |
17d0457 |
content = input_file.read().replace('\n', '')
|
|
Kevin Kofler |
17d0457 |
|
|
Kevin Kofler |
17d0457 |
brandings = ['ChromeOS', 'ChromiumOS', 'win', 'Chrome']
|
|
Kevin Kofler |
17d0457 |
output_duplicates = []
|
|
Kevin Kofler |
17d0457 |
sections = re.findall('\[([^\}]*)\]', content)
|
|
Kevin Kofler |
17d0457 |
for section in sections:
|
|
Kevin Kofler |
17d0457 |
condition = re.findall("'([^']*)'", section)
|
|
Kevin Kofler |
17d0457 |
if not any(x in condition[0] for x in brandings):
|
|
Kevin Kofler |
17d0457 |
for source_file in condition[1:]:
|
|
Kevin Kofler |
17d0457 |
output_duplicates.append(
|
|
Kevin Kofler |
17d0457 |
source_file.replace('<(shared_generated_dir)/', ''))
|
|
Kevin Kofler |
17d0457 |
|
|
Kevin Kofler |
17d0457 |
output = list(set(output_duplicates))
|
|
Kevin Kofler |
17d0457 |
output.remove('c_sources')
|
|
Kevin Kofler |
17d0457 |
output.remove('asm_sources')
|
|
Kevin Kofler |
17d0457 |
print ' '.join(output)
|