--- /dev/null
+build/
+_build/
+*.o
+*.so
+*.a
+*.py[cod]
+*.egg-info
+dist/
+__pycache__
+.DS_Store
+*.deb
+*.dsc
+*.build
+*.changes
+*.orig.*
+packaging/*tar.xz
+library/debian/
+.coverage
+.pytest_cache
+.tox
--- /dev/null
+---
+linters:
+ flake8:
+ python: 3
+ max-line-length: 160
--- /dev/null
+language: python
+sudo: false
+cache: pip
+
+git:
+ submodules: true
+
+matrix:
+ include:
+ - python: "2.7"
+ env: TOXENV=py27
+ - python: "3.5"
+ env: TOXENV=py35
+ - python: "2.7"
+ env: TOXENV=py27
+
+install:
+ - pip install --ignore-installed --upgrade setuptools pip tox coveralls
+
+script:
+ - cd library
+ - tox -vv
+
+after_success: if [ "$TOXENV" == "py35" ]; then coveralls; fi
--- /dev/null
+MIT License
+
+Copyright (c) 2018 Pimoroni Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $$2}'`
+LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $$2}'`
+
+.PHONY: usage install uninstall
+usage:
+ @echo "Usage: make <target>, where target is one of:\n"
+ @echo "install: install the library locally from source"
+ @echo "uninstall: uninstall the local library"
+ @echo "check: peform basic integrity checks on the codebase"
+ @echo "python-readme: generate library/README.rst from README.md"
+ @echo "python-wheels: build python .whl files for distribution"
+ @echo "python-sdist: build python source distribution"
+ @echo "python-clean: clean python build and dist directories"
+ @echo "python-dist: build all python distribution files"
+ @echo "python-testdeploy: build all and deploy to test PyPi"
+
+install:
+ ./install.sh
+
+uninstall:
+ ./uninstall.sh
+
+check:
+ @echo "Checking for trailing whitespace"
+ @! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
+ @echo "Checking for DOS line-endings"
+ @! grep -IUrn --color "\r" --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
+ @echo "Checking library/CHANGELOG.txt"
+ @cat library/CHANGELOG.txt | grep ^${LIBRARY_VERSION}
+ @echo "Checking library/${LIBRARY_NAME}/__init__.py"
+ @cat library/${LIBRARY_NAME}/__init__.py | grep "^__version__ = '${LIBRARY_VERSION}'"
+
+python-readme: library/README.rst
+
+python-license: library/LICENSE.txt
+
+library/README.rst: README.md
+ pandoc --from=markdown --to=rst -o library/README.rst README.md
+
+library/LICENSE.txt: LICENSE
+ cp LICENSE library/LICENSE.txt
+
+python-wheels: python-readme python-license
+ cd library; python3 setup.py bdist_wheel
+ cd library; python setup.py bdist_wheel
+
+python-sdist: python-readme python-license
+ cd library; python setup.py sdist
+
+python-clean:
+ -rm -r library/dist
+ -rm -r library/build
+ -rm -r library/*.egg-info
+
+python-dist: python-clean python-wheels python-sdist
+ ls library/dist
+
+python-testdeploy: python-dist
+ twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
+
+python-deploy: check python-dist
+ twine upload library/dist/*
--- /dev/null
+# {{TITLE}}
+
+[![Build Status](https://travis-ci.com/pimoroni/{{LIBNAME}}-python.svg?branch=master)](https://travis-ci.com/pimoroni/{{LIBNAME}}-python)
+[![Coverage Status](https://coveralls.io/repos/github/pimoroni/{{LIBNAME}}-python/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/{{LIBNAME}}-python?branch=master)
+[![PyPi Package](https://img.shields.io/pypi/v/{{LIBNAME}}.svg)](https://pypi.python.org/pypi/{{LIBNAME}}-python)
+[![Python Versions](https://img.shields.io/pypi/pyversions/{{LIBNAME}}.svg)](https://pypi.python.org/pypi/{{LIBNAME}}-python)
+
+# Installing
+
+Stable library from PyPi:
+
+* Just run `sudo pip install {{LIBNAME}}`
+
+Latest/development library from GitHub:
+
+* `git clone https://github.com/pimoroni/{{LIBNAME}}-python`
+* `cd {{LIBNAME}}-python`
+* `sudo ./install.sh`
+
--- /dev/null
+printf "\nOutstanding substitutions:\n"
+grep -Irn --color "{{[A-Z:]*}}"
+
+printf "\nOutstanding directory renames:\n"
+find . -regex ".*{{[A-Z]*}}"
--- /dev/null
+#!/bin/bash
+
+printf "{{LIBNAME:UC}} Python Library: Installer\n\n"
+
+if [ $(id -u) -ne 0 ]; then
+ printf "Script must be run as root. Try 'sudo ./install.sh'\n"
+ exit 1
+fi
+
+cd library
+
+printf "Installing for Python 2..\n"
+python setup.py install
+
+if [ -f "/usr/bin/python3" ]; then
+ printf "Installing for Python 3..\n"
+ python3 setup.py install
+fi
+
+cd ..
+
+printf "Done!\n"
--- /dev/null
+[run]
+source = {{LIBNAME}}
+omit =
+ .tox/*
--- /dev/null
+0.0.1
+-----
+
+* Initial Release
--- /dev/null
+MIT License
+
+Copyright (c) 2018 Pimoroni Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+include CHANGELOG.txt
+include LICENSE.txt
+include README.rst
+include setup.py
+recursive-include {{LIBNAME}} *.py
--- /dev/null
+[flake8]
+exclude =
+ .tox,
+ .eggs,
+ .git,
+ __pycache__,
+ build,
+ dist
+ignore =
+ E501
--- /dev/null
+#!/usr/bin/env python
+
+"""
+Copyright (c) 2016 Pimoroni
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+"""
+
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+classifiers = ['Development Status :: 4 - Beta',
+ 'Operating System :: POSIX :: Linux',
+ 'License :: OSI Approved :: MIT License',
+ 'Intended Audience :: Developers',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Topic :: Software Development',
+ 'Topic :: System :: Hardware']
+
+setup(
+ name='{{LIBNAME}}',
+ version='0.0.1',
+ author='Philip Howard',
+ author_email='phil@pimoroni.com',
+ description="""{{DESCRIPTION}}""",
+ long_description=open('README.rst').read() + '\n' + open('CHANGELOG.txt').read(),
+ license='MIT',
+ keywords='Raspberry Pi',
+ url='http://www.pimoroni.com',
+ classifiers=classifiers,
+ packages=['{{LIBNAME}}'],
+ install_requires=[]
+)
--- /dev/null
+[tox]
+envlist = py{27,35},qa
+skip_missing_interpreters = True
+
+[testenv]
+commands =
+ python setup.py install
+ coverage run -m py.test -v -r wsx
+ coverage report
+deps =
+ mock
+ pytest>=3.1
+ pytest-cov
+
+[testenv:qa]
+commands =
+ flake8 --ignore E501
+ rstcheck README.rst
+deps =
+ flake8
+ rstcheck
--- /dev/null
+
+__version__ = '0.0.1'
--- /dev/null
+#!/bin/bash
+
+PACKAGE="{{LIBNAME}}"
+
+printf "{{LIBNAME:UC}} Python Library: Uninstaller\n\n"
+
+if [ $(id -u) -ne 0 ]; then
+ printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n"
+ exit 1
+fi
+
+cd library
+
+printf "Unnstalling for Python 2..\n"
+pip uninstall $PACKAGE
+
+if [ -f "/usr/bin/pip3" ]; then
+ printf "Uninstalling for Python 3..\n"
+ pip3 uninstall $PACKAGE
+fi
+
+cd ..
+
+printf "Done!\n"