From 7e868a327e7ac6f57c4fea04c20574561b62d916 Mon Sep 17 00:00:00 2001 From: Yifei Kong Date: Thu, 1 Feb 2024 13:41:01 +0800 Subject: [PATCH] Bugfix/linux sdist rootless (#233) * Download so files to .local/lib on Linux * Pass LD_LIBRARY_PATH to linux building containers --- .github/workflows/build-and-test.yaml | 2 -- curl_cffi/build.py | 2 +- pyproject.toml | 2 ++ setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 1dcc2134..bbf4a2c0 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -53,8 +53,6 @@ jobs: - name: Build and test wheels uses: pypa/cibuildwheel@v2.16.5 - env: - LD_LIBRARY_PATH: /home/runner/.local/lib # - name: Setup tmate session # uses: mxschmitt/action-tmate@v3 diff --git a/curl_cffi/build.py b/curl_cffi/build.py index ed760c41..f3d9b31f 100644 --- a/curl_cffi/build.py +++ b/curl_cffi/build.py @@ -17,7 +17,7 @@ elif uname.system == "Darwin": libdir = "/Users/runner/work/_temp/install/lib" else: - libdir = "/usr/local/lib" + libdir = os.path.expanduser("~/.local/lib") ffibuilder.set_source( diff --git a/pyproject.toml b/pyproject.toml index b5d68d20..3b097c40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,6 +106,8 @@ test-skip = "pp*" # configure cibuildwheel to build native archs ('auto'), and some emulated ones [tool.cibuildwheel.linux] archs = ["auto", "aarch64"] +environment = { LD_LIBRARY_PATH="$HOME/.local/lib" } +environment-pass = ["LD_LIBRARY_PATH"] [tool.cibuildwheel.macos] diff --git a/setup.py b/setup.py index 32cc6fd3..5d693f32 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ def download_so(): so_name = "libcurl-impersonate-chrome.4.dylib" else: sysname = "linux-gnu" - libdir = "/usr/local/lib" + libdir = os.path.expanduser("~/.local/lib") so_name = "libcurl-impersonate-chrome.so" if (Path(libdir) / so_name).exists():