Add rule to Makefile to build wxPython

This commit is contained in:
Sylvain Tricot 2021-02-22 20:28:13 +01:00
parent 979947a013
commit 299518f194
4 changed files with 77 additions and 34 deletions

2
.gitignore vendored
View File

@ -10,7 +10,7 @@ htmlcov
package/ package/
src/msspec/results.txt src/msspec/results.txt
*venv/ *venv/
**/*build/ **/*build*/
**/*dist/ **/*dist/
**/*.egg-info/ **/*.egg-info/
.ropeproject .ropeproject

View File

@ -1,43 +1,49 @@
include src/options.mk include src/options.mk
PYTHON = python
PYMAJ = 3
PYMIN = 6
# Checking Python path and version
PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null)
ifndef PYTHON_EXE
$(error Unable to find the $(PYTHON) executable!)
endif
ifeq ($(shell $(PYTHON_EXE) -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0)
$(error Python version >= $(PYMAJ).$(PYMIN) is needed!)
endif
.PHONY: pybinding install devel venv doc clean .PHONY: pybinding install devel venv doc clean
pybinding: pybinding:
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding @+$(INSIDE_VENV) $(MAKE) -C src pybinding
venv: venv:
ifeq ($(NO_VENV),0)
@virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH)
@. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze @$(INSIDE_VENV) pip install --upgrade pip && pip install -r src/pip.freeze
endif
install: venv pybinding install: venv pybinding wx
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist @+$(INSIDE_VENV) $(MAKE) -C src sdist
@+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend @+$(INSIDE_VENV) $(MAKE) -C src frontend
@+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz @+$(INSIDE_VENV) pip install src/dist/msspec-$(VERSION).tar.gz
@echo "Do not forget to check that $(INSTALL_PREFIX)/bin is set in your \$$PATH" @echo "Do not forget to check that $(INSTALL_PREFIX)/bin is set in your \$$PATH"
devel: VENV_PATH = ./_venv devel: VENV_PATH = ./_venv
devel: venv pybinding devel: venv pybinding wx
@. $(VENV_PATH)/bin/activate && pip install -e src/ @$(INSIDE_VENV) pip install -e src/
wx:
@echo "Building wxPython for your `python --version` under Linux $(DISTRO_RELEASE)..."
# Create a folder to build wx into
@mkdir -p _build_wx
# 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
# Build the source if a tar.gz was downloaded
@$(INSIDE_VENV) cd _build_wx && \
if [ -e wxPython*.tar.gz ]; then \
tar -x --skip-old-files -vzf wxPython*.tar.gz; \
cd `ls -d wxPython*/`; \
pip install requests; \
python build.py dox etg --nodoc sip build bdist_wheel; \
ln -s `readlink -f dist/wxPython*.whl` ../; \
fi;
# Install the wheel
@$(INSIDE_VENV) cd _build_wx && pip install wxPython*.whl
doc: doc:

View File

@ -1,6 +1,11 @@
PYTHON = python
PYMAJ = 3
PYMIN = 6
FC = gfortran FC = gfortran
F2PY = f2py3 F2PY = f2py3
NO_VENV = 0
DEBUG = 0 DEBUG = 0
VERBOSE = 0 VERBOSE = 0
BUILDDIR = ./build BUILDDIR = ./build
@ -40,6 +45,40 @@ F2PYFLAGS_DBG = --debug-capi --debug
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/') VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION) VENV_PATH := $(INSTALL_PREFIX)/src/msspec_venv_$(VERSION)
# Checking Python path and version
PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null)
ifndef PYTHON_EXE
$(error Unable to find the $(PYTHON) executable!)
endif
ifeq ($(shell $(PYTHON_EXE) -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0)
$(error Python version >= $(PYMAJ).$(PYMIN) is needed!)
endif
# Checking your distribution type and release
LSB_RELEASE := $(shell command -v lsb_release 2> /dev/null)
DISTRO_RELEASE =
ifdef LSB_RELEASE
DISTRO_RELEASE = $(shell echo $(shell $(LSB_RELEASE) -s -i)-$(shell $(LSB_RELEASE) -s -r) | tr [:upper:] [:lower:] )
endif
ifndef DISTRO_RELEASE
$(warning Unable to guess your OS name and version)
endif
# Define the INSIDE_VENV variable
ifeq ($(NO_VENV), 1)
INSIDE_VENV =
else
INSIDE_VENV = . $(VENV_PATH)/bin/activate &&
endif
ifeq ($(VERBOSE),0) ifeq ($(VERBOSE),0)
OUPUT_REDIRECTION := 1>/dev/null 2>/dev/null OUPUT_REDIRECTION := 1>/dev/null 2>/dev/null
MAKEFLAGS = -s --no-print-directory MAKEFLAGS = -s --no-print-directory

View File

@ -9,5 +9,3 @@ pycairo
scipy scipy
setuptools-scm setuptools-scm
terminaltables terminaltables
#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-10/wxPython-4.1.0-cp37-cp37m-linux_x86_64.whl
#wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/debian-9/wxPython-4.0.7.post2-cp35-cp35m-linux_x86_64.whl