rpms/antlr3/devel antlr-python-3.1.2-version.patch, NONE, 1.1 antlr3.spec, 1.14, 1.15

Miloš Jakubíček mjakubicek at fedoraproject.org
Sat May 1 12:02:42 UTC 2010


Author: mjakubicek

Update of /cvs/pkgs/rpms/antlr3/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv13538

Modified Files:
	antlr3.spec 
Added Files:
	antlr-python-3.1.2-version.patch 
Log Message:
- Patch the Python runtime to print just a warning in case of version mismatch
  instead of raising an exception (since there is a good change it will work).



antlr-python-3.1.2-version.patch:
 recognizers.py |   24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

--- NEW FILE antlr-python-3.1.2-version.patch ---
--- antlr_python_runtime-3.1.2/antlr3/recognizers.py.orig	2010-05-01 13:30:01.000000000 +0200
+++ antlr_python_runtime-3.1.2/antlr3/recognizers.py	2010-05-01 13:36:00.000000000 +0200
@@ -164,24 +164,20 @@
         self._state = state
 
         if self.antlr_version > runtime_version:
-            raise RuntimeError(
-                "ANTLR version mismatch: "
-                "The recognizer has been generated by V%s, but this runtime "
-                "is V%s. Please use the V%s runtime or higher."
-                % (self.antlr_version_str,
-                   runtime_version_str,
-                   self.antlr_version_str))
+            print >> sys.stderr, """ 
+            WARNING: ANTLR version mismatch: 
+            The recognizer has been generated by V%s, but this runtime 
+            is V%s, this may not work correctly. Please use the V%s runtime or higher.""" % (
+            self.antlr_version_str, runtime_version_str, self.antlr_version_str)
         elif (self.antlr_version < (3, 1, 0, 0) and
               self.antlr_version != runtime_version):
             # FIXME: make the runtime compatible with 3.0.1 codegen
             # and remove this block.
-            raise RuntimeError(
-                "ANTLR version mismatch: "
-                "The recognizer has been generated by V%s, but this runtime "
-                "is V%s. Please use the V%s runtime."
-                % (self.antlr_version_str,
-                   runtime_version_str,
-                   self.antlr_version_str))
+            print >> sys.stderr, """
+            WARNING ANTLR version mismatch: 
+            The recognizer has been generated by V%s, but this runtime 
+            is V%s, this may not work correctly. Please use the V%s runtime.""" % (
+            self.antlr_version_str, runtime_version_str, self.antlr_version_str)
 
     # this one only exists to shut up pylint :(
     def setInput(self, input):


Index: antlr3.spec
===================================================================
RCS file: /cvs/pkgs/rpms/antlr3/devel/antlr3.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -r1.14 -r1.15
--- antlr3.spec	29 Apr 2010 15:12:26 -0000	1.14
+++ antlr3.spec	1 May 2010 12:02:41 -0000	1.15
@@ -9,7 +9,7 @@
 Summary:			ANother Tool for Language Recognition
 Name:				antlr3
 Version:			%{antlr_version}
-Release:			5%{?dist}
+Release:			6%{?dist}
 URL:				http://www.antlr.org/
 Source0:			http://www.antlr.org/download/antlr-%{antlr_version}.tar.gz
 Source1:			http://www.antlr.org/download/C/libantlr3c-%{antlr_version}.tar.gz
@@ -23,6 +23,8 @@ Source8:			http://mirrors.ibiblio.org/pu
 %endif
 # No buildnumber and findbugs:
 Patch0:				antlr-pom.patch
+# Python version mismatch patch, to be possibly upstreamed:
+Patch1:				antlr-python-3.1.2-version.patch
 License:			BSD
 Group:				Development/Libraries
 BuildRoot:			%{_tmppath}/%{name}-%{antlr_version}-%{release}-root-%(%{__id_u} -n)
@@ -146,6 +148,7 @@ Python run-time support for ANTLR-genera
 %prep
 %setup -q -n antlr-%{antlr_version} -a 1 -a 2 -a 3 
 %patch0 -b .orig
+%patch1 -b .orig
 %if %{with_bootstrap}
 cp %{SOURCE6} settings.xml 
 %endif
@@ -321,6 +324,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mavenpomdir}/JPP-maven-gunit-plugin.pom
 
 %changelog
+* Sat May 01 2010 Miloš Jakubíček <xjakub at fi.muni.cz> - 3.2-6
+- Patch the Python runtime to print just a warning in case of version mismatch
+  instead of raising an exception (since there is a good change it will work).
+
 * Thu Apr 22 2010 Miloš Jakubíček <xjakub at fi.muni.cz> - 3.2-5
 - Build the C runtime with --enable-64bit on x86_64 to avoid undeterministic
   segfaults caused by possible invalid conversion of 64bit pointers to int32_t 



More information about the scm-commits mailing list