Fix attrdict issue when building wxPython>=4.2.0

When building wxPython, the "attrdict" package is needed, but is
now incompatible with Python > 3.10, due to the "collections" package.
The workaround is to ship a patched version of "attrdict" along with
msspec since "attrdict" isn't developped anylonger.
This commit is contained in:
Sylvain Tricot 2022-10-25 16:24:23 +02:00
parent c455b3bdfa
commit 6785e7228a
2 changed files with 14 additions and 6 deletions

View File

@ -1,7 +1,7 @@
include src/options.mk include src/options.mk
.PHONY: pybinding install devel venv doc clean .PHONY: pybinding install devel venv doc clean _attrdict
pybinding: pybinding:
@ -37,20 +37,28 @@ light: venv
@$(INSIDE_VENV) pip install src/ @$(INSIDE_VENV) pip install src/
_build_wx/wxPython.target: _attrdict:
# Check if virtualenv python version > 3.3.0
# If so, install the patched version of attrdict used to build the version 4.2.0 of wxPython
@$(INSIDE_VENV) if `python -c "import sys; exit(sys.version_info > (3,3))"`; then \
pip install --no-cache attrdict; \
else \
pip install thirdparty/attrdict-2.0.1.tar.gz; \
fi
_build_wx/wxPython.target: _attrdict
@$(INSIDE_VENV) echo "Building wxPython for your `python --version 2>&1` under Linux $(DISTRO_RELEASE)..." @$(INSIDE_VENV) echo "Building wxPython for your `python --version 2>&1` under Linux $(DISTRO_RELEASE)..."
# Create a folder to build wx into # Create a folder to build wx into
@mkdir -p _build_wx @mkdir -p _build_wx
@$(INSIDE_VENV) pip install attrdict sip
# TODO: attrdict is no longer compatible with collections package. The build will fail
# download the wheel or the source if it cannot find a wheel # download the wheel or the source if it cannot find a wheel
@$(INSIDE_VENV) cd _build_wx && pip download -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/$(DISTRO_RELEASE) wxPython $(INSIDE_VENV) cd _build_wx && pip download -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/$(DISTRO_RELEASE) wxPython
# Build the source if a tar.gz was downloaded # Build the source if a tar.gz was downloaded
@$(INSIDE_VENV) cd _build_wx && \ @$(INSIDE_VENV) cd _build_wx && \
if [ -e wxPython*.tar.gz ]; then \ if [ -e wxPython*.tar.gz ]; then \
tar -x --skip-old-files -vzf wxPython*.tar.gz; \ tar -x --skip-old-files -vzf wxPython*.tar.gz; \
cd `ls -d wxPython*/`; \ cd `ls -d wxPython*/`; \
pip install requests; \ pip install requests sip; \
python build.py dox etg --nodoc sip build bdist_wheel; \ python build.py dox etg --nodoc sip build bdist_wheel; \
ln -sf `readlink -f dist/wxPython*.whl` ../; \ ln -sf `readlink -f dist/wxPython*.whl` ../; \
fi; fi;

BIN
thirdparty/attrdict-2.0.1.tar.gz vendored Normal file

Binary file not shown.