Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Makefile #223

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading