Mercurial > hgrepos > FreeBSD > ports > PyPy
comparison lang/pypy2/misc/augment_plist.py @ 126:1c224aaef1af
Now also include the byte-compiled Python files (.pyc, .pyo) by default
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 14 Jan 2024 00:22:39 +0100 |
| parents | lang/pypy3/misc/augment_plist.py@3b09db02a788 |
| children |
comparison
equal
deleted
inserted
replaced
| 125:e11577711968 | 126:1c224aaef1af |
|---|---|
| 1 # -*- coding: utf-8 -*- | |
| 2 r"""Augment the current pkg-plist with entries for byte-compiled files. | |
| 3 | |
| 4 The result is written to stdout. | |
| 5 | |
| 6 Usage: augment_plist.py INPUT | |
| 7 | |
| 8 Python | |
| 9 | |
| 10 """ | |
| 11 | |
| 12 from __future__ import print_function, absolute_import | |
| 13 | |
| 14 import io | |
| 15 import os | |
| 16 import re | |
| 17 import sys | |
| 18 | |
| 19 | |
| 20 def main(): | |
| 21 | |
| 22 infile = sys.argv[1] | |
| 23 outlines = [] | |
| 24 | |
| 25 for line_orig in io.open(infile, encoding="us-ascii"): | |
| 26 outlines.append(line_orig) | |
| 27 line = line_orig.rstrip() | |
| 28 if not line: | |
| 29 continue | |
| 30 # | |
| 31 # NOTE: Sync with the "compileall" installation step in the Makefile | |
| 32 # | |
| 33 if re.search("/tests?/|tools/make_ssl_data.py", line): | |
| 34 continue | |
| 35 | |
| 36 if line.endswith(".py"): | |
| 37 for compiled_suffix in ('c', 'o'): | |
| 38 outlines.append( | |
| 39 "%%BYTECOMPILE%%{line}{compiled_suffix}\n" | |
| 40 .format(line=line, compiled_suffix=compiled_suffix)) | |
| 41 for line in outlines: | |
| 42 sys.stdout.write(line) | |
| 43 | |
| 44 | |
| 45 if __name__ == "__main__": | |
| 46 main() |
