|
22 | 22 | from spack.util.prefix import Prefix |
23 | 23 |
|
24 | 24 |
|
25 | | -def make_pyvenv_cfg(python_spec: "spack.spec.Spec", venv_prefix: str) -> str: |
| 25 | +def make_pyvenv_cfg(python_spec: Spec, venv_prefix: str) -> str: |
26 | 26 | """Make a pyvenv_cfg file for a given (real) python command and venv prefix.""" |
27 | 27 | python_cmd = python_spec.command.path |
28 | 28 | lines = [ |
@@ -254,7 +254,6 @@ class Python(Package): |
254 | 254 | variant("ssl", default=True, description="Build ssl module") |
255 | 255 | variant("sqlite3", default=True, description="Build sqlite3 module") |
256 | 256 | variant("dbm", default=True, description="Build dbm module") |
257 | | - variant("nis", default=False, description="Build nis module") |
258 | 257 | variant("zlib", default=True, description="Build zlib module") |
259 | 258 | variant("bz2", default=True, description="Build bz2 module") |
260 | 259 | variant("lzma", default=True, description="Build lzma module") |
@@ -285,7 +284,6 @@ class Python(Package): |
285 | 284 | # https://docs.python.org/3.10/whatsnew/3.10.html#build-changes |
286 | 285 | depends_on( "[email protected]:", when="@3.10:+sqlite3") |
287 | 286 | depends_on("gdbm", when="+dbm") # alternatively ndbm or berkeley-db |
288 | | - depends_on("libnsl", when="+nis") |
289 | 287 | depends_on("zlib-api", when="+zlib") |
290 | 288 | depends_on("bzip2", when="+bz2") |
291 | 289 | depends_on("xz libs=shared", when="+lzma") |
@@ -387,7 +385,6 @@ def determine_variants(cls, exes, version_str): |
387 | 385 | "readline", |
388 | 386 | "sqlite3", |
389 | 387 | "dbm", |
390 | | - "nis", |
391 | 388 | "zlib", |
392 | 389 | "bz2", |
393 | 390 | "lzma", |
@@ -448,6 +445,29 @@ def patch(self): |
448 | 445 | r"^(.*)setup\.py(.*)((build)|(install))(.*)$", r"\1setup.py\2 --no-user-cfg \3\6" |
449 | 446 | ) |
450 | 447 |
|
| 448 | + # disable building the nis module (there is no flag to disable it). |
| 449 | + if self.spec.satisfies("@3.8:3.10"): |
| 450 | + filter_file( |
| 451 | + "if MS_WINDOWS or CYGWIN or HOST_PLATFORM == 'qnx6':", |
| 452 | + "if True:", |
| 453 | + "setup.py", |
| 454 | + string=True, |
| 455 | + ) |
| 456 | + elif self.spec.satisfies("@3.7"): |
| 457 | + filter_file( |
| 458 | + "if host_platform in {'win32', 'cygwin', 'qnx6'}:", |
| 459 | + "if True:", |
| 460 | + "setup.py", |
| 461 | + string=True, |
| 462 | + ) |
| 463 | + elif self.spec.satisfies("@3.6"): |
| 464 | + filter_file( |
| 465 | + "if (host_platform not in ['cygwin', 'qnx6'] and", |
| 466 | + "if False and", |
| 467 | + "setup.py", |
| 468 | + string=True, |
| 469 | + ) |
| 470 | + |
451 | 471 | def setup_build_environment(self, env): |
452 | 472 | spec = self.spec |
453 | 473 |
|
@@ -658,6 +678,11 @@ def configure_args(self): |
658 | 678 | ] |
659 | 679 | ) |
660 | 680 |
|
| 681 | + # Disable the nis module in the configure script for Python 3.11 and 3.12. It is deleted |
| 682 | + # in Python 3.13. See ``def patch`` for disabling the nis module in Python 3.10 and older. |
| 683 | + if spec.satisfies("@3.11:3.12"): |
| 684 | + config_args.append("py_cv_module_nis=n/a") |
| 685 | + |
661 | 686 | # https://docs.python.org/3.8/library/sqlite3.html#f1 |
662 | 687 | if spec.satisfies("+sqlite3 ^sqlite+dynamic_extensions"): |
663 | 688 | config_args.append("--enable-loadable-sqlite-extensions") |
@@ -787,10 +812,6 @@ def import_tests(self): |
787 | 812 | if "+dbm" in spec: |
788 | 813 | self.command("-c", "import dbm") |
789 | 814 |
|
790 | | - # Ensure that nis module works |
791 | | - if "+nis" in spec: |
792 | | - self.command("-c", "import nis") |
793 | | - |
794 | 815 | # Ensure that zlib module works |
795 | 816 | if "+zlib" in spec: |
796 | 817 | self.command("-c", "import zlib") |
|
0 commit comments