Skip to content

Commit 651e1c2

Browse files
committed
Initial Commit
0 parents  commit 651e1c2

File tree

18 files changed

+322
-0
lines changed

18 files changed

+322
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
build/
2+
_build/
3+
*.o
4+
*.so
5+
*.a
6+
*.py[cod]
7+
*.egg-info
8+
dist/
9+
__pycache__
10+
.DS_Store
11+
*.deb
12+
*.dsc
13+
*.build
14+
*.changes
15+
*.orig.*
16+
packaging/*tar.xz
17+
library/debian/
18+
.coverage
19+
.pytest_cache
20+
.tox

.stickler.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
linters:
3+
flake8:
4+
python: 3
5+
max-line-length: 160

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: python
2+
sudo: false
3+
cache: pip
4+
5+
git:
6+
submodules: true
7+
8+
matrix:
9+
include:
10+
- python: "2.7"
11+
env: TOXENV=py27
12+
- python: "3.5"
13+
env: TOXENV=py35
14+
- python: "2.7"
15+
env: TOXENV=py27
16+
17+
install:
18+
- pip install --ignore-installed --upgrade setuptools pip tox coveralls
19+
20+
script:
21+
- cd library
22+
- tox -vv
23+
24+
after_success: if [ "$TOXENV" == "py35" ]; then coveralls; fi

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Pimoroni Ltd.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $$2}'`
2+
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $$2}'`
3+
4+
.PHONY: usage install uninstall
5+
usage:
6+
@echo "Usage: make <target>, where target is one of:\n"
7+
@echo "install: install the library locally from source"
8+
@echo "uninstall: uninstall the local library"
9+
@echo "check: peform basic integrity checks on the codebase"
10+
@echo "python-readme: generate library/README.rst from README.md"
11+
@echo "python-wheels: build python .whl files for distribution"
12+
@echo "python-sdist: build python source distribution"
13+
@echo "python-clean: clean python build and dist directories"
14+
@echo "python-dist: build all python distribution files"
15+
@echo "python-testdeploy: build all and deploy to test PyPi"
16+
17+
install:
18+
./install.sh
19+
20+
uninstall:
21+
./uninstall.sh
22+
23+
check:
24+
@echo "Checking for trailing whitespace"
25+
@! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
26+
@echo "Checking for DOS line-endings"
27+
@! grep -IUrn --color "" --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
28+
@echo "Checking library/CHANGELOG.txt"
29+
@cat library/CHANGELOG.txt | grep ^${LIBRARY_VERSION}
30+
@echo "Checking library/${LIBRARY_NAME}/__init__.py"
31+
@cat library/${LIBRARY_NAME}/__init__.py | grep "^__version__ = '${LIBRARY_VERSION}'"
32+
33+
python-readme: library/README.rst
34+
35+
python-license: library/LICENSE.txt
36+
37+
library/README.rst: README.md
38+
pandoc --from=markdown --to=rst -o library/README.rst README.md
39+
40+
library/LICENSE.txt: LICENSE
41+
cp LICENSE library/LICENSE.txt
42+
43+
python-wheels: python-readme python-license
44+
cd library; python3 setup.py bdist_wheel
45+
cd library; python setup.py bdist_wheel
46+
47+
python-sdist: python-readme python-license
48+
cd library; python setup.py sdist
49+
50+
python-clean:
51+
-rm -r library/dist
52+
-rm -r library/build
53+
-rm -r library/*.egg-info
54+
55+
python-dist: python-clean python-wheels python-sdist
56+
ls library/dist
57+
58+
python-testdeploy: python-dist
59+
twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
60+
61+
python-deploy: check python-dist
62+
twine upload library/dist/*

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# {{TITLE}}
2+
3+
[![Build Status](https://travis-ci.com/pimoroni/{{LIBNAME}}-python.svg?branch=master)](https://travis-ci.com/pimoroni/{{LIBNAME}}-python)
4+
[![Coverage Status](https://coveralls.io/repos/github/pimoroni/{{LIBNAME}}-python/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/{{LIBNAME}}-python?branch=master)
5+
[![PyPi Package](https://img.shields.io/pypi/v/{{LIBNAME}}.svg)](https://pypi.python.org/pypi/{{LIBNAME}}-python)
6+
[![Python Versions](https://img.shields.io/pypi/pyversions/{{LIBNAME}}.svg)](https://pypi.python.org/pypi/{{LIBNAME}}-python)
7+
8+
# Installing
9+
10+
Stable library from PyPi:
11+
12+
* Just run `sudo pip install {{LIBNAME}}`
13+
14+
Latest/development library from GitHub:
15+
16+
* `git clone https://github.com/pimoroni/{{LIBNAME}}-python`
17+
* `cd {{LIBNAME}}-python`
18+
* `sudo ./install.sh`
19+

_bootstrap.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
printf "\nOutstanding substitutions:\n"
2+
grep -Irn --color "{{[A-Z:]*}}"
3+
4+
printf "\nOutstanding directory renames:\n"
5+
find . -regex ".*{{[A-Z]*}}"

install.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
printf "{{LIBNAME:UC}} Python Library: Installer\n\n"
4+
5+
if [ $(id -u) -ne 0 ]; then
6+
printf "Script must be run as root. Try 'sudo ./install.sh'\n"
7+
exit 1
8+
fi
9+
10+
cd library
11+
12+
printf "Installing for Python 2..\n"
13+
python setup.py install
14+
15+
if [ -f "/usr/bin/python3" ]; then
16+
printf "Installing for Python 3..\n"
17+
python3 setup.py install
18+
fi
19+
20+
cd ..
21+
22+
printf "Done!\n"

library/.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
source = {{LIBNAME}}
3+
omit =
4+
.tox/*

library/CHANGELOG.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.0.1
2+
-----
3+
4+
* Initial Release

0 commit comments

Comments
 (0)