summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2009-03-29 13:31:28 +0200
committerGilles Dartiguelongue <eva@gentoo.org>2009-03-29 13:31:28 +0200
commita20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a (patch)
tree199bc886db53212c0f013cbd626a705c07e00092 /scripts
parentapp-admin/pessulus: split deps (diff)
downloadgnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.tar.gz
gnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.tar.bz2
gnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.zip
Add informations and scripts to the overlay
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/convert-split-python.sh46
-rwxr-xr-xscripts/find-split-python.sh46
2 files changed, 92 insertions, 0 deletions
diff --git a/scripts/convert-split-python.sh b/scripts/convert-split-python.sh
new file mode 100755
index 00000000..31fec750
--- /dev/null
+++ b/scripts/convert-split-python.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Find specific python bindings import and prints a list of split python package
+# corresponding to those import.
+
+if [ $# -ne 1 ]; then
+ echo "usage: $0 PATH"
+ exit 1
+fi
+
+TMP=$(mktemp)
+
+BASE=$(dirname $0)
+$BASE/find-split-python.sh > $TMP
+
+IMPORT_LINES=$(find $1 -name "*.py" -exec egrep "^[[:blank:]]*import " {} \; |\
+ sed "s/;.*//g" |\
+ sed "s/from \(.*\+\) import .*/import \1/g" |\
+ sed "s/import \(.*\+\) as .*/import \1/g" |\
+ sed "s/^.*import //g" |\
+ sed "s/^\(.*?\)\./\1/g" |\
+ sort |uniq)
+for import_line in $IMPORT_LINES
+do
+ IMPORTS="${IMPORTS} $(echo $import_line |sed "s/,/\n/g"|cut -f1 -d.)"
+done
+
+IMPORTS=$(echo $IMPORTS|sed "s/ /\n/g"|sort|uniq)
+
+echo $IMPORTS
+
+# Find the python files
+for import in $(echo $IMPORTS)
+do
+ if egrep -q " $import($|,|[:blank:])" $TMP; then
+ #echo ""
+ echo -n " * Mapping $import"
+ echo ": $(egrep " $import( |,|$)" $TMP | cut -f1 -d:|xargs echo)"
+ #else
+ #echo -n "$import, "
+ # echo ""
+ fi
+done
+
+echo ""
+rm $TMP
diff --git a/scripts/find-split-python.sh b/scripts/find-split-python.sh
new file mode 100755
index 00000000..2a59a23e
--- /dev/null
+++ b/scripts/find-split-python.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Build a package/python module mapping file
+# This currently works for split python packages only
+
+REPO=$(portageq portdir)
+TMP=$(mktemp)
+
+# Adding well known entries
+echo "dev-python/pygtk: gtk
+dev-python/pygobject: gio gobject" > $TMP
+
+# Find ebuilds using the gnome-python eclass
+for x in $(find $REPO/dev-python -name "*.ebuild" \
+ -exec egrep -H "inherit.*gnome-python-common" {} \; |\
+ cut -f1 -d:)
+do
+ CAT="$(echo $x |cut -f 4 -d /)"
+ PN="$(echo $x |cut -f 5 -d /)"
+
+ if egrep -q G_PY_BINDINGS $x; then
+ BINDINGS=$(sed -n "/G_PY_BINDINGS/ p" $x | sed "s/G_PY_BINDINGS=\"//;s/\"//")
+ else
+ BINDINGS=$(echo $PN|sed "s/-python//")
+ fi
+
+ # There might be multiple bindings per package
+ BINDINGS_OUT=""
+ for binding in $BINDINGS; do
+ if python -c "import $binding" 2> /dev/null; then
+ BINDINGS_OUT="$BINDINGS_OUT $binding"
+ else
+ if python -c "import gnome$binding" 2> /dev/null; then
+ BINDINGS_OUT="$BINDINGS_OUT gnome$binding"
+ else
+ BINDINGS_OUT="$BINDINGS_OUT $(echo $binding | cut -f2 -d_)"
+ fi
+ fi
+ done
+
+ echo "$CAT/$PN: $BINDINGS_OUT" | tr -s ' ' >> $TMP
+done
+
+cat $TMP |sort -u
+
+rm $TMP