Mercurial > hgrepos > FreeBSD > ports > PyPy
view lang/pypy3/misc/augment_plist.py @ 120:3b09db02a788
Move the old lang/pypy3 repo into the lang/pypy3 folder
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 12 Jan 2024 09:23:35 +0100 |
| parents | misc/augment_plist.py@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()
