Skip to content

Commit

Permalink
deb dependencies corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueM committed Dec 13, 2016
1 parent bf99fa9 commit ed9ac16
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 20 deletions.
2 changes: 2 additions & 0 deletions library/README.txt
@@ -0,0 +1,2 @@
Learn more: https://shop.pimoroni.com/products/rainbow-hat-for-android-things

6 changes: 3 additions & 3 deletions library/rainbowhat/buzzer.py
Expand Up @@ -49,11 +49,11 @@ def note(frequency, duration=1.0):
_timeout.start()

def midi_note(note_number, duration=1.0):
"""Play a single note by midi note number.
"""Play a single note by MIDI note number.
Converts a midi note number into a frequency and plays it. A5 is 69.
Converts a MIDI note number into a frequency and plays it. A5 is 69.
:param note_number: Midi note number of note
:param note_number: MIDI note number of note
:param duration: Optional duration in seconds, use None to sustain note
"""
Expand Down
6 changes: 3 additions & 3 deletions packaging/debian/README
@@ -1,6 +1,6 @@
README

Rainbow HAT is fun and flexible with plenty of scope for interesting projects.
Rainbow HAT is ideal for exploring protocols and devices on the Raspberry Pi. It features displays, sensors, sound, and LEDs - plenty of scope for interesting projects!

Learn more: https://shop.pimoroni.com/products/rainbow-hat
For examples run: `curl -sS get.pimoroni.com/rainbowhat | bash`
Learn more: https://shop.pimoroni.com/products/rainbow-hat-for-android-things
For examples run: `curl -sS https://get.pimoroni.com/rainbowhat | bash`
8 changes: 4 additions & 4 deletions packaging/debian/control
Expand Up @@ -11,8 +11,8 @@ X-Python3-Version: >= 3.4
Package: python-rainbowhat
Architecture: all
Section: python
Depends: ${misc:Depends}, ${python:Depends}
Suggests:
Depends: ${misc:Depends}, ${python:Depends}, python-rpi.gpio, python-smbus
Suggests: python-numpy
Description: python library designed to control Rainbow HAT
Ideal for exploring protocols and devices on the Raspberry Pi.
.
Expand All @@ -21,8 +21,8 @@ Description: python library designed to control Rainbow HAT
Package: python3-rainbowhat
Architecture: all
Section: python
Depends: ${misc:Depends}, ${python3:Depends}
Suggests:
Depends: ${misc:Depends}, ${python3:Depends}, python3-rpi.gpio, python3-smbus
Suggests: python3-numpy
Description: python library designed to control Rainbow HAT
Ideal for explorer protocols and devices on the Raspberry Pi.
.
Expand Down
35 changes: 26 additions & 9 deletions packaging/makeall.sh
Expand Up @@ -4,6 +4,10 @@

reponame="" # leave this blank for auto-detection
libname="" # leave this blank for auto-detection
packagename="" # leave this blank for auto-selection

rpigpio="yes" # set to 'no' to turn off warning
smbus="yes" # set to 'no' to turn off warning

debianlog="debian/changelog"
debcontrol="debian/control"
Expand Down Expand Up @@ -51,15 +55,21 @@ if [ -z "$reponame" ]; then
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)
cd "$debdir"
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

Expand All @@ -82,48 +92,55 @@ fi

inform "checking debian/copyright file..."

if ! grep "^Source" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
if ! grep "^Source" $debcopyright | grep "$reponame" &> /dev/null; then
warning "$(grep "^Source" $debcopyright)" && FLAG=true
fi

if ! grep "^Upstream-Name" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
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" $debcontrol &> /dev/null; then
if ! grep "^Source" $debcontrol | grep "$libname" &> /dev/null; then
warning "$(grep "^Source" $debcontrol)" && FLAG=true
fi

if ! grep "^Homepage" $debcontrol | grep "$reponame" $debcontrol &> /dev/null; then
if ! grep "^Homepage" $debcontrol | grep "$reponame" &> /dev/null; then
warning "$(grep "^Homepage" $debcontrol)" && FLAG=true
fi

if ! grep "^Package: python-$libname" $debcontrol &> /dev/null; then
if ! grep "^Package: python-$packagename" $debcontrol &> /dev/null; then
warning "$(grep "^Package: python-" $debcontrol)" && FLAG=true
fi

if ! grep "^Package: python3-$libname" $debcontrol &> /dev/null; then
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

if [ $rpigpio == "yes" ] && ! grep "rpi.gpio" $debcontrol &> /dev/null; then
warning "if this library does not depend on rpi.gpio change 'rpigpio' variable!" && FLAG=true
fi

if [ $smbus == "yes" ] && ! grep "smbus" $debcontrol &> /dev/null; then
warning "if this library does not depend on smbus change the 'smbus' variable!" && FLAG=true
fi

# checking debian/rules file

inform "checking debian/rules file..."

if ! grep "debian/python-$libname" $debrules &> /dev/null; then
if ! grep "debian/python-$packagename" $debrules &> /dev/null; then
warning "$(grep "debian/python-" $debrules)" && FLAG=true
fi

if ! grep "debian/python3-$libname" $debrules &> /dev/null; then
if ! grep "debian/python3-$packagename" $debrules &> /dev/null; then
warning "$(grep "debian/python3-" $debrules)" && FLAG=true
fi

Expand Down
66 changes: 65 additions & 1 deletion packaging/makelog.sh
@@ -1,12 +1,41 @@
#!/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="../library/CHANGELOG.txt"
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

Expand All @@ -15,4 +44,39 @@ sed -e "/--/d" -e "s/ \*/\*/" \
-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

0 comments on commit ed9ac16

Please sign in to comment.