Import newer scripts upstream

This commit is contained in:
Pierre Pronchery 2016-02-20 04:09:22 +01:00
parent a93657344e
commit f80008c67a
3 changed files with 46 additions and 20 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -29,6 +29,7 @@ PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
DEBUG="_debug"
DEVNULL="/dev/null"
PROGNAME="pkgconfig.sh"
#executables
INSTALL="install -m 0644"
MKDIR="mkdir -m 0755 -p"
@ -40,7 +41,7 @@ SED="sed"
#debug
_debug()
{
echo "$@" 1>&2
echo "$@" 1>&3
"$@"
}
@ -48,7 +49,7 @@ _debug()
#error
_error()
{
echo "pkgconfig.sh: $@" 1>&2
echo "$PROGNAME: $@" 1>&2
return 2
}
@ -56,7 +57,7 @@ _error()
#usage
_usage()
{
echo "Usage: pkgconfig.sh [-c|-i|-u][-P prefix] target..." 1>&2
echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
return 1
}
@ -104,6 +105,7 @@ if [ -z "$VERSION" ]; then
fi
PKGCONFIG="$PREFIX/lib/pkgconfig"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
shift
@ -121,7 +123,11 @@ while [ $# -gt 0 ]; do
if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
$DEBUG $INSTALL "$target" "$PKGCONFIG/$source" || exit 2
basename="$source"
if [ "${source##*/}" != "$source" ]; then
basename="${source##*/}"
fi
$DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2
continue
fi

View File

@ -47,7 +47,7 @@ TOUCH="touch"
#debug
_debug()
{
echo "$@" 1>&2
echo "$@" 1>&3
"$@"
}
@ -110,6 +110,7 @@ MODULE="$PACKAGE"
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
instdir="$DATADIR/gtk-doc/html"
exec 3>&1
while [ $# -gt 0 ]; do
target="$1"
target="${target#$OBJDIR}"

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014-2015 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2014-2016 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -26,22 +26,46 @@
#variables
PROGNAME="pylint.sh"
PROJECTCONF="../project.conf"
#executables
DATE="date"
DEBUG="_debug"
FIND="find"
PYLINT="pep8"
SORT="sort"
TR="tr"
#functions
#pylint
_pylint()
{
filename="$1"
subdirs="data doc src tests tools"
#XXX ignores errors
$DEBUG $PYLINT -- "$filename" 2>&1 | while read line; do
echo "$line" 1>&2
echo "$line"
$DATE
echo
while read line; do
case "$line" in
"["*)
break
;;
"subdirs="*)
subdirs=${line#subdirs=}
subdirs=$(echo "$subdirs" | $TR ',' ' ')
;;
esac
done < "$PROJECTCONF"
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -name '*.py' | $SORT); do
$DEBUG $PYLINT -- "$filename" 2>&1
if [ $? -eq 0 ]; then
echo "$filename:"
else
#XXX ignore errors
echo "$PROGNAME: $filename: FAIL" 1>&2
fi
done
done
}
@ -49,7 +73,7 @@ _pylint()
#debug
_debug()
{
echo "$@" 1>&2
echo "$@" 1>&3
"$@"
res=$?
#ignore errors when the command is not available
@ -92,10 +116,5 @@ target="$1"
#clean
[ $clean -ne 0 ] && exit 0
ret=0
(date
echo
$FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | while read filename; do
_pylint "$filename"
done) > "$target"
exit $ret
exec 3>&1
_pylint > "$target"