2017-10-11 20:26:37 +00:00
|
|
|
import fnmatch
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
from shutil import copyfile
|
|
|
|
|
2018-06-04 15:53:16 +00:00
|
|
|
print('Searching for manifests...')
|
|
|
|
|
2017-10-11 20:26:37 +00:00
|
|
|
matches = []
|
2018-06-04 15:53:16 +00:00
|
|
|
for root, dirnames, filenames in os.walk('bazel-bin\\org\\brotli'):
|
2017-10-11 20:26:37 +00:00
|
|
|
for filename in fnmatch.filter(filenames, '*.runfiles_manifest'):
|
|
|
|
matches.append(os.path.join(root, filename))
|
|
|
|
|
|
|
|
for match in matches:
|
2018-06-04 15:53:16 +00:00
|
|
|
print('Scanning manifest ' + match)
|
2017-10-11 20:26:37 +00:00
|
|
|
runfiles = match[:-len('_manifest')]
|
|
|
|
with open(match) as manifest:
|
|
|
|
for entry in manifest:
|
|
|
|
entry = entry.strip()
|
2018-06-04 15:53:16 +00:00
|
|
|
if not entry.startswith("org_brotli_java"):
|
2017-10-11 20:26:37 +00:00
|
|
|
continue
|
2018-06-04 15:53:16 +00:00
|
|
|
if entry.startswith('org_brotli_java/external'):
|
2017-10-11 20:26:37 +00:00
|
|
|
continue
|
|
|
|
(alias, space, link) = entry.partition(' ')
|
|
|
|
if alias.endswith('.jar') or alias.endswith('.exe'):
|
|
|
|
continue
|
|
|
|
link = link.replace('/', '\\')
|
|
|
|
alias = alias.replace('/', '\\')
|
|
|
|
dst = os.path.join(runfiles, alias)
|
|
|
|
if not os.path.exists(dst):
|
|
|
|
print(link + ' -> ' + dst)
|
|
|
|
parent = os.path.dirname(dst)
|
|
|
|
if not os.path.exists(parent):
|
|
|
|
os.makedirs(parent)
|
|
|
|
copyfile(link, dst)
|
2018-06-04 15:53:16 +00:00
|
|
|
|
|
|
|
print('Finished resolving symlinks')
|