mirror of
https://github.com/cmur2/python-bme680.git
synced 2025-06-29 00:30:31 +02:00
Added packaging, dropped copy of C code
This commit is contained in:
5
packaging/CHANGELOG
Normal file
5
packaging/CHANGELOG
Normal file
@ -0,0 +1,5 @@
|
||||
bme680 (1.0.0) stable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Phil Howard <phil@pimoroni.com> Mon, 08 Sep 2014 00:00:00 +0000
|
9
packaging/debian/README
Normal file
9
packaging/debian/README
Normal file
@ -0,0 +1,9 @@
|
||||
README
|
||||
|
||||
Python library for the BME680 gas, temperature, pressure and humidity sensor. Supports communication over i2c only.
|
||||
|
||||
IMPORTANT
|
||||
|
||||
The bme680 library requires i2c.
|
||||
To enable run `curl get.pimoroni.com/i2c | bash`
|
||||
or use raspi-config and reboot your Raspberry Pi.
|
5
packaging/debian/changelog
Normal file
5
packaging/debian/changelog
Normal file
@ -0,0 +1,5 @@
|
||||
bme680 (1.0.0) stable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Phil Howard <phil@pimoroni.com> Mon, 08 Sep 2014 00:00:00 +0000
|
1
packaging/debian/clean
Normal file
1
packaging/debian/clean
Normal file
@ -0,0 +1 @@
|
||||
*.egg-info/*
|
1
packaging/debian/compat
Normal file
1
packaging/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
29
packaging/debian/control
Normal file
29
packaging/debian/control
Normal file
@ -0,0 +1,29 @@
|
||||
Source: bme680
|
||||
Maintainer: Phil Howard <phil@pimoroni.com>
|
||||
Homepage: https://github.com/pimoroni/bme680
|
||||
Section: python
|
||||
Priority: extra
|
||||
Build-Depends: debhelper (>= 9.0.0), dh-python, python-all (>= 2.7), python-setuptools, python3-all (>= 3.4), python3-setuptools
|
||||
Standards-Version: 3.9.6
|
||||
X-Python-Version: >= 2.7
|
||||
X-Python3-Version: >= 3.4
|
||||
|
||||
Package: python-bme680
|
||||
Architecture: all
|
||||
Section: python
|
||||
Depends: ${misc:Depends}, ${python:Depends}, python-rpi.gpio, python-spidev
|
||||
Description: Python library for the BME680 gas, temperature, pressure and humidity sensor.
|
||||
The BME680 is a gas, temperature, pressure and humidity sensor.
|
||||
Supports communication over i2c only.
|
||||
.
|
||||
This is the Python 2 version of the package.
|
||||
|
||||
Package: python3-bme680
|
||||
Architecture: all
|
||||
Section: python
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, python3-rpi.gpio, python3-spidev
|
||||
Description: Python library for the BME680 gas, temperature, pressure and humidity sensor.
|
||||
The BME680 is a gas, temperature, pressure and humidity sensor.
|
||||
Supports communication over i2c only.
|
||||
.
|
||||
This is the Python 3 version of the package.
|
26
packaging/debian/copyright
Normal file
26
packaging/debian/copyright
Normal file
@ -0,0 +1,26 @@
|
||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: bme680
|
||||
Source: https://github.com/pimoroni/bme680
|
||||
|
||||
Files: *
|
||||
Copyright: 2016 Pimoroni Ltd <phil@pimoroni.com>
|
||||
License: MIT
|
||||
|
||||
License: MIT
|
||||
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.
|
0
packaging/debian/docs
Normal file
0
packaging/debian/docs
Normal file
12
packaging/debian/rules
Executable file
12
packaging/debian/rules
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
#export DH_VERBOSE=1
|
||||
export DH_OPTIONS
|
||||
|
||||
%:
|
||||
dh $@ --with python2,python3 --buildsystem=python_distutils
|
||||
|
||||
override_dh_auto_install:
|
||||
python setup.py install --root debian/python-bme680 --install-layout=deb
|
||||
python3 setup.py install --root debian/python3-bme680 --install-layout=deb
|
1
packaging/debian/source/format
Normal file
1
packaging/debian/source/format
Normal file
@ -0,0 +1 @@
|
||||
3.0 (native)
|
1
packaging/debian/source/options
Normal file
1
packaging/debian/source/options
Normal file
@ -0,0 +1 @@
|
||||
extend-diff-ignore = "^[^/]+\.egg-info/"
|
165
packaging/makeall.sh
Executable file
165
packaging/makeall.sh
Executable file
@ -0,0 +1,165 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script control variables
|
||||
|
||||
reponame="" # leave this blank for auto-detection
|
||||
libname="" # leave this blank for auto-detection
|
||||
packagename="" # leave this blank for auto-selection
|
||||
|
||||
debianlog="debian/changelog"
|
||||
debcontrol="debian/control"
|
||||
debcopyright="debian/copyright"
|
||||
debrules="debian/rules"
|
||||
debreadme="debian/README"
|
||||
|
||||
debdir="$(pwd)"
|
||||
rootdir="$(dirname $debdir)"
|
||||
libdir="$rootdir/library"
|
||||
|
||||
FLAG=false
|
||||
|
||||
# function define
|
||||
|
||||
success() {
|
||||
echo "$(tput setaf 2)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
inform() {
|
||||
echo "$(tput setaf 6)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
warning() {
|
||||
echo "$(tput setaf 1)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
newline() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
# assessing repo and library variables
|
||||
|
||||
if [ -z "$reponame" ] || [ -z "$libname" ]; then
|
||||
inform "detecting reponame and libname..."
|
||||
else
|
||||
inform "using reponame and libname overrides"
|
||||
fi
|
||||
|
||||
if [ -z "$reponame" ]; then
|
||||
if [[ $rootdir == *"python"* ]]; then
|
||||
repodir="$(dirname $rootdir)"
|
||||
reponame="$(basename $repodir)"
|
||||
else
|
||||
repodir="$rootdir"
|
||||
reponame="$(basename $repodir)"
|
||||
fi
|
||||
reponame=$(echo "$reponame" | tr "[A-Z]" "[a-z]")
|
||||
fi
|
||||
|
||||
if [ -z "$libname" ]; then
|
||||
cd "$libdir"
|
||||
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
|
||||
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
|
||||
fi
|
||||
|
||||
if [ -z "$packagename" ]; then
|
||||
packagename="$libname"
|
||||
fi
|
||||
|
||||
echo "reponame is $reponame and libname is $libname"
|
||||
echo "output packages will be python-$packagename and python3-$packagename"
|
||||
|
||||
# checking generating changelog file
|
||||
|
||||
./makelog.sh
|
||||
version=$(head -n 1 "$libdir/CHANGELOG.txt")
|
||||
echo "building $libname version $version"
|
||||
|
||||
# checking debian/changelog file
|
||||
|
||||
inform "checking debian/changelog file..."
|
||||
|
||||
if ! head -n 1 $debianlog | grep "$libname" &> /dev/null; then
|
||||
warning "library not mentioned in header!" && FLAG=true
|
||||
elif head -n 1 $debianlog | grep "UNRELEASED"; then
|
||||
warning "this changelog is not going to generate a release!"
|
||||
warning "change distribution to 'stable'" && FLAG=true
|
||||
fi
|
||||
|
||||
# checking debian/copyright file
|
||||
|
||||
inform "checking debian/copyright file..."
|
||||
|
||||
if ! grep "^Source" $debcopyright | grep "$reponame" &> /dev/null; then
|
||||
warning "$(grep "^Source" $debcopyright)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "^Upstream-Name" $debcopyright | grep "$libname" &> /dev/null; then
|
||||
warning "$(grep "^Upstream-Name" $debcopyright)" && FLAG=true
|
||||
fi
|
||||
|
||||
# checking debian/control file
|
||||
|
||||
inform "checking debian/control file..."
|
||||
|
||||
if ! grep "^Source" $debcontrol | grep "$libname" &> /dev/null; then
|
||||
warning "$(grep "^Source" $debcontrol)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "^Homepage" $debcontrol | grep "$reponame" &> /dev/null; then
|
||||
warning "$(grep "^Homepage" $debcontrol)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "^Package: python-$packagename" $debcontrol &> /dev/null; then
|
||||
warning "$(grep "^Package: python-" $debcontrol)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "^Package: python3-$packagename" $debcontrol &> /dev/null; then
|
||||
warning "$(grep "^Package: python3-" $debcontrol)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "^Priority: extra" $debcontrol &> /dev/null; then
|
||||
warning "$(grep "^Priority" $debcontrol)" && FLAG=true
|
||||
fi
|
||||
|
||||
|
||||
# checking debian/rules file
|
||||
|
||||
inform "checking debian/rules file..."
|
||||
|
||||
if ! grep "debian/python-$packagename" $debrules &> /dev/null; then
|
||||
warning "$(grep "debian/python-" $debrules)" && FLAG=true
|
||||
fi
|
||||
|
||||
if ! grep "debian/python3-$packagename" $debrules &> /dev/null; then
|
||||
warning "$(grep "debian/python3-" $debrules)" && FLAG=true
|
||||
fi
|
||||
|
||||
# checking debian/README file
|
||||
|
||||
inform "checking debian/readme file..."
|
||||
|
||||
if ! grep -e "$libname" -e "$reponame" $debreadme &> /dev/null; then
|
||||
warning "README does not seem to mention product, repo or lib!" && FLAG=true
|
||||
fi
|
||||
|
||||
# summary of checks pre build
|
||||
|
||||
if $FLAG; then
|
||||
warning "Check all of the above and correct!" && exit 1
|
||||
else
|
||||
inform "we're good to go... bulding!"
|
||||
fi
|
||||
|
||||
# building deb and final checks
|
||||
|
||||
./makedeb.sh
|
||||
|
||||
inform "running lintian..."
|
||||
lintian -v $(find -name "python*$version*.deb")
|
||||
lintian -v $(find -name "python3*$version*.deb")
|
||||
|
||||
inform "checking signatures..."
|
||||
gpg --verify $(find -name "*$version*changes")
|
||||
gpg --verify $(find -name "*$version*dsc")
|
||||
|
||||
exit 0
|
30
packaging/makedeb.sh
Executable file
30
packaging/makedeb.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
gettools="no"
|
||||
setup="yes"
|
||||
cleanup="yes"
|
||||
pkgfiles=( "build" "changes" "deb" "dsc" "tar.xz" )
|
||||
|
||||
|
||||
if [ $gettools == "yes" ]; then
|
||||
sudo apt-get update && sudo apt-get install build-essential debhelper devscripts dh-make dh-python dput gnupg
|
||||
sudo apt-get install python-all python-setuptools python3-all python3-setuptools
|
||||
fi
|
||||
|
||||
if [ $setup == "yes" ]; then
|
||||
rm -R ../library/build ../library/debian &> /dev/null
|
||||
cp -R ./debian/ ../library/
|
||||
fi
|
||||
|
||||
cd ../library && debuild -aarmhf
|
||||
|
||||
for file in ${pkgfiles[@]}; do
|
||||
mv ../*.$file ../packaging
|
||||
done
|
||||
|
||||
if [ $cleanup == "yes" ]; then
|
||||
debuild clean
|
||||
rm -R ./build ./debian &> /dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
82
packaging/makelog.sh
Executable file
82
packaging/makelog.sh
Executable file
@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script control variables
|
||||
|
||||
libname="" # leave this blank for auto-detection
|
||||
sibname=() # name of sibling in packages list
|
||||
versionwarn="yes" # set to anything but 'yes' to turn off warning
|
||||
|
||||
debdir="$(pwd)"
|
||||
rootdir="$(dirname $debdir)"
|
||||
libdir="$rootdir/library"
|
||||
|
||||
mainlog="CHANGELOG"
|
||||
debianlog="debian/changelog"
|
||||
pypilog="$libdir/CHANGELOG.txt"
|
||||
|
||||
# function define
|
||||
|
||||
success() {
|
||||
echo "$(tput setaf 2)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
inform() {
|
||||
echo "$(tput setaf 6)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
warning() {
|
||||
echo "$(tput setaf 1)$1$(tput sgr0)"
|
||||
}
|
||||
|
||||
newline() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
# generate debian changelog
|
||||
|
||||
cat $mainlog > $debianlog
|
||||
inform "seeded debian changelog"
|
||||
|
||||
# generate pypi changelog
|
||||
|
||||
sed -e "/--/d" -e "s/ \*/\*/" \
|
||||
-e "s/.*\([0-9].[0-9].[0-9]\).*/\1/" \
|
||||
-e '/[0-9].[0-9].[0-9]/ a\
|
||||
-----' $mainlog | cat -s > $pypilog
|
||||
|
||||
version=$(head -n 1 $pypilog)
|
||||
inform "pypi changelog generated"
|
||||
|
||||
# touch up version in setup.py file
|
||||
|
||||
if [ -n $(grep version "$libdir/setup.py" &> /dev/null) ]; then
|
||||
inform "touched up version in setup.py"
|
||||
sed -i "s/'[0-9].[0-9].[0-9]'/'$version'/" "$libdir/setup.py"
|
||||
else
|
||||
warning "couldn't touch up version in setup, no match found"
|
||||
fi
|
||||
|
||||
# touch up version in lib or package siblings
|
||||
|
||||
if [ -z "$libname" ]; then
|
||||
cd "$libdir"
|
||||
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
|
||||
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
|
||||
sibname+=( "$libname" )
|
||||
elif [ "$libname" != "package" ]; then
|
||||
sibname+=( "$libname" )
|
||||
fi
|
||||
|
||||
for sibling in ${sibname[@]}; do
|
||||
if grep -e "__version__" "$libdir/$sibling.py" &> /dev/null; then
|
||||
sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling.py"
|
||||
inform "touched up version in $sibling.py"
|
||||
elif grep -e "__version__" "$libdir/$sibling/__init__.py" &> /dev/null; then
|
||||
sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling/__init__.py"
|
||||
inform "touched up version in $sibling/__init__.py"
|
||||
elif [ "$versionwarn" == "yes" ]; then
|
||||
warning "couldn't touch up __version__ in $sibling, no match found"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user