File: sed_coverage_rc.py

package info (click to toggle)
python-falcon 3.1.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,204 kB
  • sloc: python: 28,455; makefile: 184; sh: 139; javascript: 66
file content (24 lines) | stat: -rwxr-xr-x 532 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
"""Patch .coveragerc to drop some 3.10-specific pragmas."""

import pathlib
import sys

HERE = pathlib.Path(__file__).resolve().parent
ROOT = HERE.parent


def sed_coverage_rc():
    with open(ROOT / '.coveragerc', 'a+') as fp:
        fp.seek(0)
        content = fp.read()
        patched = content.replace('    pragma: no py39,py310 cover\n', '')

        fp.seek(0)
        fp.truncate()
        fp.write(patched)


if __name__ == '__main__':
    if sys.version_info < (3, 9, 0):
        sed_coverage_rc()