2020-07-06 13:38:22 -07:00
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
2021-11-30 01:12:27 +01:00
|
|
|
keyword = "/include/"
|
2020-07-06 13:38:22 -07:00
|
|
|
|
|
|
|
def getFiles(path):
|
|
|
|
files = os.listdir(path)
|
|
|
|
return list(filter(lambda x: x[0] != '.', files))
|
|
|
|
|
|
|
|
def gen_all_file_strings(path, files, headers, output):
|
|
|
|
for file in files:
|
2021-11-30 01:12:27 +01:00
|
|
|
components = file.split("_")
|
|
|
|
package = components[0] + ":" + components[2].replace(".list", "")
|
2020-07-06 13:38:22 -07:00
|
|
|
f = open(path + file)
|
|
|
|
for line in f:
|
2021-11-30 01:12:27 +01:00
|
|
|
if line.strip()[-1] == "/":
|
|
|
|
continue
|
|
|
|
filepath = line[line.find("/"):]
|
|
|
|
output.write(package + ":" + filepath)
|
|
|
|
if filepath.startswith(keyword):
|
|
|
|
headers.write(package + ":" + filepath[len(keyword):])
|
2020-07-06 13:38:22 -07:00
|
|
|
f.close()
|
|
|
|
|
|
|
|
def main(path):
|
|
|
|
try:
|
|
|
|
os.mkdir("scripts/list_files")
|
|
|
|
except FileExistsError:
|
|
|
|
print("Path already exists, continuing...")
|
|
|
|
|
2020-07-13 12:14:51 -07:00
|
|
|
try:
|
|
|
|
headers = open("scripts/list_files/VCPKGHeadersDatabase.txt", mode='w')
|
|
|
|
output = open("scripts/list_files/VCPKGDatabase.txt", mode='w')
|
|
|
|
gen_all_file_strings(path, getFiles(path), headers, output)
|
|
|
|
headers.close()
|
|
|
|
output.close()
|
|
|
|
except e:
|
|
|
|
print("Failed to generate file lists")
|
2020-07-06 13:38:22 -07:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main(sys.argv[1])
|
|
|
|
|