[beignet] 02/02: Switch to Python 3

Rebecca Palmer rnpalmer-guest at moszumanska.debian.org
Sun Apr 26 22:12:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

rnpalmer-guest pushed a commit to branch master
in repository beignet.

commit 7621b9bc04211a56bc1aee83be936932f51d640c
Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
Date:   Sun Apr 26 21:35:03 2015 +0100

    Switch to Python 3
---
 debian/changelog             |   1 +
 debian/control               |   2 +-
 debian/patches/python3.patch | 101 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |   1 +
 4 files changed, 104 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index f9455aa..421c186 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ beignet (1.0.3-1) UNRELEASED; urgency=medium
   * Fix bug in builtin_pow test.
   * Fix excessive rounding error in tgamma.
   * Update d/copyright.
+  * Build with Python 3.
 
  -- Rebecca N. Palmer <rebecca_palmer at zoho.com>  Fri, 24 Apr 2015 21:16:12 +0100
 
diff --git a/debian/control b/debian/control
index 8169acf..956830e 100644
--- a/debian/control
+++ b/debian/control
@@ -15,7 +15,7 @@ Build-Depends:
  ocl-icd-dev,
  ocl-icd-opencl-dev,
  pkg-config,
- python,
+ python3,
  libdrm-dev,
  libedit-dev,
  libtinfo-dev,
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..f280114
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,101 @@
+Description: Allow building with Python 3
+
+Author: Rebecca N. Palmer <rebecca_palmer at zoho.com>
+Forwarded: http://lists.freedesktop.org/archives/beignet/2015-April/005584.html
+
+--- beignet-1.0.3.orig/backend/src/libocl/script/gen_vector.py
++++ beignet-1.0.3/backend/src/libocl/script/gen_vector.py
+@@ -20,13 +20,14 @@
+ 
+ # This file is to generate inline code to lower down those builtin
+ # vector functions to scalar functions.
++from __future__ import print_function
+ import re
+ import sys
+ import os
+ 
+ if len(sys.argv) != 4:
+-    print "Invalid argument {0}".format(sys.argv)
+-    print "use {0} spec_file_name output_file_name just_proto".format(sys.argv[0])
++    print("Invalid argument {0}".format(sys.argv))
++    print("use {0} spec_file_name output_file_name just_proto".format(sys.argv[0]))
+     raise
+ 
+ all_vector = 1,2,3,4,8,16
+@@ -61,8 +62,8 @@ all_type = all_int_type + all_float_type
+ 
+ # all vector/scalar types
+ for t in all_type:
+-    exec "{0}n = [\"{0}n\", gen_vector_type([\"{0}\"])]".format(t)
+-    exec "s{0} = [\"{0}\", gen_vector_type([\"{0}\"], [1])]".format(t)
++    exec("{0}n = [\"{0}n\", gen_vector_type([\"{0}\"])]".format(t))
++    exec("s{0} = [\"{0}\", gen_vector_type([\"{0}\"], [1])]".format(t))
+ 
+ # Predefined type sets according to the Open CL spec.
+ math_gentype = ["math_gentype", gen_vector_type(all_float_type)]
+@@ -124,8 +125,8 @@ def check_type(types):
+     for t in types:
+         memspace, t = stripMemSpace(t)
+         if not t in type_dict:
+-            print t
+-            raise "found invalid type."
++            print(t)
++            raise TypeError("found invalid type.")
+ 
+ def match_unsigned(dtype):
+     if dtype[0] == 'float':
+@@ -187,8 +188,8 @@ def fixup_type(dstType, srcType, n):
+         if (len(dstType) == len(srcType)):
+             return dstType[n]
+ 
+-    print dstType, srcType
+-    raise "type mispatch"
++    print(dstType, srcType)
++    raise TypeError("type mispatch")
+ 
+ class builtinProto():
+     valueTypeStr = ""
+@@ -226,7 +227,7 @@ class builtinProto():
+ 
+     def init_from_line(self, t):
+         self.append('//{0}'.format(t))
+-        line = filter(None, re.split(',| |\(', t.rstrip(')\n')))
++        line = [_f for _f in re.split(',| |\(', t.rstrip(')\n')) if _f]
+         self.paramCount = 0
+         stripped = 0
+         memSpace = ''
+@@ -310,7 +311,7 @@ class builtinProto():
+                 vtype = fixup_type(vtypeSeq, ptypeSeqs[n], i)
+                 if vtype[1] != ptype[1]:
+                     if ptype[1] != 1:
+-                        raise "parameter is not a scalar but has different width with result value."
++                        raise TypeError("parameter is not a scalar but has different width with result value.")
+                     if isPointer(ptype):
+                         formatStr += '&'
+                     formatStr += 'param{0}'.format(n)
+@@ -333,7 +334,7 @@ class builtinProto():
+ 
+     def output(self):
+         for line in self.outputStr:
+-            print line
++            print(line)
+ 
+     def output(self, outFile):
+         for line in self.outputStr:
+--- beignet-1.0.3.orig/utests/utest_generator.py
++++ beignet-1.0.3/utests/utest_generator.py
+@@ -1,4 +1,5 @@
+ #!/usr/bin/python
++from __future__ import print_function
+ import os,sys,re
+ 
+ FLT_MAX_POSI='0x1.fffffep127f'
+@@ -327,7 +328,7 @@ which can print more values and informat
+     file_object.close()
+ 
+   def nameForCmake(self,content,namesuffix):
+-    print("generated/%s_%s.cpp"%(self.fileName,namesuffix)),
++    print("generated/%s_%s.cpp"%(self.fileName,namesuffix),end=" ")
+ 
+   def utestFunc(self,index):
+     funcLines=[]
diff --git a/debian/patches/series b/debian/patches/series
index 071a992..9614d5e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@ default-to-full-precision.patch
 shared-llvm.patch
 builtin_pow-fix-spurious-failure.patch
 tgamma-accuracy.patch
+python3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/beignet.git



More information about the Pkg-opencl-commits mailing list