diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1a523794..526275e3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,8 +10,8 @@ on: - feature/* jobs: sdist: - name: build sdist wheel - runs-on: ubuntu-latest + name: build sdist wheel and check + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - run: | @@ -19,6 +19,13 @@ jobs: python -m pip install --upgrade pip python -m pip install build setuptools wheel python -m build --sdist + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - run: | + pip install ./dist/curl_cffi-0.6.0b8.tar.gz + - uses: actions/upload-artifact@v3 with: path: ./dist/*.tar.gz diff --git a/pyproject.toml b/pyproject.toml index cc170e2c..09d39cb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ package-data = { curl_cffi = ["libcurl.dll"] } [build-system] -requires = ["wheel", "setuptools", "cffi >=1.12.0"] +requires = ["wheel", "setuptools", "cffi >=1.12.0", "auditwheel"] build-backend = "setuptools.build_meta" diff --git a/scripts/build.py b/scripts/build.py index 016107d0..f16d9daa 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -43,7 +43,7 @@ def abs_machine(): libdir = "ERROR" else: if machine in ("x86_64", "arm", "aarch64"): - libdir = "/usr/local/lib" + libdir = f"./libcurl_{machine}" else: libdir = "ERROR" diff --git a/setup.py b/setup.py index 32553873..3873f43f 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,17 @@ class bdist_wheel_abi3(bdist_wheel): + def run(self): + super().run() + + impl_tag, abi_tag, plat_tag = self.get_tag() + archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}" + + wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl") + + os.system(f'python3 -m auditwheel repair -w "{self.dist_dir}" "{wheel_path}"') + os.remove(wheel_path) + def get_tag(self): python, abi, plat = super().get_tag() @@ -72,7 +83,7 @@ def download_so(): so_name = "libcurl-impersonate-chrome.so" if machine in ("x86_64", "arm", "aarch64"): - libdir = "/usr/local/lib" + libdir = f"./libcurl_{machine}" else: so_name = "SKIP" @@ -97,6 +108,7 @@ def download_so(): print("Unpacking downloaded files...") os.makedirs(libdir, exist_ok=True) shutil.unpack_archive(file, libdir) + print(f"Unpacked downloaded files into {libdir}.") if system == "Windows": shutil.copy2(f"{libdir}/libcurl.dll", "curl_cffi")