[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/pychecker/devel pychecker-0.8.14-backports.patch, NONE, 1.1 pychecker-0.8.14-python2.4.patch, NONE, 1.1 pychecker.spec, 1.14, 1.15 pychecker-0.8.14-None.patch, 1.1, NONE



Author: mitr

Update of /cvs/dist/rpms/pychecker/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv19956

Modified Files:
	pychecker.spec 
Added Files:
	pychecker-0.8.14-backports.patch 
	pychecker-0.8.14-python2.4.patch 
Removed Files:
	pychecker-0.8.14-None.patch 
Log Message:
* Tue Jun 28 2005 Miloslav Trmac <mitr redhat com> - 0.8.14-5
- Don't ship documentation in the python*/site-packages
- Rely on redhat-rpm-config for .py[co] generation
- Backport a fix for spurious warnings about divisions
- Disable warning about mismatch of implicit and explicit returns, it has too
  many false positives with Python 2.4
- Fix handling of functions with no known return value
- Fix handling of tuple literals


pychecker-0.8.14-backports.patch:
 pychecker-0.8.14/pychecker/CodeChecks.py |    2 +-
 pychecker/pychecker/CodeChecks.py        |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

--- NEW FILE pychecker-0.8.14-backports.patch ---
--- pychecker-0.8.14/pychecker/CodeChecks.py.None	2005-06-09 14:16:15.000000000 +0200
+++ pychecker-0.8.14/pychecker/CodeChecks.py	2005-06-09 14:17:09.000000000 +0200
@@ -1299,7 +1299,7 @@
         # FIXME: how should booleans should e handled, need to think about it
 ##        if second_arg.const or (second_arg.type == Stack.TYPE_GLOBAL and
 ##                                second_arg.data in ['True', 'False']):
-        if second_arg.const:
+        if second_arg.const and second_arg.data is not None:
             data = second_arg.data
             if second_arg.type is types.DictType:
                 data = {}
diff -ur pychecker-0.8.14/pychecker/CodeChecks.py /home/mitr/cvs/sourceforge/pychecker/pychecker/CodeChecks.py
--- pychecker-0.8.14/pychecker/CodeChecks.py	2005-06-28 11:31:15.000000000 +0200
+++ pychecker/pychecker/CodeChecks.py	2004-12-14 04:16:53.000000000 +0100
@@ -1472,9 +1487,11 @@
 def _checkModifyNoOp(code, op, msg=msgs.MODIFY_VAR_NOOP, modifyStack=1):
     stack = code.stack
     if len(stack) >= 2:
-        name = stack[-1].getName()
-        if name != Stack.TYPE_UNKNOWN and name == stack[-2].getName():
-            code.addWarning(msg % (name, op, name))
+        if (stack[-1].type != Stack.TYPE_UNKNOWN and
+            stack[-2].type != Stack.TYPE_UNKNOWN):
+            name = stack[-1].getName()
+            if name != Stack.TYPE_UNKNOWN and name == stack[-2].getName():
+                code.addWarning(msg % (name, op, name))
 
         if modifyStack:
             code.popStack()

pychecker-0.8.14-python2.4.patch:
 CodeChecks.py |    8 +++++++-
 warn.py       |   12 +++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

--- NEW FILE pychecker-0.8.14-python2.4.patch ---
diff -ur pychecker-0.8.14/pychecker/CodeChecks.py pychecker/pychecker/CodeChecks.py
--- pychecker-0.8.14/pychecker/CodeChecks.py	2005-06-28 11:31:15.000000000 +0200
+++ pychecker/pychecker/CodeChecks.py	2005-06-27 01:42:09.000000000 +0200
@@ -1052,8 +1052,14 @@
     # FIXME: handle deleting global multiple times
 _DELETE_GLOBAL = _DELETE_NAME
 
+def __make_const(value):
+    if type(value) == types.TupleType :
+        return Stack.makeTuple(map(__make_const, value))
+    else :
+        return Stack.Item(value, type(value), 1)
+
 def _LOAD_CONST(oparg, operand, codeSource, code) :
-    code.pushStack(Stack.Item(operand, type(operand), 1))
+    code.pushStack(__make_const(operand))
     if type(operand) == types.CodeType :
         name = operand.co_name
         obj = code.codeObjects.get(name, None)
diff -ur pychecker-0.8.14/pychecker/warn.py pychecker/pychecker/warn.py
--- pychecker-0.8.14/pychecker/warn.py	2003-11-18 04:49:00.000000000 +0100
+++ pychecker/pychecker/warn.py	2005-06-28 11:27:27.000000000 +0200
@@ -87,7 +87,10 @@
 
     # if the last return is implicit, check if there are non None returns
     lastReturn = code.returnValues[-1]
-    if not code.starts_and_ends_with_finally and \
+    # Python 2.4 optimizes the dead implicit return out, so we can't
+    # distinguish implicit and explicit "return None"
+    if utils.pythonVersion() < utils.PYTHON_2_4 and \
+       not code.starts_and_ends_with_finally and \
        cfg().checkImplicitReturns and lastReturn[1].isImplicitNone() :
         for line, retval, dummy in code.returnValues[:-1] :
             if not retval.isNone() :
@@ -179,14 +182,17 @@
             unreachable[i] = line
 
     # find the index of the last return
-    lastLine, lastItem, lastIndex = code.returnValues[-1]
+    lastLine, lastItem, lastIndex = None, None, None
+    if code.returnValues :
+        lastLine, lastItem, lastIndex = code.returnValues[-1]
     if len(code.returnValues) >= 2 :
         lastIndex = code.returnValues[-2][2]
     if code.raiseValues :
         lastIndex = max(lastIndex, code.raiseValues[-1][2])
 
     # remove last return if it's unreachable AND implicit
-    if unreachable.get(lastIndex) == lastLine and lastItem.isImplicitNone() :
+    if unreachable.get(lastIndex) == lastLine and lastItem \
+           and lastItem.isImplicitNone() :
         del code.returnValues[-1]
         del unreachable[lastIndex]
 


Index: pychecker.spec
===================================================================
RCS file: /cvs/dist/rpms/pychecker/devel/pychecker.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- pychecker.spec	9 Jun 2005 12:24:44 -0000	1.14
+++ pychecker.spec	3 Jul 2005 16:48:09 -0000	1.15
@@ -1,12 +1,11 @@
-%{expand: %%define pyver %(python -c 'import sys;print(sys.version[0:3])')}
-
 Summary:  A python source code checking tool.
 Name: pychecker
 Version: 0.8.14
-Release: 4
+Release: 5
 URL: http://pychecker.sourceforge.net
 Source0: http://prdownloads.sourceforge.net/pychecker/pychecker-%{version}.tar.gz
-Patch0: pychecker-0.8.14-None.patch
+Patch0: pychecker-0.8.14-backports.patch
+Patch1: pychecker-0.8.14-python2.4.patch
 License: BSDish
 Group: Development/Tools
 Requires: python
@@ -21,27 +20,42 @@
 
 %prep
 %setup -q
-%patch0 -p1 -b .None
+%patch0 -p1 -b .backports
+%patch1 -p1 -b .python2.4
 
 %build
 CFLAGS="$RPM_OPT_FLAGS" python setup.py build
 
 %install
 rm -rf $RPM_BUILD_ROOT
-python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
-python -O /usr/%{_lib}/python%pyver/compileall.py $RPM_BUILD_ROOT/usr/lib/python%pyver/site-packages
-find $RPM_BUILD_ROOT/usr/lib/python%pyver -name "*pyo" | sed "s|$RPM_BUILD_ROOT||" >> INSTALLED_FILES
-grep -v /usr/doc INSTALLED_FILES > installed_files
+python setup.py install --root=$RPM_BUILD_ROOT
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%files -f installed_files
+%files
 %defattr(-,root,root)
 %doc CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS README TODO VERSION
-%dir /usr/lib/python*/site-packages/pychecker
+%{_bindir}/pychecker
+/usr/lib/python*/site-packages/pychecker
+%exclude /usr/lib/python*/site-packages/pychecker/CHANGELOG
+%exclude /usr/lib/python*/site-packages/pychecker/COPYRIGHT
+%exclude /usr/lib/python*/site-packages/pychecker/KNOWN_BUGS
+%exclude /usr/lib/python*/site-packages/pychecker/MAINTAINERS
+%exclude /usr/lib/python*/site-packages/pychecker/README
+%exclude /usr/lib/python*/site-packages/pychecker/TODO
+%exclude /usr/lib/python*/site-packages/pychecker/VERSION
 
 %changelog
+* Tue Jun 28 2005 Miloslav Trmac <mitr redhat com> - 0.8.14-5
+- Don't ship documentation in the python*/site-packages
+- Rely on redhat-rpm-config for .py[co] generation
+- Backport a fix for spurious warnings about divisions
+- Disable warning about mismatch of implicit and explicit returns, it has too
+  many false positives with Python 2.4
+- Fix handling of functions with no known return value
+- Fix handling of tuple literals
+
 * Thu Jun  9 2005 Miloslav Trmac <mitr redhat com> - 0.8.14-4
 - Backport a fix for spurious warnings about "is{, not} None"
 


--- pychecker-0.8.14-None.patch DELETED ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]