Skip to content

Commit

Permalink
POC: check sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
Tester authored and Tester committed Jan 24, 2024
1 parent 07237e5 commit 67d27d2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ 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: |
make preprocess
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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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", "audithweel"]
build-backend = "setuptools.build_meta"


Expand Down
2 changes: 1 addition & 1 deletion scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
14 changes: 13 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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"

Expand All @@ -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")
Expand Down

0 comments on commit 67d27d2

Please sign in to comment.