Hello community,

here is the log from the commit of package coccigrep for openSUSE:Factory 
checked in at 2015-01-15 15:59:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/coccigrep (Old)
 and      /work/SRC/openSUSE:Factory/.coccigrep.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "coccigrep"

Changes:
--------
--- /work/SRC/openSUSE:Factory/coccigrep/coccigrep.changes      2014-09-22 
09:22:51.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.coccigrep.new/coccigrep.changes 2015-01-15 
15:59:27.000000000 +0100
@@ -1,0 +2,8 @@
+Thu Jan 15 07:59:06 UTC 2015 - [email protected]
+
+- update to 20150112
+  * python3 support added
+- clean up .spec
+  * switch to python3
+
+-------------------------------------------------------------------

Old:
----
  coccigrep-20140913.tar.xz

New:
----
  coccigrep-20150112.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ coccigrep.spec ++++++
--- /var/tmp/diff_new_pack.YkiVJf/_old  2015-01-15 15:59:28.000000000 +0100
+++ /var/tmp/diff_new_pack.YkiVJf/_new  2015-01-15 15:59:28.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package coccigrep
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           coccigrep
-Version:        20140913
+Version:        20150112
 Release:        0
 Summary:        Semantic grep tool for C, based on coccinelle
 License:        GPL-3.0
@@ -26,18 +26,14 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Source:         %{name}-%{version}.tar.xz
 
-BuildRequires:  python
-BuildRequires:  python-setuptools
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
 BuildRequires:  xz
 Requires:       coccinelle
-Requires:       python
-%if 0%{?suse_version}
-%py_requires
+Requires:       python3
 %if 0%{?suse_version} > 1110
 BuildArch:      noarch
 %endif
-%endif
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
 %description
 coccigrep is a semantic grep for the C language based on coccinelle. It can be
@@ -45,15 +41,15 @@
 the spatch program which comes with coccinelle.
 
 %prep
