Mercurial > hgrepos > FreeBSD > ports > PyPy
view misc/augment_plist.py @ 118:8fdcad577b4f
Generate and verify distinfo.py310
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 10 Jan 2024 21:10:22 +0100 |
| parents | ce7e2a955814 |
| children |
line wrap: on
line source
# -*- coding: utf-8 -*- r"""Augment the current pkg-plist with entries for byte-compiled files. The result is written to stdout. Usage: augment_plist.py INPUT Python """ from __future__ import print_function, absolute_import import io import os import re import sys def main(): infile = sys.argv[1] outlines = [] for line_orig in io.open(infile, encoding="us-ascii"): outlines.append(line_orig) line = line_orig.rstrip() if not line: continue # # NOTE: Sync with the "compileall" installation step in the Makefile # if re.search("/tests?/", line): continue if line.endswith(".py"): directory, filename = os.path.split(line) base, ext = os.path.splitext(filename) for opt in ("", ".opt-1", ".opt-2"): outlines.append( "%%BYTECOMPILE%%{directory}/__pycache__/{base}%%PYPY_BCTAG%%{opt}.pyc\n" .format(directory=directory, base=base, opt=opt)) for line in outlines: sys.stdout.write(line) if __name__ == "__main__": main()
