An object that encapsulates the compat-level of our build.
| 63 | |
| 64 | |
| 65 | class CompatLevel(object): |
| 66 | """An object that encapsulates the compat-level of our build. |
| 67 | """ |
| 68 | def __init__(self): |
| 69 | makefile = os.path.join(os.path.dirname(__file__), "..", "Makefile") |
| 70 | with open(makefile, 'r') as f: |
| 71 | lines = [l for l in f if l.startswith('COMPAT_CFLAGS')] |
| 72 | assert(len(lines) == 1) |
| 73 | line = lines[0] |
| 74 | flags = re.findall(r'COMPAT_V([0-9]+)=1', line) |
| 75 | self.compat_flags = flags |
| 76 | |
| 77 | def __call__(self, version): |
| 78 | return COMPAT and version in self.compat_flags |
| 79 | |
| 80 | |
| 81 | @pytest.fixture |