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 3ee52a1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- feature/*
jobs:
sdist:
name: build sdist wheel
name: build sdist wheel and check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -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
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 3ee52a1

Please sign in to comment.