-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
425 additions
and
82 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bin/ | ||
venv/ | ||
.git/ | ||
.buildozer/ | ||
.pytest_cache/ | ||
.tox/ |
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,3 +1,6 @@ | ||
# Custom | ||
*.swp | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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,25 @@ | ||
sudo: required | ||
|
||
language: generic | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
global: | ||
- DISPLAY=:99.0 | ||
matrix: | ||
- TAG=zbarcam-linux DOCKERFILE=dockerfiles/Dockerfile-linux COMMAND='tox' | ||
|
||
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 . | ||
|
||
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 |
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,5 +1,16 @@ | ||
# Change Log | ||
|
||
## [20190910] | ||
## [2019.0911] | ||
|
||
- Move to new garden layout | ||
- Setup Docker testing | ||
- Split kvlang file from Python code | ||
- Setup Continuous Integration testing, refs #1 | ||
- Setup linting, refs #2 | ||
- Unit tests `platform_api` module, refs #3 | ||
- Publish to PyPI, refs #4 | ||
- Introduce `Makefile`, refs #8 | ||
|
||
## [2019.0910] | ||
|
||
- Initial release before revamp |
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,85 @@ | ||
VENV_NAME=venv | ||
PIP=$(VENV_NAME)/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 | ||
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 \ | ||
libsdl2-dev \ | ||
libzbar-dev \ | ||
tox \ | ||
virtualenv | ||
OS=$(shell lsb_release -si) | ||
PYTHON_MAJOR_VERSION=3 | ||
PYTHON_MINOR_VERSION=6 | ||
PYTHON_VERSION=$(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 | ||
|
||
virtualenv: venv | ||
$(PIP) install Cython==0.28.6 | ||
$(PIP) install -r requirements.txt | ||
|
||
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 | ||
$(PYTHON) src/main.py --debug | ||
|
||
run: run/linux | ||
|
||
test: | ||
$(TOX) | ||
|
||
lint/isort-check: virtualenv | ||
$(ISORT) --check-only --recursive --diff $(SOURCES) | ||
|
||
lint/isort-fix: virtualenv | ||
$(ISORT) --recursive $(SOURCES) | ||
|
||
lint/flake8: virtualenv | ||
$(FLAKE8) $(SOURCES) | ||
|
||
lint: lint/isort-check lint/flake8 | ||
|
||
docs/clean: | ||
rm -rf $(DOCS_DIR)/build/ | ||
|
||
docs: | ||
cd $(DOCS_DIR) && SPHINXBUILD=$(SPHINXBUILD) make html | ||
|
||
release/clean: | ||
rm -rf dist/ build/ | ||
|
||
release/build: release/clean | ||
$(PYTHON) setup.py sdist bdist_wheel | ||
$(PYTHON) setup_meta.py sdist bdist_wheel | ||
$(TWINE) check dist/* | ||
|
||
release/upload: | ||
$(TWINE) upload dist/* | ||
|
||
clean: release/clean docs/clean | ||
py3clean src/ | ||
find . -type d -name "__pycache__" -exec rm -r {} + | ||
find . -type d -name "*.egg-info" -exec rm -r {} + | ||
|
||
clean/all: clean | ||
rm -rf $(VENV_NAME) .tox/ |
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,62 @@ | ||
# Docker image for installing dependencies on Linux and running tests. | ||
# Build with: | ||
# docker build --tag=xcamera-linux --file=dockerfiles/Dockerfile-linux . | ||
# Run with: | ||
# docker run xcamera-linux /bin/sh -c 'make test' | ||
# Or using the entry point shortcut: | ||
# docker run xcamera-linux 'make test' | ||
# For running UI: | ||
# xhost +"local:docker@" | ||
# docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix xcamera-linux 'make uitest' | ||
# Or for interactive shell: | ||
# docker run -it --rm xcamera-linux | ||
FROM ubuntu:18.04 | ||
|
||
ENV USER="user" | ||
ENV HOME_DIR="/home/${USER}" | ||
ENV WORK_DIR="${HOME_DIR}" | ||
|
||
# configure locale | ||
RUN apt update -qq > /dev/null && apt install --yes --no-install-recommends \ | ||
locales && \ | ||
locale-gen en_US.UTF-8 | ||
ENV LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" | ||
|
||
# install system dependencies | ||
RUN apt install --yes --no-install-recommends \ | ||
build-essential \ | ||
ccache \ | ||
cmake \ | ||
curl \ | ||
libsdl2-dev \ | ||
libsdl2-image-dev \ | ||
libsdl2-mixer-dev \ | ||
libsdl2-ttf-dev \ | ||
libpython3.6-dev \ | ||
libpython3.7-dev \ | ||
libzbar-dev \ | ||
lsb-release \ | ||
make \ | ||
pkg-config \ | ||
python3.6 \ | ||
python3.6-dev \ | ||
python3.7 \ | ||
python3.7-dev \ | ||
sudo \ | ||
tox \ | ||
virtualenv | ||
|
||
# prepare non root env | ||
RUN useradd --create-home --shell /bin/bash ${USER} | ||
# with sudo access and no password | ||
RUN usermod -append --groups sudo ${USER} | ||
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
USER ${USER} | ||
WORKDIR ${WORK_DIR} | ||
COPY . ${WORK_DIR} | ||
|
||
# RUN make | ||
ENTRYPOINT ["./dockerfiles/start.sh"] |
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,10 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# if a some command has been passed to container, executes it and exit, | ||
# otherwise runs bash | ||
if [[ $@ ]]; then | ||
eval $@ | ||
else | ||
/bin/bash | ||
fi |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
Kivy==1.11.1 | ||
opencv-python==4.1.1.26 |
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,3 @@ | ||
flake8 | ||
isort | ||
pytest |
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,40 @@ | ||
import os | ||
|
||
from setuptools import find_namespace_packages, setup | ||
|
||
from src.kivy_garden.xcamera import version | ||
|
||
|
||
def read(fname): | ||
with open(os.path.join(os.path.dirname(__file__), fname)) as f: | ||
return f.read() | ||
|
||
|
||
# exposing the params so it can be imported | ||
setup_params = { | ||
'name': 'kivy_garden.xcamera', | ||
'version': version.__version__, | ||
'description': 'Real time Barcode and QR Code scanner Edit', | ||
'long_description': read('README.md'), | ||
'long_description_content_type': 'text/markdown', | ||
'author': 'Antonio Cuni', | ||
'url': 'https://github.com/kivy-garden/xcamera', | ||
'packages': find_namespace_packages(where='src'), | ||
'package_data': { | ||
'kivy_garden.xcamera': ['*.kv'], | ||
'kivy_garden.xcamera.data': ['*.ttf', '*.wav'], | ||
}, | ||
'package_dir': {'': 'src'}, | ||
'install_requires': [ | ||
'kivy', | ||
], | ||
} | ||
|
||
|
||
def run_setup(): | ||
setup(**setup_params) | ||
|
||
|
||
# makes sure the setup doesn't run at import time | ||
if __name__ == '__main__': | ||
run_setup() |
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,14 @@ | ||
""" | ||
Creates a distribution alias that just installs kivy_garden.xcamera. | ||
""" | ||
from setuptools import setup | ||
|
||
from setup import setup_params | ||
|
||
setup_params.update({ | ||
'install_requires': ['kivy_garden.xcamera'], | ||
'name': 'xcamera', | ||
}) | ||
|
||
|
||
setup(**setup_params) |
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,15 @@ | ||
""" | ||
Exposes `XCamera` directly in `xcamera` rather than `xcamera.xcamera`. | ||
Also note this may break `pip` since all imports within `xcamera.py` would be | ||
required at setup time. This is because `version.py` (same directory) is used | ||
by the `setup.py` file. | ||
Hence we're not exposing `XCamera` if `pip` is detected. | ||
""" | ||
import os | ||
|
||
project_dir = os.path.abspath( | ||
os.path.join(__file__, os.pardir, os.pardir, os.pardir, os.pardir)) | ||
using_pip = os.path.basename(project_dir).startswith('pip-') | ||
# only exposes `XCamera` if not within `pip` ongoing install | ||
if not using_pip: | ||
from .xcamera import XCamera # noqa |
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.