From 32c82cb3a1ac443d906ecea8e54e5bcb5711198e Mon Sep 17 00:00:00 2001 From: Miloš Jakubíček Date: May 01 2010 12:02:41 +0000 Subject: - 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). --- diff --git a/antlr-python-3.1.2-version.patch b/antlr-python-3.1.2-version.patch new file mode 100644 index 0000000..ee9800c --- /dev/null +++ b/antlr-python-3.1.2-version.patch @@ -0,0 +1,37 @@ +--- 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): diff --git a/antlr3.spec b/antlr3.spec index 66b4759..2f2ce10 100644 --- a/antlr3.spec +++ b/antlr3.spec @@ -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/pub/mirrors/maven2/org/antlr/antlr3-maven- %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-generated parsers %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 - 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 - 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