(cls, pxifiles)
| 76 | class build_ext(_build_ext): |
| 77 | @classmethod |
| 78 | def render_templates(cls, pxifiles) -> None: |
| 79 | for pxifile in pxifiles: |
| 80 | # build pxifiles first, template extension must be .pxi.in |
| 81 | assert pxifile.endswith(".pxi.in") |
| 82 | outfile = pxifile[:-3] |
| 83 | |
| 84 | if ( |
| 85 | os.path.exists(outfile) |
| 86 | and os.stat(pxifile).st_mtime < os.stat(outfile).st_mtime |
| 87 | ): |
| 88 | # if .pxi.in is not updated, no need to output .pxi |
| 89 | continue |
| 90 | |
| 91 | with open(pxifile, encoding="utf-8") as f: |
| 92 | tmpl = f.read() |
| 93 | pyxcontent = Tempita.sub(tmpl) |
| 94 | |
| 95 | with open(outfile, "w", encoding="utf-8") as f: |
| 96 | f.write(pyxcontent) |
| 97 | |
| 98 | def build_extensions(self) -> None: |
| 99 | # if building from c files, don't need to |
no test coverage detected