-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[WIP] wheel.mk: Migrate to using status cookie #6389
Open
th0ma7
wants to merge
15
commits into
SynoCommunity:master
Choose a base branch
from
th0ma7:wheel-cookie
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9289468
wheel.mk: Use status cookie for general wheel + wheel_download
th0ma7 2f662ae
wheel.mk: Move wheel jq query to master wheel mk file
th0ma7 38c35fd
spk.mk: Add new cokkoe files to wheelclean
th0ma7 892b8c0
wheel.mk: Declare crossenv default wheel type
th0ma7 ceed5cf
wheel.mk: Fix grep+sed file looping to avoid loosing filename
th0ma7 57b8cbb
wheel.mk: Avoid downloading if pure wheel packaging is disabled
th0ma7 5a7def6
common.mk: Add PIP_NATIVE to use our own pip native always
th0ma7 0a84ca1
crossenv.mk: Missing call to pre_crossenv_target
th0ma7 59482d7
spk.mk: Add ability to clean one specific wheel
th0ma7 4c50a76
wheel.mk: Enable compile and install steps for wheel building
th0ma7 ab02b4b
wheel.mk: Re-enable install_python_wheel towards staging directory
th0ma7 3ca2223
Bump package version to initiate build wheel testing
th0ma7 f2c6a26
python-wheel.mk: Ensure wheelhouse directory is set
th0ma7 c1f2a54
wheel-compile.mk: Fix call to crossenv <wheelname>-<wheelversion>
th0ma7 6efb2c8
python-wheel.mk: Fix post compile issue related to install
th0ma7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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=\"$(WHEEL_NAME)-$(WHEEL_VERSION)\" crossenv-$(ARCH)-$(TCVERSION) ; \ | ||
MAKEFLAGS= $(MAKE) WHEEL="$(WHEEL_NAME)-$(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,92 @@ | ||
### 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)] ; \ | ||
# $(MSG) requirement: [$(REQUIREMENT)] ; \ | ||
# $(MSG) requirement-grep-egg: [$$(grep -s egg <<< $(REQUIREMENT))] ; \ | ||
# $(MSG) name: [$(WHEEL_NAME)] ; \ | ||
# $(MSG) type: [$(WHEEL_TYPE)] ; \ | ||
# $(MSG) version: [$(WHEEL_VERSION)] ; \ | ||
# $(MSG) type: [$(WHEEL_TYPE)] ; \ | ||
Comment on lines
+55
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this does not work, it might all be commented out ( just a guess |
||
if [ "$$(grep -s egg <<< $(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: Invalid package name [$(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 |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to document, that WHEEL_NAME must not contain
-
?Since name and version are separated by
-
the name must not contain-
.can we add a check here
or fail if name has
-
instead of_
or implement an auto renaming?
or can we still use
=
as version separator? (can't remeber which make file is affected).