|
8 | 8 | __version__ = "3.8" |
9 | 9 |
|
10 | 10 | import argparse |
| 11 | +import json |
11 | 12 | import os |
12 | 13 | import shutil |
13 | 14 | import sys |
|
28 | 29 | from .support.options import * |
29 | 30 | from .support.pip import * |
30 | 31 | from .support.props import * |
| 32 | +from .support.pymanager import * |
31 | 33 | from .support.nuspec import * |
32 | 34 |
|
33 | 35 | TEST_PYDS_ONLY = FileStemSet("xxlimited", "xxlimited_35", "_ctypes_test", "_test*") |
@@ -265,7 +267,12 @@ def _c(d): |
265 | 267 | if ns.include_dev: |
266 | 268 | for dest, src in rglob(ns.source / "Include", "**/*.h"): |
267 | 269 | yield "include/{}".format(dest), src |
268 | | - yield "include/pyconfig.h", ns.build / "pyconfig.h" |
| 270 | + # Support for layout of new and old releases. |
| 271 | + pc = ns.source / "PC" |
| 272 | + if (pc / "pyconfig.h.in").is_file(): |
| 273 | + yield "include/pyconfig.h", ns.build / "pyconfig.h" |
| 274 | + else: |
| 275 | + yield "include/pyconfig.h", pc / "pyconfig.h" |
269 | 276 |
|
270 | 277 | for dest, src in get_tcltk_lib(ns): |
271 | 278 | yield dest, src |
@@ -303,6 +310,9 @@ def _c(d): |
303 | 310 | else: |
304 | 311 | yield "DLLs/{}".format(ns.include_cat.name), ns.include_cat |
305 | 312 |
|
| 313 | + if ns.include_install_json or ns.include_install_embed_json or ns.include_install_test_json: |
| 314 | + yield "__install__.json", ns.temp / "__install__.json" |
| 315 | + |
306 | 316 |
|
307 | 317 | def _compile_one_py(src, dest, name, optimize, checked=True): |
308 | 318 | import py_compile |
@@ -394,6 +404,22 @@ def generate_source_files(ns): |
394 | 404 | log_info("Extracting pip") |
395 | 405 | extract_pip_files(ns) |
396 | 406 |
|
| 407 | + if ns.include_install_json: |
| 408 | + log_info("Generating __install__.json in {}", ns.temp) |
| 409 | + ns.temp.mkdir(parents=True, exist_ok=True) |
| 410 | + with open(ns.temp / "__install__.json", "w", encoding="utf-8") as f: |
| 411 | + json.dump(calculate_install_json(ns), f, indent=2) |
| 412 | + elif ns.include_install_embed_json: |
| 413 | + log_info("Generating embeddable __install__.json in {}", ns.temp) |
| 414 | + ns.temp.mkdir(parents=True, exist_ok=True) |
| 415 | + with open(ns.temp / "__install__.json", "w", encoding="utf-8") as f: |
| 416 | + json.dump(calculate_install_json(ns, for_embed=True), f, indent=2) |
| 417 | + elif ns.include_install_test_json: |
| 418 | + log_info("Generating test __install__.json in {}", ns.temp) |
| 419 | + ns.temp.mkdir(parents=True, exist_ok=True) |
| 420 | + with open(ns.temp / "__install__.json", "w", encoding="utf-8") as f: |
| 421 | + json.dump(calculate_install_json(ns, for_test=True), f, indent=2) |
| 422 | + |
397 | 423 |
|
398 | 424 | def _create_zip_file(ns): |
399 | 425 | if not ns.zip: |
@@ -627,6 +653,7 @@ def main(): |
627 | 653 | if ns.include_cat and not ns.include_cat.is_absolute(): |
628 | 654 | ns.include_cat = (Path.cwd() / ns.include_cat).resolve() |
629 | 655 | if not ns.arch: |
| 656 | + # TODO: Calculate arch from files in ns.build instead |
630 | 657 | if sys.winver.endswith("-arm64"): |
631 | 658 | ns.arch = "arm64" |
632 | 659 | elif sys.winver.endswith("-32"): |
|
0 commit comments