summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml3
-rw-r--r--CHANGELOG.md4
-rw-r--r--CONTRIBUTING.md4
-rwxr-xr-xREADME.md4
-rwxr-xr-xcmd2.py40
-rw-r--r--docs/conf.py2
-rw-r--r--docs/index.rst2
-rw-r--r--docs/install.rst2
-rwxr-xr-xsetup.py5
-rw-r--r--tests/test_cmd2.py2
-rw-r--r--tests/test_transcript.py29
-rw-r--r--tox.ini12
13 files changed, 60 insertions, 50 deletions
diff --git a/.gitignore b/.gitignore
index 01895266..9da1d2cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ cmd2.egg-info
.cache
*.pyc
.coverage
+.tox
htmlcov
diff --git a/.travis.yml b/.travis.yml
index 3afcb263..97e1077a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,9 +8,6 @@ matrix:
python: 2.7
env: TOXENV=py27
- os: linux
- python: 3.3
- env: TOXENV=py33
- - os: linux
python: 3.4
env: TOXENV=py34
- os: linux
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7c40babb..afb13842 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,12 @@
-## 0.7.9 (TBD)
+## 0.7.9 (January 4, 2018)
* Bug Fixes
* Fixed a couple broken examples
* Enhancements
* Improved documentation for modifying shortcuts (command aliases)
* Made ``pyreadline`` a dependency on Windows to ensure tab-completion works
+* Other changes
+ * Abandoned official support for Python 3.3. It should still work, just don't have an easy way to test it anymore.
## 0.7.8 (November 8, 2017)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5eace248..b9c97fd0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -44,10 +44,10 @@ The tables below list all prerequisites along with the minimum required version
| Prerequisite | Minimum Version |
| --------------------------------------------------- | --------------- |
-| [Python](https://www.python.org/downloads/) | `3.3 or 2.7` |
+| [Python](https://www.python.org/downloads/) | `3.4 or 2.7` |
| [six](https://pypi.python.org/pypi/six) | `1.8` |
| [pyparsing](http://pyparsing.wikispaces.com) | `2.0.3` |
-| [pyperclip](https://github.com/asweigart/pyperclip) | `1.5` |
+| [pyperclip](https://github.com/asweigart/pyperclip) | `1.6` |
#### Additional prerequisites to run cmd2 unit tests
diff --git a/README.md b/README.md
index c3625a80..d2b16a91 100755
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Main Features
- Parsing commands with flags
- Unicode character support (*Python 3 only*)
- Good tab-completion of commands, file system paths, and shell commands
-- Python 2.7 and 3.3+ support
+- Python 2.7 and 3.4+ support
- Linux, macOS and Windows support
- Trivial to provide built-in help for all commands
- Built-in regression testing framework for your applications (transcript-based testing)
@@ -46,7 +46,7 @@ On all operating systems, the latest stable version of `cmd2` can be installed u
pip install -U cmd2
```
-cmd2 works with Python 2.7 and Python 3.3+ on Windows, macOS, and Linux. It is pure Python code with
+cmd2 works with Python 2.7 and Python 3.4+ on Windows, macOS, and Linux. It is pure Python code with
the only 3rd-party dependencies being on [six](https://pypi.python.org/pypi/six),
[pyparsing](http://pyparsing.wikispaces.com), and [pyperclip](https://github.com/asweigart/pyperclip)
(on Windows, [pyreadline](https://pypi.python.org/pypi/pyreadline) is an additional dependency).
diff --git a/cmd2.py b/cmd2.py
index 3f19c816..d62e8de6 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -53,16 +53,6 @@ except ImportError:
# noinspection PyUnresolvedReferences
from pyperclip import PyperclipException
-# On some systems, pyperclip will import gtk for its clipboard functionality.
-# The following code is a workaround for gtk interfering with printing from a background
-# thread while the CLI thread is blocking in raw_input() in Python 2 on Linux.
-try:
- # noinspection PyUnresolvedReferences
- import gtk
- gtk.set_interactive(0)
-except ImportError:
- pass
-
# next(it) gets next item of iterator it. This is a replacement for calling it.next() in Python 2 and next(it) in Py3
from six import next
@@ -105,7 +95,18 @@ if six.PY3:
else:
BROKEN_PIPE_ERROR = IOError
-__version__ = '0.7.9a'
+# On some systems, pyperclip will import gtk for its clipboard functionality.
+# The following code is a workaround for gtk interfering with printing from a background
+# thread while the CLI thread is blocking in raw_input() in Python 2 on Linux.
+if six.PY2 and sys.platform.startswith('lin'):
+ try:
+ # noinspection PyUnresolvedReferences
+ import gtk
+ gtk.set_interactive(0)
+ except ImportError:
+ pass
+
+__version__ = '0.7.9'
# Pyparsing enablePackrat() can greatly speed up parsing, but problems have been seen in Python 3 in the past
pyparsing.ParserElement.enablePackrat()
@@ -2424,7 +2425,22 @@ class Cmd2TestCase(unittest.TestCase):
self.assertTrue(re.match(expected, result, re.MULTILINE | re.DOTALL), message)
def _transform_transcript_expected(self, s):
- """parse the string with slashed regexes into a valid regex"""
+ """parse the string with slashed regexes into a valid regex
+
+ Given a string like:
+
+ Match a 10 digit phone number: /\d{3}-\d{3}-\d{4}/
+
+ Turn it into a valid regular expression which matches the literal text
+ of the string and the regular expression. We have to remove the slashes
+ because they differentiate between plain text and a regular expression.
+ Unless the slashes are escaped, in which case they are interpreted as
+ plain text, or there is only one slash, which is treated as plain text
+ also.
+
+ Check the tests in tests/test_transcript.py to see all the edge
+ cases.
+ """
regex = ''
start = 0
diff --git a/docs/conf.py b/docs/conf.py
index 1212a6e2..fd3e9476 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -62,7 +62,7 @@ author = 'Catherine Devlin and Todd Leonhardt'
# The short X.Y version.
version = '0.7'
# The full version, including alpha/beta/rc tags.
-release = '0.7.8'
+release = '0.7.9'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/docs/index.rst b/docs/index.rst
index 8e8817b2..2ef787e1 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -73,7 +73,7 @@ Contents:
Compatibility
=============
-Tested and working with Python 2.7 and 3.3+.
+Tested and working with Python 2.7 and 3.4+.
Indices and tables
==================
diff --git a/docs/install.rst b/docs/install.rst
index 9e330c3c..19cbdd78 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -7,7 +7,7 @@ This section covers the basics of how to install, upgrade, and uninstall ``cmd2`
Installing
----------
-First you need to make sure you have Python 2.7 or Python 3.3+, pip_, and setuptools_. Then you can just use pip to
+First you need to make sure you have Python 2.7 or Python 3.4+, pip_, and setuptools_. Then you can just use pip to
install from PyPI_.
.. _pip: https://pypi.python.org/pypi/pip
diff --git a/setup.py b/setup.py
index efe715be..ca4200fc 100755
--- a/setup.py
+++ b/setup.py
@@ -6,7 +6,7 @@ Setuptools setup file, used to install or test 'cmd2'
import sys
from setuptools import setup
-VERSION = '0.7.9a'
+VERSION = '0.7.9'
DESCRIPTION = "cmd2 - a tool for building interactive command line applications in Python"
LONG_DESCRIPTION = """cmd2 is a tool for building interactive command line applications in Python. Its goal is to make
it quick and easy for developers to build feature-rich and user-friendly interactive command line applications. It
@@ -32,7 +32,7 @@ Main features:
- Parsing commands with flags
- Unicode character support (*Python 3 only*)
- Good tab-completion of commands, file system paths, and shell commands
- - Python 2.7 and 3.3+ support
+ - Python 2.7 and 3.4+ support
- Linux, macOS and Windows support
- Trivial to provide built-in help for all commands
- Built-in regression testing framework for your applications (transcript-based testing)
@@ -52,7 +52,6 @@ Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
-Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index c877e60f..25889580 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -24,7 +24,7 @@ from conftest import run_cmd, normalize, BASE_HELP, HELP_HISTORY, SHORTCUTS_TXT,
def test_ver():
- assert cmd2.__version__ == '0.7.9a'
+ assert cmd2.__version__ == '0.7.9'
def test_empty_statement(base_app):
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 5092a2cd..e572e919 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -7,6 +7,7 @@ Released under MIT license, see LICENSE file
"""
import os
import sys
+import re
import random
import mock
@@ -309,21 +310,25 @@ def test_transcript(request, capsys, filename, feedback_to_output):
@pytest.mark.parametrize('expected, transformed', [
- ( 'text with no slashes', 'text\ with\ no\ slashes' ),
- # stuff with just one slash
- ( 'use 2/3 cup', 'use\ 2\/3\ cup' ),
- ( '/tmp is nice', '\/tmp\ is\ nice'),
- ( 'slash at end/', 'slash\ at\ end\/'),
+ # strings with zero or one slash or with escaped slashes means no regular
+ # expression present, so the result should just be what re.escape returns.
+ # we don't use static strings in these tests because re.escape behaves
+ # differently in python 3.7 than in prior versions
+ ( 'text with no slashes', re.escape('text with no slashes') ),
+ ( 'specials .*', re.escape('specials .*') ),
+ ( 'use 2/3 cup', re.escape('use 2/3 cup') ),
+ ( '/tmp is nice', re.escape('/tmp is nice') ),
+ ( 'slash at end/', re.escape('slash at end/') ),
+ # escaped slashes
+ ( 'not this slash\/ or this one\/', re.escape('not this slash/ or this one/' ) ),
# regexes
- ( 'specials .*', 'specials\ \.\*' ),
( '/.*/', '.*' ),
- ( 'specials ^ and + /[0-9]+/', 'specials\ \^\ and\ \+\ [0-9]+' ),
- ( '/a{6}/ but not \/a{6} with /.*?/ more', 'a{6}\ but\ not\ \/a\{6\}\ with\ .*?\ more' ),
- ( 'not this slash\/ or this one\/', 'not\ this\ slash\\/\ or\ this\ one\\/' ),
- ( 'not \/, use /\|?/, not \/', 'not\ \\/\,\ use\ \|?\,\ not\ \\/' ),
+ ( 'specials ^ and + /[0-9]+/', re.escape('specials ^ and + ') + '[0-9]+' ),
+ ( '/a{6}/ but not \/a{6} with /.*?/ more', 'a{6}' + re.escape(' but not /a{6} with ') + '.*?' + re.escape(' more') ),
+ ( 'not \/, use /\|?/, not \/', re.escape('not /, use ') + '\|?' + re.escape(', not /') ),
# inception: slashes in our regex. backslashed on input, bare on output
- ( 'not \/, use /\/?/, not \/', 'not\ \\/\,\ use\ /?\,\ not\ \\/' ),
- ( 'the /\/?/ more /.*/ stuff', 'the\ /?\ more\ .*\ stuff' ),
+ ( 'not \/, use /\/?/, not \/', re.escape('not /, use ') + '/?' + re.escape(', not /') ),
+ ( 'lots /\/?/ more /.*/ stuff', re.escape('lots ') + '/?' + re.escape(' more ') + '.*' + re.escape(' stuff') ),
])
def test_parse_transcript_expected(expected, transformed):
app = CmdLineApp()
diff --git a/tox.ini b/tox.ini
index cefc7f7b..366e4bc3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27,py33,py34,py35,py36,py36-winpy37,pypy
+envlist = py27,py34,py35,py36,py36-win,py37
[pytest]
testpaths = tests
@@ -40,16 +40,6 @@ commands =
py.test {posargs: -n 2} --cov=cmd2 --cov-report=term-missing
codecov
-[testenv:py33]
-deps =
- mock
- pyparsing
- pyperclip
- pytest
- pytest-xdist
- six
-commands = py.test -v -n2
-
[testenv:py34]
deps =
mock