From 4d859d3cbfc59b45e095122f32b7fe5cea574233 Mon Sep 17 00:00:00 2001
From: "B. Watson" <urchlay@slackware.uk>
Date: Sun, 14 May 2023 16:59:41 -0400
Subject: sbolint: suggest splitting combined python2+3 builds into separate
 ones.

---
 sbolint | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

(limited to 'sbolint')

diff --git a/sbolint b/sbolint
index fd761ae..9062969 100755
--- a/sbolint
+++ b/sbolint
@@ -1195,7 +1195,7 @@ sub check_script {
 	my $lineno = 0;
 	my ($prgnam, $version, $build, $tag, $need_doinst, $slackdesc, $makepkg, $install);
 	my ($cdpkg, $codestart, $lint_enabled, $print_pkg_name, $pkg_type, $arch_lineno);
-	my ($old_arch, $old_flags);
+	my ($old_arch, $old_flags, $have_py2, $have_py3);
 	$lint_enabled = 1;
 
 	for(@lines) {
@@ -1340,6 +1340,14 @@ sub check_script {
 		if(/^[^#]*\bpython\b/) {
 			log_note("$file:$lineno: suggest replacing 'python' with 'python2' for future-proofing");
 		}
+
+		if(/^[^#]*\bpython2?\b/) {
+			$have_py2 = $lineno;
+		}
+
+		if(/^[^#]*\bpython3?\b/) {
+			$have_py3 = $lineno;
+		}
 	}
 
 	if(not defined($prgnam)) {
@@ -1416,6 +1424,10 @@ sub check_script {
 	} elsif($old_flags) {
 		log_error("$file:$old_flags: archaic -march= compiler flag (we support i586 and up)");
 	}
+
+	if($have_py2 && $have_py3) {
+		log_note("$file: it looks like this build includes both python2 and python3 code. consider splitting it into separate python2- and python3- builds.");
+	}
 }
 
 sub findem {
-- 
cgit v1.2.3