#! /bin/python3 import os, errno import json import subprocess current_path = os.path.dirname(os.path.realpath(__file__)) for filename in os.listdir(current_path + "/../package_srcnames/"): pkgname_lines = [] file = open(current_path + "/../package_srcnames/" + filename) for line in file.readlines(): srcname = line.strip() result = subprocess.run([current_path + '/get-bin-name-from-src.sh', srcname], stdout=subprocess.PIPE) stdout = result.stdout.decode('utf-8') for line in stdout.splitlines(): if line != "": pkgname_lines.append(line) pkgname_lines.append(line+"t64") file.close() pkg_data = { 'package_names': [pkg_name for pkg_name in pkgname_lines] } with open(current_path + "/../generated-output/bin-names-of-src-lists/" + filename, "w") as twitterDataFile: twitterDataFile.write( json.dumps(pkg_data, indent=4) )