-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- revamps Makefile - simplifies .travis.yml - ditch tox
- Loading branch information
1 parent
77bd2b3
commit 4bf505b
Showing
9 changed files
with
197 additions
and
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ venv/ | |
.pytest_cache/ | ||
.tox/ | ||
bin/ | ||
*.pyc | ||
**/__pycache__ |
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 |
---|---|---|
@@ -1,58 +1,153 @@ | ||
VENV_NAME=venv | ||
ACTIVATE_PATH=$(VENV_NAME)/bin/activate | ||
PIP=`. $(ACTIVATE_PATH); which pip` | ||
TOX=`which tox` | ||
GARDEN=$(VENV_NAME)/bin/garden | ||
PYTHON=$(VENV_NAME)/bin/python | ||
SYSTEM_DEPENDENCIES=virtualenv build-essential libpython3.6-dev \ | ||
libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ | ||
cmake python-numpy tox wget curl libssl-dev libzbar-dev \ | ||
xclip xsel | ||
OS=$(shell lsb_release -si) | ||
TMPDIR ?= /tmp | ||
DOWNLOAD_DIR = $(TMPDIR)/downloads | ||
KM_REPOSITORY=https://raw.githubusercontent.com/AndreMiras/km | ||
KM_BRANCH=develop | ||
OPENCV_MAKEFILE_NAME=Makefile.opencv | ||
OPENCV_MAKEFILE_URL=$(KM_REPOSITORY)/$(KM_BRANCH)/attachments/$(OPENCV_MAKEFILE_NAME) | ||
|
||
|
||
all: system_dependencies virtualenv | ||
|
||
$(VENV_NAME): | ||
test -d $(VENV_NAME) || virtualenv -p python3 $(VENV_NAME) | ||
. $(VENV_NAME)/bin/activate | ||
$(PIP) install Cython==0.26.1 | ||
$(PIP) install -r requirements/requirements.txt | ||
$(GARDEN) install qrcode | ||
$(GARDEN) install xcamera | ||
|
||
virtualenv: $(VENV_NAME) | ||
VIRTUAL_ENV ?= venv | ||
ACTIVATE_PATH=$(VIRTUAL_ENV)/bin/activate | ||
PIP=$(VIRTUAL_ENV)/bin/pip | ||
PYTHON_MAJOR_VERSION=3 | ||
PYTHON_MINOR_VERSION=7 | ||
PYTHON_VERSION=$(PYTHON_MAJOR_VERSION).$(PYTHON_MINOR_VERSION) | ||
PYTHON_MAJOR_MINOR=$(PYTHON_MAJOR_VERSION)$(PYTHON_MINOR_VERSION) | ||
PYTHON_WITH_VERSION=python$(PYTHON_VERSION) | ||
PYTHON=$(VIRTUAL_ENV)/bin/python | ||
ISORT=$(VIRTUAL_ENV)/bin/isort | ||
FLAKE8=$(VIRTUAL_ENV)/bin/flake8 | ||
PYTEST=$(VIRTUAL_ENV)/bin/pytest | ||
COVERAGE=$(VIRTUAL_ENV)/bin/coverage | ||
TWINE=`which twine` | ||
SOURCES=src/ | ||
DOCKER_IMAGE_LINUX=andremiras/pywallet-linux | ||
DOCKER_IMAGE_ANDROID=andremiras/pywallet-android | ||
DOCKER_VOLUME=/tmp/.X11-unix:/tmp/.X11-unix | ||
SYSTEM_DEPENDENCIES_BASE= \ | ||
libpython$(PYTHON_VERSION)-dev \ | ||
python$(PYTHON_VERSION) | ||
SYSTEM_DEPENDENCIES_LINUX= \ | ||
build-essential \ | ||
libgl1 \ | ||
libzbar0 \ | ||
python$(PYTHON_MAJOR_VERSION)-virtualenv \ | ||
tox | ||
SYSTEM_DEPENDENCIES_ANDROID= \ | ||
autoconf \ | ||
automake \ | ||
cmake \ | ||
gettext \ | ||
libffi-dev \ | ||
libltdl-dev \ | ||
git \ | ||
libssl-dev \ | ||
libtool \ | ||
openjdk-8-jdk-headless \ | ||
patch \ | ||
pkg-config \ | ||
python$(PYTHON_MAJOR_VERSION)-pip \ | ||
python$(PYTHON_MAJOR_VERSION)-setuptools \ | ||
unzip \ | ||
zlib1g-dev \ | ||
zip | ||
ifndef CI | ||
DOCKER_DEVICE=--device=/dev/video0:/dev/video0 | ||
DOCKER_IT=-it | ||
endif | ||
|
||
all: virtualenv | ||
|
||
system_dependencies: | ||
ifeq ($(OS), Ubuntu) | ||
sudo apt install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES) | ||
endif | ||
apt update -qq > /dev/null && sudo apt -qq install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES_BASE) | ||
|
||
$(DOWNLOAD_DIR): | ||
mkdir --parents $(DOWNLOAD_DIR) | ||
system_dependencies/linux: system_dependencies | ||
apt update -qq > /dev/null && sudo apt -qq install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES_LINUX) | ||
|
||
opencv_build: $(DOWNLOAD_DIR) | ||
curl --location --progress-bar $(OPENCV_MAKEFILE_URL) \ | ||
--output $(DOWNLOAD_DIR)/$(OPENCV_MAKEFILE_NAME) | ||
make --file $(DOWNLOAD_DIR)/$(OPENCV_MAKEFILE_NAME) VENV_NAME=$(VENV_NAME) | ||
system_dependencies/android: system_dependencies | ||
apt update -qq > /dev/null && sudo apt -qq install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES_ANDROID) | ||
|
||
opencv_deploy: opencv_build virtualenv | ||
make --file $(DOWNLOAD_DIR)/$(OPENCV_MAKEFILE_NAME) opencv_deploy VENV_NAME=$(VENV_NAME) | ||
$(VIRTUAL_ENV): | ||
virtualenv --python $(PYTHON_WITH_VERSION) $(VIRTUAL_ENV) | ||
$(PIP) install Cython==0.28.6 | ||
$(PIP) install -r requirements.txt | ||
|
||
opencv: opencv_deploy | ||
virtualenv: $(VIRTUAL_ENV) | ||
|
||
clean: | ||
rm -rf $(VENV_NAME) .tox/ $(OPENCV_BASENAME) | ||
run: virtualenv | ||
$(PYTHON) src/main.py | ||
|
||
test: | ||
$(TOX) | ||
pytest: virtualenv | ||
$(COVERAGE) erase | ||
$(COVERAGE) run -m unittest discover --start-directory=src/ | ||
$(COVERAGE) report | ||
|
||
test: pytest lint | ||
@if test -n "$$CI"; then make uitest; fi; \ | ||
|
||
uitest: | ||
. $(ACTIVATE_PATH) && \ | ||
$(PYTHON) -m kivyunittest --folder src/tests/ui/ --pythonpath src/ | ||
|
||
lint/isort-check: virtualenv | ||
$(ISORT) --check-only --recursive --diff $(SOURCES) | ||
|
||
lint/isort-fix: virtualenv | ||
$(ISORT) --recursive $(SOURCES) | ||
|
||
lint/flake8: virtualenv | ||
$(FLAKE8) $(SOURCES) | ||
|
||
lint/mypy: virtualenv | ||
# $(MYPY) --ignore-missing-imports $(shell find src/pywallet/ -name "*.py") | ||
|
||
lint: lint/isort-check lint/flake8 lint/mypy | ||
|
||
release/clean: | ||
rm -rf dist/ build/ | ||
|
||
release/build: release/clean clean | ||
$(PYTHON) setup.py sdist bdist_wheel | ||
$(TWINE) check dist/* | ||
|
||
release/upload: | ||
$(TWINE) upload dist/* | ||
|
||
clean: | ||
rm -rf .pytest_cache/ | ||
find . -type d -name "__pycache__" -exec rm -r {} + | ||
find . -type d -name "*.egg-info" -exec rm -r {} + | ||
|
||
clean/venv: clean | ||
rm -rf $(VIRTUAL_ENV) | ||
|
||
buildozer/android/debug: | ||
@if test -n "$$CI"; then sed 's/log_level = [0-9]/log_level = 1/' -i buildozer.spec; fi; \ | ||
buildozer android debug | ||
|
||
docker/pull/linux: | ||
docker pull $(DOCKER_IMAGE_LINUX):latest | ||
|
||
docker/pull/android: | ||
docker pull $(DOCKER_IMAGE_ANDROID):latest | ||
|
||
docker/build/linux: | ||
docker build --cache-from=$(DOCKER_IMAGE_LINUX) --tag=$(DOCKER_IMAGE_LINUX) --file=dockerfiles/Dockerfile-linux . | ||
|
||
docker/build/android: | ||
docker build --cache-from=$(DOCKER_IMAGE_ANDROID) --tag=$(DOCKER_IMAGE_ANDROID) --file=dockerfiles/Dockerfile-android . | ||
|
||
docker/push/linux: | ||
docker push $(DOCKER_IMAGE_LINUX) | ||
|
||
docker/push/android: | ||
docker push $(DOCKER_IMAGE_ANDROID) | ||
|
||
docker/push: docker/push/linux docker/push/android | ||
|
||
docker/run/test/linux: | ||
docker run --env-file dockerfiles/env.list -v $(DOCKER_VOLUME) $(DOCKER_DEVICE) $(DOCKER_IT) --rm $(DOCKER_IMAGE_LINUX) make test | ||
|
||
docker/run/test/android: | ||
docker run --env-file dockerfiles/env.list $(DOCKER_IMAGE_ANDROID) make buildozer/android/debug | ||
|
||
docker/run/app: | ||
docker run --env-file dockerfiles/env.list -v $(DOCKER_VOLUME) $(DOCKER_DEVICE) -it --rm $(DOCKER_IMAGE_LINUX) make run | ||
|
||
docker/run/shell/linux: | ||
docker run --env-file dockerfiles/env.list -v $(DOCKER_VOLUME) $(DOCKER_DEVICE) -it --rm $(DOCKER_IMAGE_LINUX) | ||
|
||
docker/run/shell/android: | ||
docker run --env-file dockerfiles/env.list -v $(DOCKER_VOLUME) $(DOCKER_DEVICE) -it --rm $(DOCKER_IMAGE_ANDROID) |
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,9 @@ | ||
# used by coveralls.io, refs: | ||
# https://coveralls-python.readthedocs.io/en/latest/usage/tox.html#travisci | ||
CI | ||
TRAVIS | ||
TRAVIS_BRANCH | ||
TRAVIS_JOB_ID | ||
TRAVIS_PULL_REQUEST | ||
# used for running UI tests | ||
DISPLAY |
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 |
---|---|---|
@@ -1 +1,14 @@ | ||
-r requirements/requirements.txt | ||
coverage==4.4.1 | ||
flake8==3.3.0 | ||
isort==4.2.5 | ||
kivyunittest==0.1.8 | ||
eth-hash==0.1.1 | ||
eth-utils==1.4.1 | ||
https://github.com/AndreMiras/garden.layoutmargin/archive/20180517.tar.gz#egg=layoutmargin | ||
https://github.com/AndreMiras/garden.zbarcam/archive/20190303.zip#egg=zbarcam | ||
https://github.com/AndreMiras/KivyMD/archive/20181106.tar.gz#egg=kivymd | ||
Kivy==1.11.1 | ||
Pillow==5.2.0 | ||
qrcode==5.3 | ||
raven==6.1.0 | ||
web3==4.8.1 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.