python: missing libxcrypt dep (#33847)

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Harmen Stoppels 2022-11-15 14:36:16 +01:00 committed by GitHub
parent 2948248d7a
commit d36c7b20d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -370,6 +370,9 @@ class Python(Package):
variant("tkinter", default=False, description="Build tkinter module") variant("tkinter", default=False, description="Build tkinter module")
variant("uuid", default=True, description="Build uuid module") variant("uuid", default=True, description="Build uuid module")
variant("tix", default=False, description="Build Tix module") variant("tix", default=False, description="Build Tix module")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=linux")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=darwin")
variant("crypt", default=True, description="Build crypt module", when="@:3.12 platform=cray")
if not is_windows: if not is_windows:
depends_on("pkgconfig@0.9.0:", type="build") depends_on("pkgconfig@0.9.0:", type="build")
@ -405,6 +408,7 @@ class Python(Package):
depends_on("tcl", when="+tkinter") depends_on("tcl", when="+tkinter")
depends_on("uuid", when="+uuid") depends_on("uuid", when="+uuid")
depends_on("tix", when="+tix") depends_on("tix", when="+tix")
depends_on("libxcrypt", when="+crypt")
# Python needs to be patched to build extensions w/ mixed C/C++ code: # Python needs to be patched to build extensions w/ mixed C/C++ code:
# https://github.com/NixOS/nixpkgs/pull/19585/files # https://github.com/NixOS/nixpkgs/pull/19585/files
@ -560,6 +564,14 @@ def determine_variants(cls, exes, version_str):
except ProcessError: except ProcessError:
variants += "~tix" variants += "~tix"
# Some modules are platform-dependent
if not self.spec.satisfies("platform=windows"):
try:
python("-c", "import crypt", error=os.devnull)
variants += "+crypt"
except ProcessError:
variants += "~crypt"
return variants return variants
def url_for_version(self, version): def url_for_version(self, version):
@ -1017,6 +1029,10 @@ def import_tests(self):
else: else:
self.command("-c", "import Tix") self.command("-c", "import Tix")
# Ensure that crypt module works
if "+crypt" in spec:
self.command("-c", "import crypt")
# ======================================================================== # ========================================================================
# Set up environment to make install easy for python extensions. # Set up environment to make install easy for python extensions.
# ======================================================================== # ========================================================================