-%define py_sitedir %(%{__python} -c "from distutils.sysconfig  import 
get_python_lib; print get_python_lib()")
 %setup -q
+chmod 644 README.rst
 
 %build
-python setup.py $(PURE) build
+python3 setup.py build
 gzip -c coccigrep.1 > coccigrep.1.gz
 
 %install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
 
 install -d $RPM_BUILD_ROOT/%{_mandir}/man1/
 install -m 644 coccigrep.1.gz $RPM_BUILD_ROOT/%{_mandir}/man1/
@@ -64,7 +60,7 @@
 %files
 %defattr(-,root,root,-)
 %doc README.rst ChangeLog
-%{python_sitelib}/*
+%{python3_sitelib}/*
 %{_bindir}/coccigrep
 %{_mandir}/man1/coccigrep.1*
 

++++++ coccigrep-20140913.tar.xz -> coccigrep-20150112.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/coccigrep-20140913/coccigrep 
new/coccigrep-20150112/coccigrep
--- old/coccigrep-20140913/coccigrep    2014-09-15 14:01:39.000000000 +0200
+++ new/coccigrep-20150112/coccigrep    2015-01-14 17:55:37.000000000 +0100
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# Copyright (C) 2011,2012 Eric Leblond <[email protected]>
+# Copyright (C) 2011-2015 Eric Leblond <[email protected]>
 #
 # You can copy, redistribute or modify this Program under the terms of
 # the GNU General Public License version 3 as published by the Free
@@ -19,7 +19,10 @@
 import sys
 import os
 import bisect
-import ConfigParser
+try:
+    import configparser
+except:
+    import ConfigParser as configparser
 from coccigrep import COCCIGREP_VERSION
 from coccigrep import CocciGrep, CocciGrepConfig, CocciException
 from coccigrep import CocciException, CocciRunException, CocciConfigException
@@ -41,7 +44,7 @@
             sys.stderr.write('Warning: unable to open local cocci dir 
\"%s\"\n' % (local_cocci_dir))
         except:
             pass
-except ConfigParser.NoOptionError:
+except configparser.NoOptionError:
     pass
 operations = coccigrep.get_operations()
 
@@ -73,15 +76,15 @@
 try:
     spatch = cocciinst.get('global', 'spatch')
     coccigrep.set_spatch_cmd(spatch)
-except ConfigParser.NoOptionError:
+except configparser.NoOptionError:
     pass
 
 if args.listop:
     if args.verbose == False:
-        print ", ".join(operations)
+        print(", ".join(operations))
     else:
         for operation in operations:
-            print coccigrep.get_operation_info(operation)
+            print(coccigrep.get_operation_info(operation))
     sys.exit(0)
 
 if args.attribute != None and args.operation == 'used':
@@ -138,10 +141,10 @@
 try:
     coccigrep.setup(args.type, args.attribute, args.operation)
     coccigrep.run(files)
-except CocciRunException, err:
+except CocciRunException as err:
     sys.stderr.write("Runtime error: " + str(err) + "\n")
     sys.exit(1)
-except CocciConfigException, err:
+except CocciConfigException as err:
     sys.stderr.write("Config error: " + str(err) + "\n")
     sys.exit(1)
 
@@ -159,7 +162,7 @@
     output = coccigrep.display(mode='raw', before=args.before, 
after=args.after)
 
 if len(output) > 0:
-    print output
+    print(output)
 else:
     if args.verbose:
         sys.stderr.write("No match found in %s\n" % (",".join(args.file)))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/coccigrep-20140913/src/__init__.py 
new/coccigrep-20150112/src/__init__.py
--- old/coccigrep-20140913/src/__init__.py      2014-09-15 14:01:39.000000000 
+0200
+++ new/coccigrep-20150112/src/__init__.py      2015-01-14 17:55:37.000000000 
+0100
@@ -1,2 +1,2 @@
 
-from coccigrep import *
+from .coccigrep import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/coccigrep-20140913/src/coccigrep.py 
new/coccigrep-20150112/src/coccigrep.py
--- old/coccigrep-20140913/src/coccigrep.py     2014-09-15 14:01:39.000000000 
+0200
+++ new/coccigrep-20150112/src/coccigrep.py     2015-01-14 17:55:37.000000000 
+0100
@@ -1,4 +1,4 @@
-# Copyright (C) 2011,2012 Eric Leblond <[email protected]>
+# Copyright (C) 2011-2015 Eric Leblond <[email protected]>
 #
 # You can copy, redistribute or modify this Program under the terms of
 # the GNU General Public License version 3 as published by the Free
@@ -14,7 +14,10 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301, USA.
 
-from ConfigParser import SafeConfigParser
+try:
+    from configparser import SafeConfigParser
+except:
+    from ConfigParser import SafeConfigParser
 from os import unlink, path, listdir, getcwd
 from string import Template
 from subprocess import Popen, PIPE, STDOUT
@@ -22,8 +25,9 @@
 from tempfile import NamedTemporaryFile
 import errno
 import re
+import sys
 
-COCCIGREP_VERSION = "1.14"
+COCCIGREP_VERSION = "1.15"
 
 have_multiprocessing = True
 try:
@@ -199,7 +203,7 @@
             else:
                 output = Popen(self.cmd, stdout=PIPE,
                     stderr=PIPE).communicate()[0]
-        except Exception, err:
+        except Exception as err:
             import pickle
             output = pickle.dumps(err)
 
@@ -371,7 +375,7 @@
 
         :return: list of operations in a list of str
         """
-        return self.operations.keys()
+        return list(self.operations.keys())
 
     def get_operation_name(self, fname):
         return _operation_name(fname)
@@ -405,10 +409,10 @@
         cmd = [self.spatch] + [ '-version']
         try:
             output = Popen(cmd, stdout=PIPE, stderr=STDOUT).communicate()[0]
-        except OSError, err:
+        except OSError as err:
             _raise_run_err(err, cmd)
         reg = r"version (.*?) with"
-        m = re.search(reg, output)
+        m = re.search(reg, output.decode('utf8'))
         return m.group(1)
 
     def spatch_newer_than(self, version):
@@ -453,7 +457,10 @@
             attribute=self.attribute, cocci_regexp_equal=cocci_op)
         cocci_grep = cocci_smpl + CocciGrep.cocci_python
 
-        tmp_cocci_file.write(cocci_grep)
+        if sys.version < '3':
+            tmp_cocci_file.write(cocci_grep)
+        else:
+            tmp_cocci_file.write(bytes(cocci_grep, 'UTF-8'))
         tmp_cocci_file.flush()
 
         # launch spatch
@@ -500,7 +507,7 @@
                     output = Popen(cmd, stdout=PIPE).communicate()[0]
                 else:
                     output = Popen(cmd, stdout=PIPE, 
stderr=PIPE).communicate()[0]
-            except OSError, err:
+            except OSError as err:
                 unlink(tmp_cocci_file_name)
                 _raise_run_err(err, cmd)
 
@@ -509,7 +516,7 @@
         prevfile = None
         prevline = None
         self.matches = []
-        for ematch in output.split("\n"):
+        for ematch in output.decode('utf8').split("\n"):
             try:
                 (efile, eline, ecol, elinend, ecolend) = ematch.split(":")
                 nmatch = CocciMatch(efile, eline, ecol, elinend, ecolend)
@@ -538,7 +545,7 @@
         """
         if before != 0 or after != 0:
             prev_match = None
-            for index in xrange(len(self.matches)):
+            for index in range(len(self.matches)):
                 cur_match = self.matches[index]
                 cur_match.start_at = cur_match.line - before
                 cur_match.stop_at = cur_match.line + after

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to