Skip to content

Commit

Permalink
Improve Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tester authored and Tester committed Jan 22, 2024
1 parent 97f10c3 commit 7fe89d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,4 @@ curl-*/
*.tar.xz
*.tar.gz
.patched
.preprocessed
.so_downloaded
include/
19 changes: 6 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@ SHELL := bash
VERSION := 0.6.0b8
CURL_VERSION := curl-8.1.1

.preprocessed: curl_cffi/include/curl/curl.h
touch .preprocessed

curl_cffi/const.py: curl_cffi/include
python preprocess/generate_consts.py $(CURL_VERSION)

$(CURL_VERSION):
curl_artifacts:
curl -L "https://curl.se/download/$(CURL_VERSION).tar.xz" \
-o "$(CURL_VERSION).tar.xz"
tar -xf $(CURL_VERSION).tar.xz

curl-impersonate-$(VERSION)/chrome/patches: $(CURL_VERSION)
curl -L "https://github.com/yifeikong/curl-impersonate/archive/refs/tags/v$(VERSION).tar.gz" \
-o "curl-impersonate-$(VERSION).tar.gz"
tar -xf curl-impersonate-$(VERSION).tar.gz

# TODO add the headers to sdist package
curl_cffi/include/curl/curl.h: curl-impersonate-$(VERSION)/chrome/patches
curl_cffi/include/curl/curl.h: curl_artifacts
cd $(CURL_VERSION)
for p in $</curl-*.patch; do patch -p1 < ../$$p; done
# Re-generate the configure script
autoreconf -fi
mkdir -p ../curl_cffi/include/curl
cp -R include/curl/* ../curl_cffi/include/curl/

preprocess: .preprocessed
preprocess: curl_cffi/include/curl/curl.h
@echo preprocess

upload: dist/*.whl
Expand All @@ -37,10 +30,10 @@ upload: dist/*.whl
test:
python -bb -m pytest tests/unittest

install-local: .preprocessed
install-local: preprocess
pip install -e .

build: .preprocessed
build: preprocess
rm -rf dist/
pip install build delocate twine
python -m build --wheel
Expand All @@ -49,7 +42,7 @@ build: .preprocessed
clean:
rm -rf build/ dist/ curl_cffi.egg-info/ $(CURL_VERSION)/ curl-impersonate-$(VERSION)/
rm -rf curl_cffi/*.o curl_cffi/*.so curl_cffi/_wrapper.c
rm -rf .preprocessed .so_downloaded $(CURL_VERSION).tar.xz curl-impersonate-$(VERSION).tar.gz
rm -rf $(CURL_VERSION).tar.xz curl-impersonate-$(VERSION).tar.gz
rm -rf curl_cffi/include/

.PHONY: clean build test install-local upload preprocess
File renamed without changes.

0 comments on commit 7fe89d8

Please sign in to comment.