-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wheel.mk: Migrate to using status cookie (#6389)
* wheel.mk: Use status cookie for general wheel + wheel_download * wheel.mk: Move wheel jq query to master wheel mk file * spk.mk: Add new cokkoe files to wheelclean * wheel.mk: Declare crossenv default wheel type * wheel.mk: Fix grep+sed file looping to avoid loosing filename * wheel.mk: Avoid downloading if pure wheel packaging is disabled * common.mk: Add PIP_NATIVE to use our own pip native always * crossenv.mk: Missing call to pre_crossenv_target * spk.mk: Add ability to clean one specific wheel * wheel.mk: Enable compile and install steps for wheel building * wheel.mk: Re-enable install_python_wheel towards staging directory * Bump package version to initiate build wheel testing * python-wheel.mk: Ensure wheelhouse directory is set * wheel-compile.mk: Fix call to crossenv <wheelname>-<wheelversion> * python-wheel.mk: Fix post compile issue related to install * crossenv.mk: Migrate to using WHEEL_NAME and WHEEL_VERSION This allows using a unique method for both wheel and crossenv calls * wheelclean: Also clean-up work/.wheel* due to download-wheels * wheel.mk: Add new download-wheels sub-routine * wheel.mk: Remove commented debug traces * wheel.mk: Pre-process #egg= tags for compatibility with newer pip * wheel.mk: Fix MAKECMDGOALS when called from spk.mk * github-action: Enable downloading wheels from new method * Revert package bump to test wheels * deluge: Revert package bump
- Loading branch information
Showing
11 changed files
with
481 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
### Wheel rules | ||
# Compile wheels for modules listed in WHEELS. | ||
# | ||
# Targets are executed in the following order: | ||
# wheel_compile_msg_target | ||
# pre_wheel_compile_target (override with PRE_WHEEL_COMPILE_TARGET) | ||
# wheel_compile_target (override with WHEEL_COMPILE_TARGET) | ||
# post_wheel_compile_target (override with POST_WHEEL_COMPILE_TARGET) | ||
# Variables: | ||
# REQUIREMENT Requirement formatted wheel information | ||
# WHEEL_NAME Name of wheel to process | ||
# WHEEL_VERSION Version of wheel to process (can be empty) | ||
# WHEEL_TYPE Type of wheel to process (abi3, crossenv, pure) | ||
|
||
ifeq ($(WHEEL_VERSION),) | ||
WHEEL_COMPILE_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)wheel_compile-$(WHEEL_NAME)_done | ||
else | ||
WHEEL_COMPILE_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)wheel_compile-$(WHEEL_NAME)-$(WHEEL_VERSION)_done | ||
endif | ||
|
||
## | ||
|
||
ifeq ($(strip $(PRE_WHEEL_COMPILE_TARGET)),) | ||
PRE_WHEEL_COMPILE_TARGET = pre_wheel_compile_target | ||
else | ||
$(PRE_WHEEL_COMPILE_TARGET): wheel_compile_msg_target | ||
endif | ||
ifeq ($(strip $(WHEEL_COMPILE_TARGET)),) | ||
WHEEL_COMPILE_TARGET = wheel_compile_target | ||
else | ||
$(WHEEL_COMPILE_TARGET): $(BUILD_WHEEL_COMPILE_TARGET) | ||
endif | ||
ifeq ($(strip $(POST_WHEEL_COMPILE_TARGET)),) | ||
POST_WHEEL_COMPILE_TARGET = post_wheel_compile_target | ||
else | ||
$(POST_WHEEL_COMPILE_TARGET): $(WHEEL_COMPILE_TARGET) | ||
endif | ||
|
||
wheel_compile_msg_target: | ||
@$(MSG) "Processing wheels of $(NAME)" | ||
|
||
pre_wheel_compile_target: wheel_compile_msg_target | ||
|
||
wheel_compile_target: SHELL:=/bin/bash | ||
wheel_compile_target: | ||
ifeq ($(wildcard $(WHEELHOUSE)),) | ||
@$(MSG) Creating wheelhouse directory: $(WHEELHOUSE) | ||
@mkdir -p $(WHEELHOUSE) | ||
endif | ||
@$(MSG) Compiling wheel [$(WHEEL_NAME)], version [$(WHEEL_VERSION)], type [$(WHEEL_TYPE)] | ||
ifneq ($(WHEEL_TYPE),pure) | ||
@$(MSG) $(MAKE) WHEEL_NAME=\"$(WHEEL_NAME)\" WHEEL_VERSION=\"$(WHEEL_VERSION)\" crossenv-$(ARCH)-$(TCVERSION) ; \ | ||
MAKEFLAGS= $(MAKE) WHEEL_NAME="$(WHEEL_NAME)" WHEEL_VERSION="$(WHEEL_VERSION)" crossenv-$(ARCH)-$(TCVERSION) --no-print-directory | ||
@[ "$(WHEEL_TYPE)" = "$(WHEELS_LIMITED_API)" ] && abi3="--build-option=--py-limited-api=$(PYTHON_LIMITED_API)" || abi3="" ; \ | ||
global_options=$$(echo $(WHEELS_BUILD_ARGS) | sed -e 's/ \[/\n\[/g' | grep -i $(WHEEL_NAME) | cut -f2 -d] | xargs) ; \ | ||
localCFLAGS=($$(echo $(WHEELS_CFLAGS) | sed -e 's/ \[/\n\[/g' | grep -i $(WHEEL_NAME) | cut -f2 -d] | xargs)) ; \ | ||
localLDFLAGS=($$(echo $(WHEELS_LDFLAGS) | sed -e 's/ \[/\n\[/g' | grep -i $(WHEEL_NAME) | cut -f2 -d] | xargs)) ; \ | ||
localCPPFLAGS=($$(echo $(WHEELS_CPPFLAGS) | sed -e 's/ \[/\n\[/g' | grep -i $(WHEEL_NAME) | cut -f2 -d] | xargs)) ; \ | ||
localCXXFLAGS=($$(echo $(WHEELS_CXXFLAGS) | sed -e 's/ \[/\n\[/g' | grep -i $(WHEEL_NAME) | cut -f2 -d] | xargs)) ; \ | ||
$(MSG) pip build [$(WHEEL_NAME)], version: [$(WHEEL_VERSION)] \ | ||
$$([ "$$(echo $${localCFLAGS[@]})" ] && echo "CFLAGS=\"$${localCFLAGS[@]}\" ") \ | ||
$$([ "$$(echo $${localCPPFLAGS[@]})" ] && echo "CPPFLAGS=\"$${localCPPFLAGS[@]}\" ") \ | ||
$$([ "$$(echo $${localCXXFLAGS[@]})" ] && echo "CXXFLAGS=\"$${localCXXFLAGS[@]}\" ") \ | ||
$$([ "$$(echo $${localLDFLAGS[@]})" ] && echo "LDFLAGS=\"$${localLDFLAGS[@]}\" ") \ | ||
$$([ "$$(echo $${abi3})" ] && echo "$${abi3} ")" \ | ||
$${global_options}" ; \ | ||
REQUIREMENT=$(REQUIREMENT) \ | ||
WHEEL_NAME=$(WHEEL_NAME) \ | ||
WHEEL_VERSION=$(WHEEL_VERSION) \ | ||
ADDITIONAL_CFLAGS="-I$(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR) $${localCFLAGS[@]}" \ | ||
ADDITIONAL_CPPFLAGS="-I$(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR) $${localCPPFLAGS[@]}" \ | ||
ADDITIONAL_CXXFLAGS="-I$(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR) $${localCXXFLAGS[@]}" \ | ||
ADDITIONAL_LDFLAGS="$${localLDFLAGS[@]}" \ | ||
ABI3="$${abi3}" \ | ||
PIP_GLOBAL_OPTION="$${global_options}" \ | ||
$(MAKE) --no-print-directory \ | ||
cross-compile-wheel-$(WHEEL_NAME) || exit 1 | ||
else ifneq ($(filter 1 ON TRUE,$(WHEELS_PURE_PYTHON_PACKAGING_ENABLE)),) | ||
@if [ -s "$(WHEELHOUSE)/$(WHEELS_PURE_PYTHON)" ]; then \ | ||
export LD= LDSHARED= CPP= NM= CC= AS= RANLIB= CXX= AR= STRIP= OBJDUMP= OBJCOPY= READELF= CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= && \ | ||
$(RUN) \ | ||
PATH="$(abspath $(WORK_DIR)/../../../native/$(PYTHON_PKG_NAME)/work-native/install/usr/local/bin):$(PATH)" \ | ||
LD_LIBRARY_PATH="$(abspath $(WORK_DIR)/../../../native/$(PYTHON_PKG_NAME)/work-native/install/usr/local/lib):$(LD_LIBRARY_PATH)" \ | ||
$(MSG) $(PIP_NATIVE) $(PIP_WHEEL_ARGS) $(REQUIREMENT) ; \ | ||
$(PIP_NATIVE) $(PIP_WHEEL_ARGS) $(REQUIREMENT) ; \ | ||
fi | ||
endif | ||
|
||
## | ||
## crossenv PATH environment requires a combination of: | ||
## 1) unique PATH variable from $(ENV) -> using merge + dedup macros | ||
## Note: Multiple declarations of ENV += PATH=bla creates confusion in its interpretation. | ||
## Solution implemented fetches all PATH from ENV and combine them in reversed order. | ||
## 2) access to maturin from native/python<version>/.../bin -> ${PYTHON_NATIVE_PATH}/bin | ||
## 3) access to crossenv/bin/cross* tools, mainly cross-pip -> ${CROSSENV_PATH}/bin | ||
## | ||
cross-compile-wheel-%: SHELL:=/bin/bash | ||
cross-compile-wheel-%: | ||
@for crossenv in $(WORK_DIR)/crossenv-$(WHEEL_NAME)-$(WHEEL_VERSION) $(WORK_DIR)/crossenv-$(WHEEL_NAME) $(WORK_DIR)/crossenv ; do \ | ||
[ -d $${crossenv} ] && . $${crossenv}/build/python-cc.mk && break ; \ | ||
done ; \ | ||
if [ -d "$${CROSSENV_PATH}" ] ; then \ | ||
PATH=$(call dedup, $(call merge, $(ENV), PATH, :), :):$${PYTHON_NATIVE_PATH}:$${CROSSENV_PATH}/bin:$${PATH} ; \ | ||
$(MSG) "crossenv: [$${CROSSENV_PATH}]" ; \ | ||
$(MSG) "pip: [$$(which cross-pip)]" ; \ | ||
$(MSG) "maturin: [$$(which maturin)]" ; \ | ||
else \ | ||
echo "ERROR: crossenv not found!" ; \ | ||
exit 2 ; \ | ||
fi ; \ | ||
if [ "$(PIP_GLOBAL_OPTION)" ]; then \ | ||
pip_global_option=$$(echo $(PIP_GLOBAL_OPTION) | sed 's/=\([^ ]*\)/="\1"/g; s/[^ ]*/--global-option=&/g') ; \ | ||
pip_global_option=$${pip_global_option}" --no-use-pep517" ; \ | ||
fi ; \ | ||
$(RUN) $(MSG) \ | ||
_PYTHON_HOST_PLATFORM=\"$(TC_TARGET)\" \ | ||
PATH=$${PATH} \ | ||
CMAKE_TOOLCHAIN_FILE=$${CMAKE_TOOLCHAIN_FILE} \ | ||
MESON_CROSS_FILE=$${MESON_CROSS_FILE} \ | ||
cross-pip \ | ||
$(PIP_WHEEL_ARGS_CROSSENV) \ | ||
$${pip_global_option} \ | ||
--no-build-isolation \ | ||
$(ABI3) \ | ||
$(REQUIREMENT) ; \ | ||
$(RUN) \ | ||
_PYTHON_HOST_PLATFORM="$(TC_TARGET)" \ | ||
PATH=$${PATH} \ | ||
CMAKE_TOOLCHAIN_FILE=$${CMAKE_TOOLCHAIN_FILE} \ | ||
MESON_CROSS_FILE=$${MESON_CROSS_FILE} \ | ||
cross-pip \ | ||
$(PIP_WHEEL_ARGS_CROSSENV) \ | ||
$${pip_global_option} \ | ||
--no-build-isolation \ | ||
$(ABI3) \ | ||
$(REQUIREMENT) | ||
|
||
post_wheel_compile_target: $(WHEEL_COMPILE_TARGET) | ||
|
||
ifeq ($(wildcard $(WHEEL_COMPILE_COOKIE)),) | ||
wheel_compile: $(WHEEL_COMPILE_COOKIE) | ||
|
||
$(WHEEL_COMPILE_COOKIE): $(POST_WHEEL_COMPILE_TARGET) | ||
$(create_target_dir) | ||
@touch -f $@ | ||
else | ||
wheel_compile: ; | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
### Wheel rules | ||
# Download wheels for modules listed in WHEELS. | ||
# | ||
# Targets are executed in the following order: | ||
# wheel_download_msg_target | ||
# pre_wheel_download_target (override with PRE_WHEEL_DOWNLOAD_TARGET) | ||
# wheel_download_target (override with WHEEL_DOWNLOAD_TARGET) | ||
# post_wheel_download_target (override with POST_WHEEL_DOWNLOAD_TARGET) | ||
# Variables: | ||
# REQUIREMENT Requirement formatted wheel information | ||
# WHEEL_NAME Name of wheel to process | ||
# WHEEL_VERSION Version of wheel to process (can be empty) | ||
# WHEEL_TYPE Type of wheel to process (abi3, crossenv, pure) | ||
|
||
ifeq ($(WHEEL_VERSION),) | ||
WHEEL_DOWNLOAD_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)wheel_download-$(WHEEL_NAME)_done | ||
else | ||
WHEEL_DOWNLOAD_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)wheel_download-$(WHEEL_NAME)-$(WHEEL_VERSION)_done | ||
endif | ||
|
||
## | ||
|
||
ifeq ($(strip $(PRE_WHEEL_DOWNLOAD_TARGET)),) | ||
PRE_WHEEL_DOWNLOAD_TARGET = pre_wheel_download_target | ||
else | ||
$(PRE_WHEEL_DOWNLOAD_TARGET): wheel_download_msg_target | ||
endif | ||
ifeq ($(strip $(WHEEL_DOWNLOAD_TARGET)),) | ||
WHEEL_DOWNLOAD_TARGET = wheel_download_target | ||
else | ||
$(WHEEL_DOWNLOAD_TARGET): $(BUILD_WHEEL_DOWNLOAD_TARGET) | ||
endif | ||
ifeq ($(strip $(POST_WHEEL_DOWNLOAD_TARGET)),) | ||
POST_WHEEL_DOWNLOAD_TARGET = post_wheel_download_target | ||
else | ||
$(POST_WHEEL_DOWNLOAD_TARGET): $(WHEEL_DOWNLOAD_TARGET) | ||
endif | ||
|
||
wheel_download_msg_target: | ||
@$(MSG) "Processing wheels of $(NAME)" | ||
|
||
pre_wheel_download_target: wheel_download_msg_target | ||
|
||
wheel_download_target: SHELL:=/bin/bash | ||
wheel_download_target: | ||
ifeq ($(wildcard $(PIP_DISTRIB_DIR)),) | ||
@$(MSG) Creating pip download directory: $(PIP_DISTRIB_DIR) | ||
@mkdir -p $(PIP_DISTRIB_DIR) | ||
endif | ||
ifeq ($(wildcard $(PIP_CACHE_DIR)),) | ||
@$(MSG) Creating pip caching directory: $(PIP_CACHE_DIR) | ||
@mkdir -p $(PIP_CACHE_DIR) | ||
endif | ||
@$(MSG) Downloading wheel [$(WHEEL_NAME)], version [$(WHEEL_VERSION)] ; \ | ||
if [ "$$(grep -Eo 'http://|https://' <<< $(REQUIREMENT))" ] ; then \ | ||
echo "WARNING: Skipping download URL - Downloaded at build time" ; \ | ||
elif [ "$(WHEEL_TYPE)" = "pure" ] && [ ! "$(WHEELS_PURE_PYTHON_PACKAGING_ENABLE)" = "1" ]; then \ | ||
echo "WARNING: Skipping download - pure python packaging disabled" ; \ | ||
else \ | ||
query="curl -s https://pypi.org/pypi/$(WHEEL_NAME)/json" ; \ | ||
query+=" | jq -r '.releases[][]" ; \ | ||
query+=" | select(.packagetype==\"sdist\")" ; \ | ||
query+=" | select((.filename|test(\"-$(WHEEL_VERSION).tar.gz\")) or (.filename|test(\"-$(WHEEL_VERSION).zip\"))) | .url'" ; \ | ||
outFile=$$(basename $$(eval $${query} 2>/dev/null) 2</dev/null) ; \ | ||
if [ "$${outFile}" = "" ]; then \ | ||
echo "ERROR: Unable to find version on pypi.org for [$(WHEEL_NAME)]" ; \ | ||
elif [ -s $(PIP_DISTRIB_DIR)/$${outFile} ]; then \ | ||
echo "INFO: File already exists [$${outFile}]" ; \ | ||
else \ | ||
echo "wget --secure-protocol=TLSv1_2 -nv -O $(PIP_DISTRIB_DIR)/$${outFile}.part -nc $$(eval $${query})" ; \ | ||
wget --secure-protocol=TLSv1_2 -nv -O $(PIP_DISTRIB_DIR)/$${outFile}.part -nc $$(eval $${query}) ; \ | ||
mv $(PIP_DISTRIB_DIR)/$${outFile}.part $(PIP_DISTRIB_DIR)/$${outFile} ; \ | ||
fi ; \ | ||
fi | ||
|
||
post_wheel_download_target: $(WHEEL_DOWNLOAD_TARGET) | ||
|
||
ifeq ($(wildcard $(WHEEL_DOWNLOAD_COOKIE)),) | ||
wheel_download: $(WHEEL_DOWNLOAD_COOKIE) | ||
|
||
$(WHEEL_DOWNLOAD_COOKIE): $(POST_WHEEL_DOWNLOAD_TARGET) | ||
$(create_target_dir) | ||
@touch -f $@ | ||
else | ||
wheel_download: ; | ||
endif |
Oops, something went wrong.