diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2009-03-29 13:31:28 +0200 |
---|---|---|
committer | Gilles Dartiguelongue <eva@gentoo.org> | 2009-03-29 13:31:28 +0200 |
commit | a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a (patch) | |
tree | 199bc886db53212c0f013cbd626a705c07e00092 /scripts/convert-split-python.sh | |
parent | app-admin/pessulus: split deps (diff) | |
download | gnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.tar.gz gnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.tar.bz2 gnome-a20ebbfd02c0a1cc737b067fb9d9ae9a0225ee5a.zip |
Add informations and scripts to the overlay
Diffstat (limited to 'scripts/convert-split-python.sh')
-rwxr-xr-x | scripts/convert-split-python.sh | 46 |
1 files changed, 46 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 |