|
7 | 7 | import os |
8 | 8 | import tempfile |
9 | 9 |
|
| 10 | +from itertools import chain |
10 | 11 | from pathlib import Path |
11 | 12 | from zipfile import ZipFile, ZIP_DEFLATED |
12 | 13 | import subprocess |
@@ -74,6 +75,10 @@ def include_in_lib(p): |
74 | 75 | if name in EXCLUDE_FILE_FROM_LIBRARY: |
75 | 76 | return False |
76 | 77 |
|
| 78 | + # Special code is included below to patch this file back in |
| 79 | + if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']: |
| 80 | + return False |
| 81 | + |
77 | 82 | suffix = p.suffix.lower() |
78 | 83 | return suffix not in {'.pyc', '.pyo', '.exe'} |
79 | 84 |
|
@@ -203,10 +208,17 @@ def main(): |
203 | 208 | try: |
204 | 209 | for t, s, p, c in layout: |
205 | 210 | if s == '$build': |
206 | | - s = build |
| 211 | + fs = build |
207 | 212 | else: |
208 | | - s = source / s |
209 | | - copied = copy_to_layout(temp / t.rstrip('/'), rglob(s, p, c)) |
| 213 | + fs = source / s |
| 214 | + files = rglob(fs, p, c) |
| 215 | + extra_files = [] |
| 216 | + if s == 'Lib' and p == '**/*': |
| 217 | + extra_files.append(( |
| 218 | + source / 'tools' / 'msi' / 'distutils.command.__init__.py', |
| 219 | + Path('distutils') / 'command' / '__init__.py' |
| 220 | + )) |
| 221 | + copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) |
210 | 222 | print('Copied {} files'.format(copied)) |
211 | 223 |
|
212 | 224 | with open(str(temp / 'pyvenv.cfg'), 'w') as f: |
|
0 commit comments