-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_make_commands.py
More file actions
36 lines (26 loc) · 1.03 KB
/
generate_make_commands.py
File metadata and controls
36 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import yaml
# Define the template for generating make commands
TEMPLATE = """
cp-{fileset_name}:
\t@OUTPUT=$$(python concatenate_files.py {fileset_name}); \\
\techo \"$$OUTPUT\" | pbcopy; \\
\techo \"Fileset '{fileset_name}' contents have been copied to clipboard. Bytes copied: $$(echo -n \"$$OUTPUT\" | wc -c).\";
"""
YAML_FILE_PATH = 'fileset-definitions.yml'
def generate_make_commands_from_filesets(filesets):
"""Generate make commands based on the provided filesets."""
make_commands = ""
for fileset_name in filesets.keys():
make_commands += TEMPLATE.format(fileset_name=fileset_name)
return make_commands
def main():
# Load the filesets from the YAML file
with open(YAML_FILE_PATH, 'r') as f:
filesets = yaml.safe_load(f)
# Generate the make commands
make_commands = generate_make_commands_from_filesets(filesets)
# Print the make commands to stdout
# (this will be redirected to make_commands.mk by the Makefile)
print(make_commands)
if __name__ == '__main__':
main()