Skip to content

Commit

Permalink
Merge branch 'release/2019.0928'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras committed Sep 28, 2019
2 parents 9d4f63a + 15477f5 commit d1a1fc5
Show file tree
Hide file tree
Showing 18 changed files with 673 additions and 110 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
bin/
venv/
.git/
.buildozer/
.pytest_cache/
.tox/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Custom
*.swp
.buildozer/
bin/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -31,7 +33,6 @@ var/
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
Expand Down
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@ services:
- docker

env:
global:
- DISPLAY=:99.0
matrix:
- TAG=zbarcam-linux DOCKERFILE=dockerfiles/Dockerfile-linux COMMAND='tox'
- DISPLAY=:99.0

before_install:
- sudo apt update -qq > /dev/null
- sudo apt install --yes --no-install-recommends xvfb

install:
- docker build --tag=$TAG --file=$DOCKERFILE --build-arg CI .
- make docker/build

before_script:
- sh -e /etc/init.d/xvfb start

script:
- travis_wait docker run -e DISPLAY -e CI -v /tmp/.X11-unix:/tmp/.X11-unix $TAG $COMMAND
- make docker/run/test
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [2019.0928]

- Setup coverage testing
- Runtime camera permission check, refs #5
- Publish `xcamera` demo binary, refs #9
- Add Python3.7 support, refs #13

## [2019.0911]

- Move to new garden layout
Expand Down
78 changes: 54 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,60 +1,77 @@
VENV_NAME=venv
PIP=$(VENV_NAME)/bin/pip
VIRTUAL_ENV ?= venv
PIP=$(VIRTUAL_ENV)/bin/pip
TOX=`which tox`
GARDEN=$(VENV_NAME)/bin/garden
PYTHON=$(VENV_NAME)/bin/python
ISORT=$(VENV_NAME)/bin/isort
FLAKE8=$(VENV_NAME)/bin/flake8
PYTHON=$(VIRTUAL_ENV)/bin/python
ISORT=$(VIRTUAL_ENV)/bin/isort
FLAKE8=$(VIRTUAL_ENV)/bin/flake8
PYTEST=$(VIRTUAL_ENV)/bin/pytest
TWINE=`which twine`
SOURCES=src/ tests/ setup.py setup_meta.py
# using full path so it can be used outside the root dir
SPHINXBUILD=$(shell realpath venv/bin/sphinx-build)
DOCS_DIR=doc
SYSTEM_DEPENDENCIES= \
libpython$(PYTHON_VERSION)-dev \
build-essential \
ccache \
cmake \
curl \
git \
libsdl2-dev \
libsdl2-image-dev \
libsdl2-mixer-dev \
libsdl2-ttf-dev \
libpython3.6-dev \
libpython$(PYTHON_VERSION)-dev \
libzbar-dev \
pkg-config \
python3.6 \
python3.6-dev \
python3.7 \
python3.7-dev \
tox \
virtualenv
OS=$(shell lsb_release -si)
PYTHON_MAJOR_VERSION=3
PYTHON_MINOR_VERSION=6
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)


all: system_dependencies virtualenv

venv:
test -d venv || virtualenv -p $(PYTHON_WITH_VERSION) venv
system_dependencies:
ifeq ($(OS), Ubuntu)
sudo apt install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES)
endif

virtualenv: venv
$(VIRTUAL_ENV):
virtualenv -p $(PYTHON_WITH_VERSION) $(VIRTUAL_ENV)
$(PIP) install Cython==0.28.6
$(PIP) install -r requirements.txt

virtualenv: $(VIRTUAL_ENV)

virtualenv/test: virtualenv
$(PIP) install -r requirements/requirements-test.txt

system_dependencies:
ifeq ($(OS), Ubuntu)
sudo apt install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES)
endif

run/linux: virtualenv
run: virtualenv
$(PYTHON) src/main.py --debug

run: run/linux

test:
$(TOX)
@if test -n "$$CI"; then .tox/py$(PYTHON_MAJOR_MINOR)/bin/coveralls; fi; \

