From 28f2090c9355f3df74caf4dc86a4cdf8d62f1f2c Mon Sep 17 00:00:00 2001 From: Aohan Dang Date: Mon, 21 Oct 2024 11:36:58 -0400 Subject: [PATCH] Add script to find all instances of a DLL in `PATH` This will help find issues similar to https://github.com/adang1345/delvewheel/issues/54 --- .github/workflows/CI.yml | 5 +++++ scripts/find_library.py | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 scripts/find_library.py diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3305e8a..7365840 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,6 +30,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: '3.12' +# - name: find instances of msvcp140.dll +# working-directory: ${{ github.workspace }} +# run: | +# pip install pefile +# python scripts\find_library.py - name: build and install working-directory: ${{ github.workspace }} run: | diff --git a/scripts/find_library.py b/scripts/find_library.py new file mode 100644 index 0000000..3b08dc1 --- /dev/null +++ b/scripts/find_library.py @@ -0,0 +1,13 @@ +"""Find all instances of a given DLL in PATH and output information about +each.""" + +import os +import pefile + +dll_name = 'msvcp140.dll' + +for d in os.environ['PATH'].split(os.pathsep): + if os.path.isfile(path := os.path.join(d, dll_name)): + print(path, end=': ') + with pefile.PE(path) as pe: + print((pe.OPTIONAL_HEADER.MajorLinkerVersion, pe.OPTIONAL_HEADER.MinorLinkerVersion))