Skip to content

Commit a12a72b

Browse files
authored
Merge pull request #12 from RogueM/commit
latest make files
2 parents 4d19b25 + 49a882f commit a12a72b

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

packaging/makeall.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
reponame="" # leave this blank for auto-detection
66
libname="" # leave this blank for auto-detection
7+
packagename="" # leave this blank for auto-selection
78

89
debianlog="debian/changelog"
910
debcontrol="debian/control"
@@ -60,7 +61,12 @@ if [ -z "$libname" ]; then
6061
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
6162
fi
6263

64+
if [ -z "$packagename" ]; then
65+
packagename="$libname"
66+
fi
67+
6368
echo "reponame is $reponame and libname is $libname"
69+
echo "output packages will be python-$packagename and python3-$packagename"
6470

6571
# checking generating changelog file
6672

@@ -83,31 +89,31 @@ fi
8389

8490
inform "checking debian/copyright file..."
8591

86-
if ! grep "^Source" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
92+
if ! grep "^Source" $debcopyright | grep "$reponame" &> /dev/null; then
8793
warning "$(grep "^Source" $debcopyright)" && FLAG=true
8894
fi
8995

90-
if ! grep "^Upstream-Name" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
96+
if ! grep "^Upstream-Name" $debcopyright | grep "$libname" &> /dev/null; then
9197
warning "$(grep "^Upstream-Name" $debcopyright)" && FLAG=true
9298
fi
9399

94100
# checking debian/control file
95101

96102
inform "checking debian/control file..."
97103

98-
if ! grep "^Source" $debcontrol | grep "$libname" $debcontrol &> /dev/null; then
104+
if ! grep "^Source" $debcontrol | grep "$libname" &> /dev/null; then
99105
warning "$(grep "^Source" $debcontrol)" && FLAG=true
100106
fi
101107

102-
if ! grep "^Homepage" $debcontrol | grep "$reponame" $debcontrol &> /dev/null; then
108+
if ! grep "^Homepage" $debcontrol | grep "$reponame" &> /dev/null; then
103109
warning "$(grep "^Homepage" $debcontrol)" && FLAG=true
104110
fi
105111

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

110-
if ! grep "^Package: python3-$libname" $debcontrol &> /dev/null; then
116+
if ! grep "^Package: python3-$packagename" $debcontrol &> /dev/null; then
111117
warning "$(grep "^Package: python3-" $debcontrol)" && FLAG=true
112118
fi
113119

@@ -120,11 +126,11 @@ fi
120126

121127
inform "checking debian/rules file..."
122128

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

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

packaging/makelog.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
# script control variables
44

55
libname="" # leave this blank for auto-detection
6-
vlibwarn="yes"
6+
sibname=() # name of sibling in packages list
7+
versionwarn="yes" # set to anything but 'yes' to turn off warning
78

89
debdir="$(pwd)"
910
rootdir="$(dirname $debdir)"
@@ -50,27 +51,32 @@ inform "pypi changelog generated"
5051

5152
if [ -n $(grep version "$libdir/setup.py" &> /dev/null) ]; then
5253
inform "touched up version in setup.py"
53-
sed -i "s/[0-9].[0-9].[0-9]/$version/" "$libdir/setup.py"
54+
sed -i "s/'[0-9].[0-9].[0-9]'/'$version'/" "$libdir/setup.py"
5455
else
5556
warning "couldn't touch up version in setup, no match found"
5657
fi
5758

58-
# touch up version in lib
59+
# touch up version in lib or package siblings
5960

6061
if [ -z "$libname" ]; then
6162
cd "$libdir"
6263
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
6364
libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir"
65+
sibname+=( "$libname" )
66+
elif [ "$libname" != "package" ]; then
67+
sibname+=( "$libname" )
6468
fi
6569

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
70+
for sibling in ${sibname[@]}; do
71+
if grep -e "__version__" "$libdir/$sibling.py" &> /dev/null; then
72+
sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling.py"
73+
inform "touched up version in $sibling.py"
74+
elif grep -e "__version__" "$libdir/$sibling/__init__.py" &> /dev/null; then
75+
sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling/__init__.py"
76+
inform "touched up version in $sibling/__init__.py"
77+
elif [ "$versionwarn" == "yes" ]; then
78+
warning "couldn't touch up __version__ in $sibling, no match found"
79+
fi
80+
done
7581

7682
exit 0

0 commit comments

Comments
 (0)