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