aboutsummaryrefslogtreecommitdiffstats
path: root/gi-find-deps.sh.in
diff options
context:
space:
mode:
authorJani Välimaa <wally@mageia.org>2013-07-31 18:48:58 +0000
committerJani Välimaa <wally@mageia.org>2013-07-31 18:48:58 +0000
commitd6b5f4004e912c7e054a1ca4af5bd964ed5bca09 (patch)
tree258eb82d54d66c3b11de3e838f1a500d9f575b31 /gi-find-deps.sh.in
parentdf3bd7655c7cdcad75dcbec7dc877f62e5c99653 (diff)
downloadrpm-setup-d6b5f4004e912c7e054a1ca4af5bd964ed5bca09.tar
rpm-setup-d6b5f4004e912c7e054a1ca4af5bd964ed5bca09.tar.gz
rpm-setup-d6b5f4004e912c7e054a1ca4af5bd964ed5bca09.tar.bz2
rpm-setup-d6b5f4004e912c7e054a1ca4af5bd964ed5bca09.tar.xz
rpm-setup-d6b5f4004e912c7e054a1ca4af5bd964ed5bca09.zip
sync more with SUSE to find typelib requires from Python scripts without .py extension (mga#10863)
Diffstat (limited to 'gi-find-deps.sh.in')
-rwxr-xr-xgi-find-deps.sh.in73
1 files changed, 45 insertions, 28 deletions
diff --git a/gi-find-deps.sh.in b/gi-find-deps.sh.in
index 013a787..f099c6a 100755
--- a/gi-find-deps.sh.in
+++ b/gi-find-deps.sh.in
@@ -39,8 +39,38 @@ while read file; do
done
}
+function javascript_requires {
+ for module in $(grep -h -P -o "imports\.gi\.([^\s'\";]+)" $1 | grep -v "imports\.gi\.version" | sed -r -e 's,\s+$,,g' -e 's,imports.gi.,,'); do
+ split_name_version $module
+ print_req_prov
+ done
+ for module in $(grep -h -P -o "imports\.gi\.versions.([^\s'\";]+)\s*=\s*['\"].+['\"]" $1 | \
+ sed -e 's:imports.gi.versions.::' -e "s:['\"]::g" -e 's:=:-:' -e 's: ::g'); do
+ split_name_version $module
+ print_req_prov
+ done
+}
+
+function python_requires {
+ for module in $(grep -h -P "from gi\.repository import (\w+)" $1 | sed 's:#.*::' | sed -e 's,from gi.repository import,,' -r -e 's:\s+as\s+\w+::g' -e 's:\s*,\s*: :g'); do
+ split_name_version $module
+ print_req_prov
+ echo "python-gi >= 2.90.2"
+ done
+ for module in $(grep -h -P -o "(gi\.require_version\(['\"][^'\"]+['\"],\s*['\"][^'\"]+['\"]\))" $1 | sed -e 's:gi.require_version::' -e "s:[()\"' ]::g" -e 's:,:-:'); do
+ split_name_version $module
+ print_req_prov
+ done
+}
+
+function typelib_requires {
+ for module in $(@RPMVENDORDIR@/g-ir-extract-deps $1 | tr '|' ' '); do
+ split_name_version $module
+ print_req_prov
+ done
+}
+
function find_requires {
-# FIXME: There are multiple ways gi bindings can be imported. We only catch the 'basic' one
# Currently, we detect:
# - in python:
# . from gi.repository import foo [Unversioned requirement of 'foo']
@@ -57,44 +87,31 @@ function find_requires {
while read file; do
case $file in
- *.js)
- for module in $(grep -h -P -o "imports\.gi\.([^\s'\";]+)" $file | grep -v "imports\.gi\.version" | sed -r -e 's,\s+$,,g' -e 's,imports.gi.,,'); do
- split_name_version $module
- print_req_prov
- done
- for module in $(grep -h -P -o "imports\.gi\.versions.([^\s'\";]+)\s*=\s*['\"].+['\"]" $file | \
- sed -e 's:imports.gi.versions.::' -e "s:['\"]::g" -e 's:=:-:' -e 's: ::g'); do
- split_name_version $module
- print_req_prov
- done
+ *.js)
+ javascript_requires "$file"
+ ;;
+ *.py)
+ python_requires "$file"
;;
- *.py)
- for module in $(grep -h -P "from gi\.repository import (\w+)" $file | sed 's:#.*::' | sed -e 's,from gi.repository import,,' -r -e 's:\s+as\s+\w+::g' -e 's:\s*,\s*: :g'); do
- split_name_version $module
- print_req_prov
- echo "python-gi >= 2.90.2"
- done
- for module in $(grep -h -P -o "(gi\.require_version\(['\"][^'\"]+['\"],\s*['\"][^'\"]+['\"]\))" $file | sed -e 's:gi.require_version::' -e "s:[()\"' ]::g" -e 's:,:-:'); do
- split_name_version $module
- print_req_prov
- done
+ *.typelib)
+ typelib_requires "$file"
;;
- *.typelib)
- for module in $(@RPMVENDORDIR@/g-ir-extract-deps $file | tr '|' ' '); do
- split_name_version $module
- print_req_prov
- done
+ *)
+ case $(file -b $file) in
+ Python\ script*)
+ python_requires "$file"
+ ;;
+ esac
;;
esac
done
}
case $1 in
- -P)
+ -P)
find_provides
;;
-R)
find_requires
;;
esac
-