Skip to content

Commit 31e647b

Browse files
authored
Install the expected version of cryptography instead of pinning it (#34932)
1 parent 46bb4f9 commit 31e647b

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

omnibus/config/software/datadog-agent-integrations-py3.rb

+17-10
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,27 @@
285285
FileUtils.rm([libssl_match, libcrypto_match])
286286
end
287287
elsif windows_target?
288-
dll_folder = File.join(install_dir, "embedded3", "DLLS")
289288
# Build the cryptography library in this case so that it gets linked to Agent's OpenSSL
290-
# We first need to copy some files around (we need the .lib files for building)
291-
copy File.join(install_dir, "embedded3", "lib", "libssl.dll.a"),
289+
lib_folder = File.join(install_dir, "embedded3", "lib")
290+
dll_folder = File.join(install_dir, "embedded3", "DLLS")
291+
include_folder = File.join(install_dir, "embedded3", "include")
292+
293+
# We first need create links to some files around such that cryptography finds .lib files
294+
link File.join(lib_folder, "libssl.dll.a"),
292295
File.join(dll_folder, "libssl-3-x64.lib")
293-
copy File.join(install_dir, "embedded3", "lib", "libcrypto.dll.a"),
296+
link File.join(lib_folder, "libcrypto.dll.a"),
294297
File.join(dll_folder, "libcrypto-3-x64.lib")
295298

296-
command "#{python} -m pip install --force-reinstall --no-deps --no-binary cryptography cryptography==43.0.1",
297-
env: {
298-
"OPENSSL_LIB_DIR" => dll_folder,
299-
"OPENSSL_INCLUDE_DIR" => File.join(install_dir, "embedded3", "include"),
300-
"OPENSSL_LIBS" => "libssl-3-x64:libcrypto-3-x64",
301-
}
299+
block "Build cryptopgraphy library against Agent's OpenSSL" do
300+
cryptography_requirement = (shellout! "#{python} -m pip list --format=freeze").stdout[/cryptography==.*?$/]
301+
302+
shellout! "#{python} -m pip install --force-reinstall --no-deps --no-binary cryptography #{cryptography_requirement}",
303+
env: {
304+
"OPENSSL_LIB_DIR" => dll_folder,
305+
"OPENSSL_INCLUDE_DIR" => include_folder,
306+
"OPENSSL_LIBS" => "libssl-3-x64:libcrypto-3-x64",
307+
}
308+
end
302309
# Python extensions on windows require this to find their DLL dependencies,
303310
# we abuse the `.pth` loading system to inject it
304311
block "Inject dll path for Python extensions" do

0 commit comments

Comments
 (0)