Skip to content

Commit

Permalink
Configure cryptography more thoroughly (#74)
Browse files Browse the repository at this point in the history
Pass `OPENSSL_LIB_DIR` and `OPENSSL_INCLUDE_DIR` when building
`cryptography` so that its `openssl-sys` crate dependency is happy.
  • Loading branch information
elprans authored Feb 8, 2024
1 parent 73713a2 commit c6eadd2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions edgedbpkg/edgedb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import pathlib
import platform
import shlex
import textwrap

from poetry.core.packages import dependency as poetry_dep
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit c6eadd2

Please sign in to comment.