From c6eadd23c3c8d945b581a9334cc806356ea312b9 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Thu, 8 Feb 2024 11:49:21 -0800 Subject: [PATCH] Configure `cryptography` more thoroughly (#74) Pass `OPENSSL_LIB_DIR` and `OPENSSL_INCLUDE_DIR` when building `cryptography` so that its `openssl-sys` crate dependency is happy. --- edgedbpkg/edgedb/__init__.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/edgedbpkg/edgedb/__init__.py b/edgedbpkg/edgedb/__init__.py index 465f781..f2bb663 100644 --- a/edgedbpkg/edgedb/__init__.py +++ b/edgedbpkg/edgedb/__init__.py @@ -7,6 +7,7 @@ import os import pathlib import platform +import shlex import textwrap from poetry.core.packages import dependency as poetry_dep @@ -523,6 +524,29 @@ def get_provided_packages( class Cryptography(packages.PythonPackage): + def sh_get_build_wheel_env( + self, build: targets.Build, *, site_packages_var: str + ) -> dict[str, str]: + env = dict( + super().sh_get_build_wheel_env( + build, site_packages_var=site_packages_var + ) + ) + env["OPENSSL_STATIC"] = "0" + + openssl_pkg = build.get_package("openssl") + if build.is_bundled(openssl_pkg): + openssl_path = build.get_install_dir( + openssl_pkg, relative_to="pkgbuild" + ) + openssl_path /= build.get_full_install_prefix().relative_to("/") + quoted = shlex.quote(str(openssl_path)) + pwd = "$(pwd -P)" + env["OPENSSL_LIB_DIR"] = f"!{pwd}/{quoted}/lib" + env["OPENSSL_INCLUDE_DIR"] = f"!{pwd}/{quoted}/include" + + return env + def get_requirements(self) -> list[poetry_dep.Dependency]: reqs = super().get_requirements() reqs.append(poetry_dep.Dependency("openssl", ">=1.1.1"))