Rev 9377 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9377 | Rev 9411 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | # Then get to the beginning of the string |
60 | # Then get to the beginning of the string |
61 | ptr = get_to(src, ptr, "\"", backwards = True) |
61 | ptr = get_to(src, ptr, "\"", backwards = True) |
62 | # Now we can read the string |
62 | # Now we can read the string |
63 | return get_strnig(src, ptr) |
63 | return get_strnig(src, ptr) |
Line -... | Line 64... | ||
- | 64 | ||
- | 65 | def parse_required_compiler(src, ptr): |
|
- | 66 | # Get straignt to the first argument |
|
- | 67 | ptr += len("tup.getconfig") |
|
- | 68 | # Get to parenthese |
|
- | 69 | ptr = get_to(src, ptr, "(") |
|
- | 70 | # Get to start of the requirement string |
|
- | 71 | ptr = get_to(src, ptr, "\"") |
|
- | 72 | # Read the requirement string (like NO_FASM) |
|
- | 73 | requirement_string = get_strnig(src, ptr) |
|
- | 74 | if requirement_string.startswith("NO_"): |
|
- | 75 | return requirement_string[len("NO_"):].lower().replace("_", "-") |
|
- | 76 | else: |
|
- | 77 | return None |
|
64 | 78 | ||
65 | def parse_tupfile_outputs(file_name): |
79 | def parse_tupfile_outputs(file_name): |
66 | outputs = [] |
80 | outputs = [] |
67 | with open(file_name) as f: |
81 | with open(file_name) as f: |
68 | tupfile = f.read() |
82 | tupfile = f.read() |
69 | rule_begin_index = tupfile.find("tup.rule(") |
83 | rule_begin_index = tupfile.find("tup.rule(") |
70 | while (rule_begin_index != -1): |
84 | while (rule_begin_index != -1): |
71 | outputs.append(parse_rule_output(tupfile, rule_begin_index)) |
85 | outputs.append(parse_rule_output(tupfile, rule_begin_index)) |
72 | # Find the next tup.rule call |
86 | # Find the next tup.rule call |
73 | rule_begin_index = tupfile.find("tup.rule(", rule_begin_index + len("tup.rule(")) |
87 | rule_begin_index = tupfile.find("tup.rule(", rule_begin_index + len("tup.rule(")) |
- | 88 | return outputs |
|
- | 89 | ||
- | 90 | def parse_required_compilers(file_name): |
|
- | 91 | compilers = [] |
|
- | 92 | with open(file_name) as f: |
|
- | 93 | tupfile = f.read() |
|
- | 94 | rule_begin_index = tupfile.find("tup.getconfig(") |
|
- | 95 | while (rule_begin_index != -1): |
|
- | 96 | required_compiler = parse_required_compiler(tupfile, rule_begin_index) |
|
- | 97 | if required_compiler is not None: |
|
- | 98 | compilers.append(required_compiler) |
|
- | 99 | # Find the next tup.getconfig call |
|
- | 100 | rule_begin_index = tupfile.find("tup.getconfig(", rule_begin_index + len("tup.getconfig")) |
|
- | 101 | return compilers |