pytest: virtualenv/test
PYTHONPATH=src $(PYTEST) --cov src/ --cov-report html tests/

lint/isort-check: virtualenv
lint/isort-check: virtualenv/test
$(ISORT) --check-only --recursive --diff $(SOURCES)

lint/isort-fix: virtualenv
lint/isort-fix: virtualenv/test
$(ISORT) --recursive $(SOURCES)

lint/flake8: virtualenv
lint/flake8: virtualenv/test
$(FLAKE8) $(SOURCES)

lint: lint/isort-check lint/flake8
Expand All @@ -68,7 +85,7 @@ docs:
release/clean:
rm -rf dist/ build/

release/build: release/clean
release/build: release/clean virtualenv
$(PYTHON) setup.py sdist bdist_wheel
$(PYTHON) setup_meta.py sdist bdist_wheel
$(TWINE) check dist/*
Expand All @@ -80,6 +97,19 @@ clean: release/clean docs/clean
py3clean src/
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type d -name "*.egg-info" -exec rm -r {} +
rm -rf htmlcov/

clean/all: clean
rm -rf $(VENV_NAME) .tox/
rm -rf $(VIRTUAL_ENV) .tox/

docker/build:
docker build --tag=xcamera-linux --file=dockerfiles/Dockerfile-linux .

docker/run/test:
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix xcamera-linux 'make test'

docker/run/app:
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 xcamera-linux 'make run'

docker/run/shell:
docker run --env-file dockerfiles/env.list -v /tmp/.X11-unix:/tmp/.X11-unix --device=/dev/video0:/dev/video0 -it --rm xcamera-linux
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# XCamera: Android-optimized camera widget

[![Build Status](https://travis-ci.com/kivy-garden/xcamera.svg?branch=develop)](https://travis-ci.com/kivy-garden/xcamera)
[![Coverage Status](https://coveralls.io/repos/github/kivy-garden/xcamera/badge.svg?branch=develop)](https://coveralls.io/github/kivy-garden/xcamera?branch=develop)
[![PyPI version](https://badge.fury.io/py/xcamera.svg)](https://badge.fury.io/py/xcamera)

XCamera is a widget which extends the standard Kivy Camera widget with more
Expand All @@ -19,7 +20,7 @@ functionality. In particular:

Screenshot:

![screenshot](/screenshot.png?raw=True "Screenshot")
![screenshot](https://raw.githubusercontent.com/kivy-garden/xcamera/develop/screenshot.png?raw=True "Screenshot")

Notes:

Expand All @@ -35,19 +36,29 @@ Notes:
new button to allow the user to manually select the preferred size. Pull
requests are welcome :)

## Install
## Install & Usage
[xcamera is available on PyPI](https://pypi.org/project/xcamera/).
Therefore it can be installed via `pip`.
```sh
pip install xcamera
pip3 install --user xcamera
```
Once installed, the demo should be available in your `PATH` and can be ran from the command line.
```sh
xcamera
```
And the widget can be imported via:
```python
from kivy_garden.xcamera import XCamera
```

## Demo
A full working demo is available in [src/main.py](https://github.com/kivy-garden/xcamera/blob/master/src/main.py).
A full working demo is available in [src/kivy_garden/xcamera/main.py](https://github.com/kivy-garden/xcamera/blob/develop/src/main.py).
You can run it via:
```sh
make run
```

## Contribute
## Develop & Contribute
To play with the project, install system dependencies and Python requirements using the [Makefile](Makefile).
```sh
make
Expand All @@ -56,3 +67,16 @@ Then verify everything is OK by running tests.
```sh
make test
```
If you're familiar with `Docker`, the project can also run in a fully isolated container.
First build the image.
```sh
make docker/build
```
Then you can run tests within the container.
```sh
make docker/run/test
```
Or the application itself.
```sh
make docker/run/app
```
Loading

0 comments on commit d1a1fc5

Please sign in to comment.