Skip to content

Commit 1838768

Browse files
committed
Synced with boilerplate-python
2 parents 930245b + 4a1c675 commit 1838768

File tree

9 files changed

+56
-14
lines changed

9 files changed

+56
-14
lines changed

.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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ matrix:
1111
env: TOXENV=py27
1212
- python: "3.5"
1313
env: TOXENV=py35
14-
- python: "2.7"
15-
env: TOXENV=py27
1614

1715
install:
1816
- pip install --ignore-installed --upgrade setuptools pip tox coveralls
@@ -22,3 +20,6 @@ script:
2220
- tox -vv
2321

2422
after_success: if [ "$TOXENV" == "py35" ]; then coveralls; fi
23+
24+
notifications:
25+
email: false

Makefile

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1+
LIBRARY_VERSION=$(shell cat library/setup.py | grep version | awk -F"'" '{print $$2}')
2+
LIBRARY_NAME=$(shell cat library/setup.py | grep name | awk -F"'" '{print $$2}')
3+
14
.PHONY: usage install uninstall
25
usage:
6+
@echo "Library: ${LIBRARY_NAME}"
7+
@echo "Version: ${LIBRARY_VERSION}\n"
38
@echo "Usage: make <target>, where target is one of:\n"
49
@echo "install: install the library locally from source"
510
@echo "uninstall: uninstall the local library"
11+
@echo "check: peform basic integrity checks on the codebase"
612
@echo "python-readme: generate library/README.rst from README.md"
713
@echo "python-wheels: build python .whl files for distribution"
814
@echo "python-sdist: build python source distribution"
915
@echo "python-clean: clean python build and dist directories"
10-
@echo "python-dist: build all python distribution files"
16+
@echo "python-dist: build all python distribution files"
17+
@echo "python-testdeploy: build all and deploy to test PyPi"
18+
@echo "tag: tag the repository with the current version"
1119

1220
install:
1321
./install.sh
1422

1523
uninstall:
1624
./uninstall.sh
1725

26+
check:
27+
@echo "Checking for trailing whitespace"
28+
@! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
29+
#@echo "Checking for DOS line-endings"
30+
#@! grep -IUrn --color "" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
31+
@echo "Checking library/CHANGELOG.txt"
32+
@cat library/CHANGELOG.txt | grep ^${LIBRARY_VERSION}
33+
@echo "Checking library/${LIBRARY_NAME}/__init__.py"
34+
@cat library/${LIBRARY_NAME}/__init__.py | grep "^__version__ = '${LIBRARY_VERSION}'"
35+
36+
tag:
37+
git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"
38+
1839
python-readme: library/README.rst
1940

2041
python-license: library/LICENSE.txt
@@ -40,5 +61,8 @@ python-clean:
4061
python-dist: python-clean python-wheels python-sdist
4162
ls library/dist
4263

43-
python-deploy: python-dist
64+
python-testdeploy: python-dist
65+
twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
66+
67+
python-deploy: check python-dist
4468
twine upload library/dist/*

install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22

3-
printf "AS7262 Python Library: Installer\n\n"
3+
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
5+
6+
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n"
47

58
if [ $(id -u) -ne 0 ]; then
69
printf "Script must be run as root. Try 'sudo ./install.sh'\n"

library/as7262/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from i2cdevice import Device, Register, BitField, _int_to_bytes
77
from i2cdevice.adapter import Adapter, LookupAdapter
88

9+
__version__ = '0.0.2'
10+
911

1012
class as7262VirtualRegisterBus():
1113
"""AS7262 Virtual Register.

library/setup.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
[metadata]
2+
# This includes the license file(s) in the wheel.
3+
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
4+
license_files = LICENSE.txt
5+
16
[flake8]
27
exclude =
3-
test.py
48
.tox,
59
.eggs,
610
.git,

library/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
"""
4-
Copyright (c) 2016 Pimoroni.
4+
Copyright (c) 2016 Pimoroni
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of
77
this software and associated documentation files (the "Software"), to deal in
@@ -47,6 +47,7 @@
4747
license='MIT',
4848
keywords='Raspberry Pi',
4949
url='http://www.pimoroni.com',
50+
project_urls={'GitHub': 'https://www.github.com/pimoroni/as7262-python'},
5051
classifiers=classifiers,
5152
packages=['as7262'],
5253
install_requires=['i2cdevice']

library/tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ deps =
1111
mock
1212
pytest>=3.1
1313
pytest-cov
14-
14+
1515
[testenv:qa]
1616
commands =
17+
check-manifest --ignore tox.ini,tests*,.coveragerc
18+
python setup.py check -m -r -s
1719
flake8 --ignore E501
1820
rstcheck README.rst
1921
deps =
22+
check-manifest
2023
flake8
21-
flake8-docstrings
22-
flake8-quotes
2324
rstcheck

uninstall.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
22

3-
PACKAGE="as7262"
3+
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
45

5-
printf "AS7262 Python Library: Uninstaller\n\n"
6+
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Uninstaller\n\n"
67

78
if [ $(id -u) -ne 0 ]; then
89
printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n"
@@ -12,11 +13,11 @@ fi
1213
cd library
1314

1415
printf "Unnstalling for Python 2..\n"
15-
pip uninstall $PACKAGE
16+
pip uninstall $LIBRARY_NAME
1617

1718
if [ -f "/usr/bin/pip3" ]; then
1819
printf "Uninstalling for Python 3..\n"
19-
pip3 uninstall $PACKAGE
20+
pip3 uninstall $LIBRARY_NAME
2021
fi
2122

2223
cd ..

0 commit comments

Comments
 (0)