diff --git a/.files b/.files
index e6ede23..4a34a79 100644
Binary files a/.files and b/.files differ
diff --git a/.rev b/.rev
index ddac684..a4fe0f5 100644
--- a/.rev
+++ b/.rev
@@ -47,4 +47,12 @@
860296
+
+ 7c649ed04254e3324a571f5b0917f37d
+ 0.5.1
+
+ dimstar_suse
+
+ 1010359
+
diff --git a/bam.changes b/bam.changes
index 6fa04b5..3f2ec3d 100644
--- a/bam.changes
+++ b/bam.changes
@@ -1,4 +1,12 @@
-------------------------------------------------------------------
+Thu Oct 13 02:11:35 UTC 2022 - Steve Kowalik
+
+- Add patch support-python3.patch:
+ * Support Python 3.
+- Switch BuildRequires to python3.
+- Correct URL.
+
+-------------------------------------------------------------------
Mon Jan 4 14:59:25 UTC 2021 - Dominique Leuenberger
- Replace pandoc BuildRequires with help2man: this is sufficient to
diff --git a/bam.spec b/bam.spec
index b15fb90..d67daec 100644
--- a/bam.spec
+++ b/bam.spec
@@ -1,7 +1,7 @@
#
# spec file for package bam
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -21,14 +21,16 @@ Version: 0.5.1
Release: 0
Summary: Lua-based build system
License: Zlib
-URL: http://matricks.github.com/bam/
+URL: https://github.com/matricks/bam
Source: https://github.com/matricks/bam/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM bam-0.5.1-fix-compilation-order.patch -- https://github.com/matricks/bam/issues/116
Patch0: bam-0.5.1-fix-compilation-order.patch
+# PATCH-FIX-UPSTREAM https://github.com/matricks/bam/commit/b937572d157e660af98e224523ffb3fe5810ed2c
+Patch1: support-python3.patch
BuildRequires: gcc-c++
BuildRequires: help2man
BuildRequires: pkgconfig
-BuildRequires: python
+BuildRequires: python3
BuildRequires: pkgconfig(lua5.3)
%description
@@ -37,7 +39,7 @@ having a custom language, it uses Lua to describe the build steps.
%prep
%setup -q
-%patch0 -p1
+%autopatch -p1
%build
export CFLAGS="%{optflags}"
@@ -50,6 +52,7 @@ mkdir -p %{buildroot}%{_mandir}/man1
help2man --section=1 --name="fast and flexible build system" --version-string="VERSION_STRING" --no-info ./bam > %{buildroot}%{_mandir}/man1/bam.1
%check
+export PYTHON="/usr/bin/python3"
make %{?_smp_mflags} test
%files
diff --git a/support-python3.patch b/support-python3.patch
new file mode 100644
index 0000000..0e6f32a
--- /dev/null
+++ b/support-python3.patch
@@ -0,0 +1,288 @@
+From b937572d157e660af98e224523ffb3fe5810ed2c Mon Sep 17 00:00:00 2001
+From: Felix Geyer
+Date: Fri, 30 Aug 2019 19:08:35 +0200
+Subject: [PATCH] Port scripts to Python 3
+
+Compatibility with Python 2 is preserved.
+---
+ scripts/gendocs.py | 2 +-
+ scripts/test.py | 67 +++++++++++++++++++++++-----------------------
+ scripts/tinydoc.py | 23 ++++++++--------
+ 3 files changed, 47 insertions(+), 45 deletions(-)
+
+Index: bam-0.5.1/scripts/gendocs.py
+===================================================================
+--- bam-0.5.1.orig/scripts/gendocs.py
++++ bam-0.5.1/scripts/gendocs.py
+@@ -29,6 +29,6 @@ root.nodes += [ParseTextFile(Node("Licen
+
+ # render files
+ for o in outputs:
+- o.file = file(o.output_name(), "w")
++ o.file = open(o.output_name(), "w")
+ o.render(root)
+ o.file.close()
+Index: bam-0.5.1/scripts/test.py
+===================================================================
+--- bam-0.5.1.orig/scripts/test.py
++++ bam-0.5.1/scripts/test.py
+@@ -1,5 +1,6 @@
+ #!/usr/bin/env python
+
++from __future__ import print_function
+ import os, sys, shutil, subprocess
+
+ extra_bam_flags = ""
+@@ -36,8 +37,8 @@ def copytree(src, dst):
+ copytree(srcname, dstname)
+ else:
+ shutil.copy2(srcname, dstname)
+- except (IOError, os.error), why:
+- print "Can't copy %s to %s: %s" % (`srcname`, `dstname`, str(why))
++ except (IOError, os.error) as why:
++ print("Can't copy '%s' to '%s': %s" % (srcname, dstname, str(why)))
+
+
+ def run_bam(testname, flags):
+@@ -45,7 +46,7 @@ def run_bam(testname, flags):
+ olddir = os.getcwd()
+ os.chdir(output_path+"/"+testname)
+
+- p = subprocess.Popen(bam+" "+flags, stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT)
++ p = subprocess.Popen(bam+" "+flags, stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT, universal_newlines=True)
+ report = p.stdout.readlines()
+ p.wait()
+ ret = p.returncode
+@@ -64,8 +65,8 @@ def test(name, moreflags="", should_fail
+ os.chdir(output_path+"/"+name)
+ cmdline = bam+" -t -v "+extra_bam_flags+" " + moreflags
+
+- print name + ":",
+- p = subprocess.Popen(cmdline, stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT)
++ print(name + ":", end=" ")
++ p = subprocess.Popen(cmdline, stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT, universal_newlines=True)
+ report = p.stdout.readlines()
+ p.wait()
+ ret = p.returncode
+@@ -73,50 +74,50 @@ def test(name, moreflags="", should_fail
+ os.chdir(olddir)
+
+ if (should_fail and not ret) or (not should_fail and ret):
+- print " FAILED!"
++ print(" FAILED!")
+ for l in report:
+- print "\t", l,
++ print("\t", l, end=" ")
+ failed_tests += [name + "(returned %d)" % ret]
+ else:
+- print " ok"
++ print(" ok")
+
+ def difftest(name, flags1, flags2):
+ global failed_tests
+ if len(tests) and not name in tests:
+ return
+ testname = "difftest: %s '%s' vs '%s': "%(name, flags1, flags2)
+- print testname,
++ print(testname, end=" ")
+ ret1, report1 = run_bam(name, flags1)
+ ret2, report2 = run_bam(name, flags2)
+
+ if ret1:
+- print "FAILED! '%s' returned %d" %(flags1, ret1)
++ print("FAILED! '%s' returned %d" %(flags1, ret1))
+ failed_tests += [testname]
+ return
+
+ if ret2:
+- print "FAILED! '%s' returned %d" %(flags2, ret2)
++ print("FAILED! '%s' returned %d" %(flags2, ret2))
+ failed_tests += [testname]
+ return
+
+ if len(report1) != len(report2):
+- print "FAILED! %d lines vs %d lines" % (len(report1), len(report2))
++ print("FAILED! %d lines vs %d lines" % (len(report1), len(report2)))
+ failed_tests += [testname]
+ return
+
+ failed = 0
+- for i in xrange(0, len(report1)):
++ for i in range(0, len(report1)):
+ if report1[i] != report2[i]:
+ if not failed:
+- print "FAILED!"
+- print "1:", report1[i].strip()
+- print "2:", report2[i].strip()
++ print("FAILED!")
++ print("1:", report1[i].strip())
++ print("2:", report2[i].strip())
+ failed += 1
+
+ if failed:
+ failed_tests += [testname]
+ else:
+- print "ok"
++ print("ok")
+
+ def unittests():
+ global failed_tests
+@@ -129,7 +130,7 @@ def unittests():
+
+ tests = []
+ state = 0
+- for line in file('src/base.lua'):
++ for line in open('src/base.lua'):
+ if state == 0:
+ if "@UNITTESTS" in line:
+ state = 1
+@@ -157,16 +158,16 @@ def unittests():
+ os.chdir(output_path+"/unit")
+
+ for test in tests:
+- f = file("bam.lua", "w")
++ f = open("bam.lua", "w")
+ if test.catch != None:
+- print >>f, "print(\"CATCH:\", %s)"%(test.line)
++ print("print(\"CATCH:\", %s)"%(test.line), file=f)
+ else:
+- print >>f, test.line
+- print >>f, 'DefaultTarget(PseudoTarget("Test"))'
++ print(test.line, file=f)
++ print('DefaultTarget(PseudoTarget("Test"))', file=f)
+ f.close()
+
+- print "%s:"%(test.line),
+- p = subprocess.Popen(bam + " --dry", stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT)
++ print("%s:"%(test.line), end=" ")
++ p = subprocess.Popen(bam + " --dry", stdout=subprocess.PIPE, shell=True, stderr=subprocess.STDOUT, universal_newlines=True)
+ report = p.stdout.readlines()
+ p.wait()
+ ret = p.returncode
+@@ -174,7 +175,7 @@ def unittests():
+ failed = False
+ if ret != test.err:
+ failed = True
+- print "FAILED! error %d != %d" % (test.err, ret)
++ print("FAILED! error %d != %d" % (test.err, ret))
+
+ if test.catch != None:
+ found = False
+@@ -185,7 +186,7 @@ def unittests():
+ if catched == test.catch:
+ found = True
+ else:
+- print "FAILED! catch '%s' != '%s'" % (test.catch, catched)
++ print("FAILED! catch '%s' != '%s'" % (test.catch, catched))
+
+ if not found:
+ failed = True
+@@ -198,16 +199,16 @@ def unittests():
+
+ if not found:
+ failed = True
+- print "FAILED! could not find '%s' in output" % (test.find)
++ print("FAILED! could not find '%s' in output" % (test.find))
+ if failed or verbose:
+ if failed:
+ failed_tests += [test.line]
+ else:
+- print "",
++ print("", end=" ")
+ for l in report:
+- print "\t", l.rstrip()
++ print("\t", l.rstrip())
+ else:
+- print "ok"
++ print("ok")
+
+
+ os.chdir(olddir)
+@@ -245,11 +246,11 @@ test("import")
+ test("multipleoutput")
+
+ if len(failed_tests):
+- print "FAILED TESTS:"
++ print("FAILED TESTS:")
+ for t in failed_tests:
+- print "\t"+t
++ print("\t"+t)
+ sys.exit(1)
+ else:
+- print "ALL TESTS PASSED!"
++ print("ALL TESTS PASSED!")
+ sys.exit(0)
+
+Index: bam-0.5.1/scripts/tinydoc.py
+===================================================================
+--- bam-0.5.1.orig/scripts/tinydoc.py
++++ bam-0.5.1/scripts/tinydoc.py
+@@ -1,4 +1,5 @@
+
++from __future__ import print_function
+ import re, time
+
+ class Node:
+@@ -47,20 +48,20 @@ class Output:
+
+ def render_node_index(self, cur):
+ if len(cur.index):
+- print >>self.file, self.index_node_begin(cur)
++ print(self.index_node_begin(cur), file=self.file)
+ for node in cur.nodes:
+ self.render_node_index(node)
+ if len(cur.index):
+- print >>self.file, self.index_node_end(cur)
++ print(self.index_node_end(cur), file=self.file)
+ def render_node(self, cur):
+ if len(cur.index):
+- print >>self.file, self.format_header(cur)
+- print >>self.file, self.format_body(cur)
++ print(self.format_header(cur), file=self.file)
++ print(self.format_body(cur), file=self.file)
+ for node in cur.nodes:
+ self.render_node(node)
+
+ def index_nodes(self, cur, index=""):
+- for i in xrange(0, len(cur.nodes)):
++ for i in range(0, len(cur.nodes)):
+ if len(index):
+ cur.nodes[i].index = index + "." + str(i+1)
+ else:
+@@ -73,14 +74,14 @@ class Output:
+
+ def render(self, rootnode):
+ self.index_nodes(rootnode)
+- print >>self.file, self.render_begin()
++ print(self.render_begin(), file=self.file)
+
+- print >>self.file, self.index_begin()
++ print(self.index_begin(), file=self.file)
+ self.render_node_index(rootnode)
+- print >>self.file, self.index_end()
++ print(self.index_end(), file=self.file)
+
+ self.render_node(rootnode)
+- print >>self.file, self.render_end()
++ print(self.render_end(), file=self.file)
+
+ class HTMLOutput(Output):
+ def render_begin(self):
+@@ -225,7 +226,7 @@ class HTMLOutput(Output):
+
+ def ParseTextFile(rootnode, filename, addbr=False):
+ group = rootnode
+- for line in file(filename):
++ for line in open(filename):
+ if group_tag in line:
+ group_name = line.split(group_tag)[-1].split(end_tag)[0].strip()
+ group = Node(group_name)
+@@ -244,7 +245,7 @@ def ParseFile(rootnode, filename):
+ # 2 = outputting function decl
+ state = 0
+ group = rootnode
+- for line in file(filename):
++ for line in open(filename):
+ if state == 0:
+ if group_tag in line:
+ group_name = line.split(group_tag)[-1].split(end_tag)[0].strip()