Skip to content

Commit

Permalink
Remove download-so logic from makefile (#223)
Browse files Browse the repository at this point in the history
* Improve Makefile

* Move files

* Polish makefile

* Polish makefile, again

* Fix make clean

---------

Co-authored-by: Yifei Kong <[email protected]>
  • Loading branch information
T-256 and perklet authored Feb 1, 2024
1 parent 7e868a3 commit d9cc137
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ curl_cffi.egg-info/
curl-*/
*.tar.xz
*.tar.gz
.patched
.preprocessed
.so_downloaded
include/
.DS_Store
34 changes: 14 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ SHELL := bash
VERSION := 0.6.0b9
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 -L "https://curl.se/download/$(CURL_VERSION).tar.xz" \
-o "$(CURL_VERSION).tar.xz"
Expand All @@ -19,37 +13,37 @@ curl-impersonate-$(VERSION)/chrome/patches: $(CURL_VERSION)
-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
.preprocessed: curl-impersonate-$(VERSION)/chrome/patches
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/
# Sentinel files: https://tech.davis-hansson.com/p/make/
touch .preprocessed

preprocess: .preprocessed
@echo preprocess

upload: dist/*.whl
twine upload dist/*.whl
gen-const: .preprocessed
python scripts/generate_consts.py $(CURL_VERSION)

test:
python -bb -m pytest tests/unittest
preprocess: .preprocessed
@echo generating patched libcurl header files

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

build: .preprocessed
rm -rf dist/
pip install build delocate twine
pip install build
python -m build --wheel
delocate-wheel dist/*.whl

test:
python -bb -m pytest tests/unittest

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 .preprocessed $(CURL_VERSION).tar.xz curl-impersonate-$(VERSION).tar.gz
rm -rf curl_cffi/include/

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

0 comments on commit d9cc137

Please sign in to comment.