diff --git a/.travis.yml b/.travis.yml index ab6593a..e3698e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,20 @@ sudo: false -matrix: - include: - - os: osx - osx_image: xcode8.1 - # See also: https://github.com/Homebrew/homebrew-core/issues/6949 - - os: linux - language: python - python: pypy-5.3.1 - - os: linux - language: python - python: 2.7 - - os: linux - language: python - python: 3.3 - - os: linux - language: python - python: 3.4 - - os: linux - language: python - python: 3.5 - - os: linux - language: python - python: 3.6 +dist: xenial +os: +- linux +- osx +osx_image: +- xcode10.2 +language: python +python: +- '3.7' +- '3.6' +- '3.5' +- '3.4' +- '2.7' +- 'pypy3.5-6.0' +- 'pypy2.7-6.0' install: | - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then - pip install --upgrade pip setuptools tox-travis; - elif [[ "$TRAVIS_OS_NAME" = "osx" ]]; then - brew tap drolando/homebrew-deadsnakes; - brew install python33 python34 python35 python3 pypy - pip install --upgrade pip setuptools - pip install --user tox; - fi + pip install --upgrade pip setuptools tox-travis script: tox diff --git a/geofrontcli/cli.py b/geofrontcli/cli.py index 9bb6db9..3962a5a 100644 --- a/geofrontcli/cli.py +++ b/geofrontcli/cli.py @@ -456,6 +456,13 @@ def prepend_lines(c, text): def main(args=None): + try: + _run(args) + except KeyboardInterrupt: + parser.exit() + + +def _run(args=None): args = parser.parse_args(args) log_handler = logging.StreamHandler(sys.stdout) log_handler.addFilter(UserWaitingFilter()) diff --git a/geofrontcli/client.py b/geofrontcli/client.py index 95af5d2..5f1a268 100644 --- a/geofrontcli/client.py +++ b/geofrontcli/client.py @@ -19,7 +19,7 @@ from .key import PublicKey from .ssl import create_urllib_https_handler -from .version import MIN_PROTOCOL_VERSION, MAX_PROTOCOL_VERSION, VERSION +from .version import MAX_PROTOCOL_VERSION, MIN_PROTOCOL_VERSION, VERSION __all__ = ('REMOTE_PATTERN', 'BufferedResponse', 'Client', 'ExpiredTokenIdError', @@ -197,7 +197,11 @@ def remotes(self): extra={'user_waiting': False}) return dict((alias, fmt(remote)) for alias, remote in result.items()) - except: + except KeyboardInterrupt: + logger.info('Request is aborted.', + extra={'user_waiting': False}) + raise + except Exception: logger.info('Failed to fetch the list of remotes.', extra={'user_waiting': False}) raise @@ -227,7 +231,11 @@ def authorize(self, alias): logger.info('Authentication is required.', extra={'user_waiting': False}) raise - except: + except KeyboardInterrupt: + logger.info('Authorization is aborted.', + extra={'user_waiting': False}) + raise + except Exception: logger.info('Authorization to %s has failed.', alias, extra={'user_waiting': False}) raise diff --git a/setup.py b/setup.py index 30c3e37..73dc764 100644 --- a/setup.py +++ b/setup.py @@ -28,17 +28,10 @@ def readme(): 'six', } -below_py34_requires = { - 'enum34', -} - win32_requires = { 'pypiwin32', } -if sys.version_info < (3, 4): - install_requires.update(below_py34_requires) - if sys.platform == 'win32': install_requires.update(win32_requires) @@ -62,7 +55,6 @@ def readme(): ''', install_requires=list(install_requires), extras_require={ - ":python_version<'3.4'": list(below_py34_requires), ":sys_platform=='win32'": list(win32_requires), }, classifiers=[ @@ -75,10 +67,10 @@ def readme(): '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', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: System :: Systems Administration :: Authentication/Directory', # noqa: E501 @@ -90,7 +82,7 @@ def readme(): if 'bdist_wheel' in sys.argv and ( below_py34_requires.issubset(install_requires) or win32_requires.issubset(install_requires)): - warnings.warn('Building wheels on Windows or using below Python 3.4 is ' - 'not recommended since platform-specific dependencies can ' - 'be merged into common dependencies:\n' + + warnings.warn('Building wheels on Windows is not recommended since ' + 'platform-specific dependencies can be merged into common ' + 'dependencies:\n' + '\n'.join('- ' + i for i in install_requires)) diff --git a/tox.ini b/tox.ini index 13df4b0..73330fe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,17 +1,16 @@ [tox] -envlist = pypy, py27, py33, py34, py35, py36 +envlist = pypy, py27, py34, py35, py36, py37 minversion = 1.6.0 [testenv] deps = - flake8 >= 3.3.0 - flake8-import-order-spoqa - pytest >= 3.0.7, < 3.1.0 - pytest-flake8 >= 0.8.1, < 0.9.0 - testtools + flake8 >= 3.5.0, < 3.8.0 + flake8-import-order-spoqa >= 1.5.0, < 2.0.0 + pytest >= 3.5.0, < 4.0.0 + pytest-flake8 >= 1.0.4, < 1.1.0 + testtools >= 2.3.0, < 3.0.0 # testtools is required by dirspec commands = - flake8 geofrontcli py.test {posargs:--durations=5} [pytest]