Skip to content

Commit c6cb501

Browse files
committed
__version__ string added to lib
1 parent 728aadd commit c6cb501

5 files changed

Lines changed: 70 additions & 10 deletions

File tree

library/CHANGELOG.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
0.1.2
2-
-----
2+
-----
33

44
* Initial commit to Raspbian apt repository
55

66
0.1.1
7-
-----
7+
-----
88

99
* Increased delay in polling loop to avoid CPU hogging
1010

1111
0.0.2
12-
-----
12+
-----
1313

1414
* Many little bugfixes, for an actually working library
1515

library/cap1xxx.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
except ImportError:
2626
exit("This library requires the RPi.GPIO module\nInstall with: sudo pip install RPi.GPIO")
2727

28+
__version__ = '0.1.2'
2829

2930
# DEVICE MAP
3031
DEFAULT_ADDR = 0x28

packaging/makeall.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# script control variables
44

5-
reponame="cap1xxx" # leave this blank for auto-detection
6-
libname="cap1xxx" # leave this blank for auto-detection
5+
reponame="" # leave this blank for auto-detection
6+
libname="" # leave this blank for auto-detection
77

88
debianlog="debian/changelog"
99
debcontrol="debian/control"
@@ -51,12 +51,13 @@ if [ -z "$reponame" ]; then
5151
repodir="$rootdir"
5252
reponame="$(basename $repodir)"
5353
fi
54+
reponame=$(echo "$reponame" | tr "[A-Z]" "[a-z]")
5455
fi
5556

5657
if [ -z "$libname" ]; then
5758
cd "$libdir"
5859
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
59-
cd "$debdir"
60+
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
6061
fi
6162

6263
echo "reponame is $reponame and libname is $libname"

packaging/makedeb.sh

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

3-
gettools="yes"
3+
gettools="no"
44
setup="yes"
55
cleanup="yes"
66
pkgfiles=( "build" "changes" "deb" "dsc" "tar.xz" )
@@ -16,7 +16,7 @@ if [ $setup == "yes" ]; then
1616
cp -R ./debian/ ../library/
1717
fi
1818

19-
cd ../library && debuild -aarmhf
19+
cd ../library && debuild
2020

2121
for file in ${pkgfiles[@]}; do
2222
mv ../*.$file ../packaging

packaging/makelog.sh

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,76 @@
11
#!/bin/bash
22

3+
# script control variables
4+
5+
libname="" # leave this blank for auto-detection
6+
vlibwarn="yes"
7+
8+
debdir="$(pwd)"
9+
rootdir="$(dirname $debdir)"
10+
libdir="$rootdir/library"
11+
312
mainlog="CHANGELOG"
413
debianlog="debian/changelog"
5-
pypilog="../library/CHANGELOG.txt"
14+
pypilog="$libdir/CHANGELOG.txt"
15+
16+
# function define
17+
18+
success() {
19+
echo "$(tput setaf 2)$1$(tput sgr0)"
20+
}
21+
22+
inform() {
23+
echo "$(tput setaf 6)$1$(tput sgr0)"
24+
}
25+
26+
warning() {
27+
echo "$(tput setaf 1)$1$(tput sgr0)"
28+
}
29+
30+
newline() {
31+
echo ""
32+
}
633

734
# generate debian changelog
835

936
cat $mainlog > $debianlog
37+
inform "seeded debian changelog"
1038

1139
# generate pypi changelog
1240

1341
sed -e "/--/d" -e "s/ \*/\*/" \
1442
-e "s/.*\([0-9].[0-9].[0-9]\).*/\1/" \
1543
-e '/[0-9].[0-9].[0-9]/ a\
16-
-----' $mainlog | cat -s > $pypilog
44+
-----' $mainlog | cat -s > $pypilog
45+
46+
version=$(head -n 1 $pypilog)
47+
inform "pypi changelog generated"
48+
49+
# touch up version in setup.py file
50+
51+
if [ -n $(grep version "$libdir/setup.py" &> /dev/null) ]; then
52+
inform "touched up version in setup.py"
53+
sed -i "s/[0-9].[0-9].[0-9]/$version/" "$libdir/setup.py"
54+
else
55+
warning "couldn't touch up version in setup, no match found"
56+
fi
57+
58+
# touch up version in lib
59+
60+
if [ -z "$libname" ]; then
61+
cd "$libdir"
62+
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
63+
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
64+
fi
65+
66+
if grep -e "__version__" "$libdir/$libname.py" &> /dev/null; then
67+
sed -i "s/__version__ = '[0-9].[0-9].[0-9]/__version__ = '$version/" "$libdir/$libname.py"
68+
inform "touched up version in $(basename $libdir/$libname.py)"
69+
elif grep -e "__version__" "$libdir/$libname/__init__.py" &> /dev/null; then
70+
sed -i "s/__version__ = '[0-9].[0-9].[0-9]/__version__ = '$version/" "$libdir/$libname/__init__.py"
71+
inform "touched up version in $(basename $libdir/$libname/__init__.py)"
72+
elif [ "$vlibwarn" == "yes" ]; then
73+
warning "couldn't touch up __version__ in lib, no match found"
74+
fi
1775

1876
exit 0

0 commit comments

Comments
 (0)