[pylint] - Add upstream patch for epylint input validation (#981859)

Brian C. Lane bcl at fedoraproject.org
Tue Sep 3 17:24:07 UTC 2013


commit 501af29f449a2d1c4462cb3e4c6a853983fcabe5
Author: Brian C. Lane <bcl at redhat.com>
Date:   Tue Sep 3 10:23:50 2013 -0700

    - Add upstream patch for epylint input validation (#981859)

 0001-Add-upstream-patch-for-epylint-981859.patch |   96 ++++++++++++++++++++++
 pylint.spec                                      |    8 ++-
 2 files changed, 103 insertions(+), 1 deletions(-)
---
diff --git a/0001-Add-upstream-patch-for-epylint-981859.patch b/0001-Add-upstream-patch-for-epylint-981859.patch
new file mode 100644
index 0000000..33e51a7
--- /dev/null
+++ b/0001-Add-upstream-patch-for-epylint-981859.patch
@@ -0,0 +1,96 @@
+From 1856c9b7154233a4ed5a5cd5fc4988dba5127f01 Mon Sep 17 00:00:00 2001
+From: "Brian C. Lane" <bcl at redhat.com>
+Date: Tue, 3 Sep 2013 10:09:36 -0700
+Subject: [PATCH] Add upstream patch for epylint (#981859)
+
+---
+ ChangeLog  |  3 +++
+ epylint.py | 25 ++++++++++++++++++-------
+ 2 files changed, 21 insertions(+), 7 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index dd03e52..1bba31c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,5 +1,8 @@
+ ChangeLog for Pylint
+ ====================
++    * epylint support options to give to pylint after the file to analyze and
++      have basic input validation (bitbucket #53 and #54), patches provided by
++      felipeochoa and Brian Lane
+ 
+ --
+     * Add check for the use of 'exec' function
+diff --git a/epylint.py b/epylint.py
+index fbdfdac..76d7b68 100755
+--- a/epylint.py
++++ b/epylint.py
+@@ -29,7 +29,8 @@ For example:
+         a/b/x.py
+         a/c/y.py
+ 
+-   - Then if y.py imports x as "from a.b import x" the following produces pylint errors
++   - Then if y.py imports x as "from a.b import x" the following produces pylint
++     errors
+ 
+        cd a/c; pylint y.py
+ 
+@@ -41,14 +42,15 @@ For example:
+      we are checking we need to go out of it to avoid these false positives.
+ 
+ 
+-You may also use py_run to run pylint with desired options and get back (or not) its output.
++You may also use py_run to run pylint with desired options and get back (or not)
++its output.
+ """
+ 
+ import sys, os, re
+ from subprocess import Popen, PIPE
+ 
+ 
+-def lint(filename):
++def lint(filename, options=None):
+     """Pylint the given file.
+ 
+     When run from emacs we will be in the directory of a file, and passed its filename.
+@@ -74,8 +76,9 @@ def lint(filename):
+     # Start pylint
+     # Ensure we use the python and pylint associated with the running epylint
+     lintPath = os.path.join(os.path.dirname(__file__), 'lint.py')
+-    cmd = [sys.executable, lintPath, '--msg-template', '{path}:{line}: [{symbol}, {obj}] {msg}', '-r', 'n',
+-           '--disable=C,R,I', childPath]
++    options = options or ['--disable=C,R,I']
++    cmd = [sys.executable, lintPath] + options + ['--msg-template',
++            '{path}:{line}: [{symbol}, {obj}] {msg}', '-r', 'n', childPath]
+     process = Popen(cmd, stdout=PIPE, cwd=parentPath, universal_newlines=True)
+ 
+     # The parseable line format is '%(path)s:%(line)s: [%(sigle)s%(obj)s] %(msg)s'
+@@ -108,7 +111,7 @@ def lint(filename):
+ 
+ def py_run(command_options='', return_std=False, stdout=None, stderr=None,
+            script='epylint'):
+-    """Run pylint from python (needs Python >= 2.4).
++    """Run pylint from python
+ 
+     ``command_options`` is a string containing ``pylint`` command line options;
+     ``return_std`` (boolean) indicates return of created standart output
+@@ -158,7 +161,15 @@ def py_run(command_options='', return_std=False, stdout=None, stderr=None,
+ 
+ 
+ def Run():
+-    sys.exit(lint(sys.argv[1]))
++    if len(sys.argv) == 1:
++        print "Usage: %s <filename> [options]" % sys.argv[0]
++        sys.exit(1)
++    elif not os.path.exists(sys.argv[1]):
++        print "%s does not exist" % sys.argv[1] 
++        sys.exit(1)
++    else:
++        sys.exit(lint(sys.argv[1]))
++
+ 
+ if __name__ == '__main__':
+     Run()
+-- 
+1.8.3.1
+
diff --git a/pylint.spec b/pylint.spec
index 14a78a9..4350ca0 100644
--- a/pylint.spec
+++ b/pylint.spec
@@ -10,7 +10,7 @@
 
 Name:           pylint
 Version:        1.0.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Analyzes Python code looking for bugs and signs of poor quality
 Group:          Development/Debuggers
 License:        GPLv2+
@@ -18,6 +18,8 @@ URL:            http://www.pylint.org/
 Source0:        https://bitbucket.org/logilab/pylint/get/pylint-version-%{version}.tar.bz2
 BuildArch:      noarch
 
+Patch0:         0001-Add-upstream-patch-for-epylint-981859.patch
+
 BuildRequires:  python-devel python-setuptools
 BuildRequires:  python-astroid >= 1.0.0
 Requires:       python-astroid >= 1.0.0
@@ -78,6 +80,7 @@ This package provides a gui tool for pylint written in tkinter.
 
 %prep
 %setup -q -n logilab-pylint-%{commit}
+%patch0 -p1
 
 %if 0%{?with_python3}
 rm -rf %{py3dir}
@@ -160,6 +163,9 @@ popd
 %endif # with_python3
 
 %changelog
+* Tue Sep 03 2013 Brian C. Lane <bcl at redhat.com> 1.0.0-2
+- Add upstream patch for epylint input validation (#981859)
+
 * Tue Aug 13 2013 Brian C. Lane <bcl at redhat.com> 1.0.0-1
 - Upstream 1.0.0
 


More information about the scm-commits mailing list