[projects/cleanbuild] findbr: python version detect

glen glen at pld-linux.org
Tue Sep 6 18:18:35 CEST 2016


commit 572fe114bd7719a2672b68cd8d1ccc17f2e8ca11
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue Sep 6 19:12:24 2016 +0300

    findbr: python version detect

 findbr | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/findbr b/findbr
index e32557d..52220bf 100755
--- a/findbr
+++ b/findbr
@@ -216,11 +216,18 @@ start_check:
 my %checked;
 my $cmake_get_call = 0;
 my $cmake_pkg_list = 0;
+my $py_ver = undef;
 while ( $_ = shift @lines ) {
 	chomp;
 	#next if $checked{ $_ };
 	#$checked{ $_ } = 1;
 
+	# try to extract current python version from setup.py run
+	if (m{^copying .+ -> build-(\d+)/lib/}) {
+		$py_ver = $1;
+		warn "py_ver set to '$py_ver'\n";
+	}
+
 	$reason = $_;
 	if ( /^\S+: (\S+): (?:Command )?not found$/ or /.*configure\[\d+\]: (\S+): not found$/
 			or m{which: no (\S+) in \(.*/bin.*\)}
@@ -251,18 +258,19 @@ while ( $_ = shift @lines ) {
 		or m{^ERROR: Cannot find .+: No module named (\S+)$}
 		or m{^ERROR: Failed to import the ".+" module: No module named (\S+)$}
 		or m{^distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
+		or                           m{^error: Could not find suitable distribution for Requirement.parse\('([^'>=]+).*'\)}
 		or m{^Couldn't find index page for '(\S+)'}
 		) {
 		my $mod = $1;
 		$mod =~ s#\.#/#g;
-		warn "Looking for python module $mod\n";
+		warn "Looking for Python$py_ver module $mod\n";
 		poldek_file(
-				"/usr/share/python2*/$mod/__init__.py*",
-				"/usr/share/python2*/$mod.py*",
-				"/usr/lib*/python2*/$mod/__init__.py*",
-				"/usr/lib*/python2*/$mod.py*",
-				"/usr/lib*/python2*/_$mod.so",
-				"/usr/lib*/python2*/$mod.so" );
+				"/usr/share/python$py_ver*/$mod/__init__.py*",
+				"/usr/share/python$py_ver*/$mod.py*",
+				"/usr/lib*/python$py_ver*/$mod/__init__.py*",
+				"/usr/lib*/python$py_ver*/$mod.py*",
+				"/usr/lib*/python$py_ver*/_$mod.so",
+				"/usr/lib*/python$py_ver*/$mod.so" );
 	}
 
 	if (
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/a77393a662ebf862807ff70ce6f1000603f47fc5



More information about the pld-cvs-commit mailing list