[arch-commits] Commit in python-cmd2/trunk (PKGBUILD issue55.patch)
Felix Yan
felixonmars at archlinux.org
Wed Mar 22 09:13:32 UTC 2017
Date: Wednesday, March 22, 2017 @ 09:13:31
Author: felixonmars
Revision: 218361
upgpkg: python-cmd2 0.7.0-1
Added:
python-cmd2/trunk/issue55.patch
Modified:
python-cmd2/trunk/PKGBUILD
---------------+
PKGBUILD | 35 +++++++------
issue55.patch | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 163 insertions(+), 16 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-03-22 09:05:16 UTC (rev 218360)
+++ PKGBUILD 2017-03-22 09:13:31 UTC (rev 218361)
@@ -4,49 +4,52 @@
pkgbase=python-cmd2
pkgname=(python-cmd2 python2-cmd2)
-pkgver=0.6.9
-pkgrel=2
+pkgver=0.7.0
+pkgrel=1
pkgdesc="Extra features for standard library's cmd module"
arch=('any')
url="https://github.com/python-cmd2/cmd2"
license=('MIT')
-makedepends=('git' 'python-setuptools' 'python2-setuptools' 'python-pyparsing' 'python2-pyparsing')
+makedepends=('python-setuptools' 'python2-setuptools' 'python-pyparsing' 'python2-pyparsing' 'git')
checkdepends=('python-pytest-runner' 'python2-pytest-runner' 'python-mock' 'python2-mock')
-source=("git+https://github.com/python-cmd2/cmd2.git#tag=$pkgver")
-md5sums=('SKIP')
+source=("$pkgbase-$pkgver.tar.gz::https://github.com/python-cmd2/cmd2/archive/$pkgver.tar.gz"
+ issue55.patch)
+sha512sums=('1c52d08379e8aa89c6503ac91b62d7278522eadd9d2040eead53c956ca77f6076712b31c0a724a9b675d2b7618750e833ef8fbcad579be4094c5da51581310cc'
+ 'e9f4d5d64cd7ec71daa38262a9e7364b325cda3518bb6ba8e547d351c39f98c0325ea09a17d8f1ef442ad1bd293405243abb3b2b8dc5b5fd2ad9441a51747f8a')
prepare() {
- cp -a cmd2{,-py2}
+ (cd cmd2-$pkgver; patch -p1 -i ../issue55.patch)
+ cp -a cmd2-$pkgver{,-py2}
}
build() {
- cd "$srcdir"/cmd2
+ cd "$srcdir"/cmd2-$pkgver
python setup.py build
- cd "$srcdir"/cmd2-py2
+ cd "$srcdir"/cmd2-$pkgver-py2
python2 setup.py build
}
check() {
- cd "$srcdir"/cmd2
- python setup.py ptr
+ cd "$srcdir"/cmd2-$pkgver
+ python setup.py pytest
- cd "$srcdir"/cmd2-py2
- python2 setup.py ptr
+ cd "$srcdir"/cmd2-$pkgver-py2
+ python2 setup.py pytest
}
package_python-cmd2() {
depends=('python-pyparsing')
- cd "$srcdir"/cmd2
- python setup.py install --root="$pkgdir/" --optimize=1
+ cd "$srcdir"/cmd2-$pkgver
+ python setup.py install --root="$pkgdir" --optimize=1
}
package_python2-cmd2() {
depends=('python2-pyparsing')
- cd "$srcdir"/cmd2-py2
- python2 setup.py install --root="$pkgdir/" --optimize=1
+ cd "$srcdir"/cmd2-$pkgver-py2
+ python2 setup.py install --root="$pkgdir" --optimize=1
}
# vim:set ts=2 sw=2 et:
Added: issue55.patch
===================================================================
--- issue55.patch (rev 0)
+++ issue55.patch 2017-03-22 09:13:31 UTC (rev 218361)
@@ -0,0 +1,144 @@
+From 3e69e10328370884fc1a55de6ba9bef7f7e01d73 Mon Sep 17 00:00:00 2001
+From: Todd Leonhardt <todd.leonhardt at gmail.com>
+Date: Fri, 24 Feb 2017 00:51:40 -0500
+Subject: [PATCH] Added a couple unit tests for self.inputParser.
+
+One passes and the other fails and demonstrates the overall problem with the failing unit test for input redirection on some systems where a "-" ends up in the path name.
+---
+ tests/test_parsing.py | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/tests/test_parsing.py b/tests/test_parsing.py
+index 7186a14..b6ae0a1 100644
+--- a/tests/test_parsing.py
++++ b/tests/test_parsing.py
+@@ -43,6 +43,12 @@ def parser():
+ c._init_parser()
+ return c.parser
+
++ at fixture
++def input_parser():
++ c = cmd2.Cmd()
++ c._init_parser()
++ return c.inputParser
++
+
+ def test_remaining_args():
+ assert cmd2.remaining_args('-f bar bar cow', ['bar', 'cow']) == 'bar cow'
+@@ -237,6 +243,22 @@ def test_parse_output_redirect(parser):
+ - command: {0}""".format(command, args, redirect, output)
+ assert parser.parseString('output into > afile.txt').dump() == expected
+
++def test_parse_input_redirect(input_parser):
++ input_from = "< afile.txt"
++ if new_pyparsing:
++ input_from = repr(input_from)
++ expected = """['', {0}]
++- inputFrom: {0}""".format(input_from)
++ assert input_parser.parseString('< afile.txt').dump() == expected
++
++def test_parse_input_redirect_with_dash_in_path(input_parser):
++ input_from = "< python-cmd2/afile.txt"
++ if new_pyparsing:
++ input_from = repr(input_from)
++ expected = """['', {0}]
++- inputFrom: {0}""".format(input_from)
++ assert input_parser.parseString('< python-cmd2/afile.txt').dump() == expected
++
+ def test_parse_pipe_and_redirect(parser):
+ command = "output"
+ args = "into"
+From b358e9f0bbe26874a21e65b8ddfa00da049559a0 Mon Sep 17 00:00:00 2001
+From: Todd Leonhardt <todd.leonhardt at gmail.com>
+Date: Fri, 24 Feb 2017 02:10:17 -0500
+Subject: [PATCH] Added "-" to the list of legal characters.
+
+This is a fix for Issue #55.
+
+Updated a couple unit tests accordingly and also added a couple new unit tests to make sure this logic is appropriately covered.
+---
+ cmd2.py | 2 +-
+ tests/test_parsing.py | 34 +++++++++++++++++++++++++++-------
+ 2 files changed, 28 insertions(+), 8 deletions(-)
+
+diff --git a/cmd2.py b/cmd2.py
+index 0ac73d9..057b639 100755
+--- a/cmd2.py
++++ b/cmd2.py
+@@ -515,7 +515,7 @@ class Cmd(cmd.Cmd):
+ excludeFromHistory = '''run r list l history hi ed edit li eof'''.split()
+ kept_state = None
+ # make sure your terminators are not in legalChars!
+- legalChars = u'!#$%.:?@_' + pyparsing.alphanums + pyparsing.alphas8bit
++ legalChars = u'!#$%.:?@_-' + pyparsing.alphanums + pyparsing.alphas8bit
+ multilineCommands = []
+ noSpecialParse = 'set ed edit exit'.split()
+ prefixParser = pyparsing.Empty()
+diff --git a/tests/test_parsing.py b/tests/test_parsing.py
+index b6ae0a1..b3b1543 100644
+--- a/tests/test_parsing.py
++++ b/tests/test_parsing.py
+@@ -185,16 +185,16 @@ def test_parse_simple_piped(parser):
+ - command: {0}""".format(command, pipe)
+ assert parser.parseString('simple | piped').dump() == expected
+
+-def test_parse_doulbe_pipe_is_not_a_pipe(parser):
+- command = "double"
+- args = "-pipe || is not a pipe"
++def test_parse_double_pipe_is_not_a_pipe(parser):
++ command = "double-pipe"
++ args = "|| is not a pipe"
+ if new_pyparsing:
+ command = repr(command)
+ args = repr(args)
+- expected = """['double', '-pipe || is not a pipe']
++ expected = """['double-pipe', '|| is not a pipe']
+ - args: {1}
+ - command: {0}
+-- statement: ['double', '-pipe || is not a pipe']
++- statement: ['double-pipe', '|| is not a pipe']
+ - args: {1}
+ - command: {0}""".format(command, args)
+ assert parser.parseString('double-pipe || is not a pipe').dump() == expected
+@@ -243,11 +243,31 @@ def test_parse_output_redirect(parser):
+ - command: {0}""".format(command, args, redirect, output)
+ assert parser.parseString('output into > afile.txt').dump() == expected
+
++def test_parse_output_redirect_with_dash_in_path(parser):
++ command = "output"
++ args = "into"
++ redirect = ">"
++ output = "python-cmd2/afile.txt"
++ if new_pyparsing:
++ command = repr(command)
++ args = repr(args)
++ redirect = repr(redirect)
++ output = repr(output)
++ expected = """['output', 'into', '>', 'python-cmd2/afile.txt']
++- args: {1}
++- command: {0}
++- output: {2}
++- outputTo: {3}
++- statement: ['output', 'into']
++ - args: {1}
++ - command: {0}""".format(command, args, redirect, output)
++ assert parser.parseString('output into > python-cmd2/afile.txt').dump() == expected
++
+ def test_parse_input_redirect(input_parser):
+ input_from = "< afile.txt"
+ if new_pyparsing:
+ input_from = repr(input_from)
+- expected = """['', {0}]
++ expected = """['', '< afile.txt']
+ - inputFrom: {0}""".format(input_from)
+ assert input_parser.parseString('< afile.txt').dump() == expected
+
+@@ -255,7 +275,7 @@ def test_parse_input_redirect_with_dash_in_path(input_parser):
+ input_from = "< python-cmd2/afile.txt"
+ if new_pyparsing:
+ input_from = repr(input_from)
+- expected = """['', {0}]
++ expected = """['', '< python-cmd2/afile.txt']
+ - inputFrom: {0}""".format(input_from)
+ assert input_parser.parseString('< python-cmd2/afile.txt').dump() == expected
+
More information about the arch-commits
mailing list