2019-04-26 01:05:06 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
in_, out, index_md = sys.argv[1], sys.argv[2], sys.argv[3]
|
|
|
|
with open(in_) as f:
|
2019-05-26 22:32:55 +00:00
|
|
|
|
2019-04-26 01:05:06 +00:00
|
|
|
index = f.read()
|
2019-05-26 22:32:55 +00:00
|
|
|
index = '\n'.join(l for l in index.splitlines())
|
|
|
|
|
2019-04-26 01:05:06 +00:00
|
|
|
if sys.argv[4]:
|
|
|
|
libs, plugins = sys.argv[4].split(os.pathsep), sorted(
|
2023-03-19 18:35:29 +00:00
|
|
|
sys.argv[5].replace('\n', '').split(os.pathsep), key=lambda x: os.path.basename(x))
|
2019-05-26 22:32:55 +00:00
|
|
|
index += '\n\tlibs.md'
|
2019-04-26 01:05:06 +00:00
|
|
|
for lib in libs:
|
|
|
|
if not lib:
|
|
|
|
continue
|
2019-05-26 22:32:55 +00:00
|
|
|
index += "\n\t\t" + lib + '.json'
|
|
|
|
index += '\n\tgst-index'
|
2019-04-26 01:05:06 +00:00
|
|
|
for plugin in plugins:
|
|
|
|
if not plugin:
|
|
|
|
continue
|
2023-03-19 18:35:29 +00:00
|
|
|
fname = plugin
|
|
|
|
if not fname.endswith('.json'):
|
|
|
|
fname += '.json'
|
|
|
|
index += "\n\t\t" + fname
|
2019-05-26 22:32:55 +00:00
|
|
|
|
|
|
|
index = '%s\n%s' % (index_md, index)
|
|
|
|
|
2019-04-26 01:05:06 +00:00
|
|
|
with open(out, 'w') as fw:
|
|
|
|
fw.write(index)
|