Skip to content

Commit

Permalink
Future
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoseph committed Nov 22, 2014
1 parent 2c5684b commit b6d9acd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
27 changes: 5 additions & 22 deletions changes/compat.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
from subprocess import Popen, PIPE, CalledProcessError
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from future import standard_library


def check_output(*popenargs, **kwargs):
"""
Run command with arguments and return its output as a byte string.
Backported from Python 2.7 as it's implemented as pure python on stdlib.
>>> check_output(['/usr/bin/python', '--version'])
Python 2.6.2
"""
process = Popen(stdout=PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
error = CalledProcessError(retcode, cmd)
error.output = output
raise error
return output
standard_library.install_aliases()
2 changes: 0 additions & 2 deletions changes/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from plumbum import local

from changes.compat import check_output, CalledProcessError

log = logging.getLogger(__name__)


Expand Down
5 changes: 4 additions & 1 deletion changes/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from __future__ import (absolute_import, division,
print_function, unicode_literals)

import logging

import click
Expand Down Expand Up @@ -25,7 +28,7 @@ def get_new_version(module_name, current_version, no_input,
if no_input:
new_version = proposed_new_version
else:
new_version = raw_input(
new_version = input(
'What is the release version for "%s" '
'[Default: %s]: ' % (
module_name, proposed_new_version
Expand Down
1 change: 1 addition & 0 deletions requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PyYAML < 4.0.0
plumbum < 1.5.0
click < 4.0.0
future < 1.0.0
path.py < 5.0.0
semantic_version < 3.0.0
twine < 1.4.0
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_current_version():


def test_get_new_version():
with mock.patch('__builtin__.raw_input') as mock_raw_input:
with mock.patch('builtins.input') as mock_raw_input:
mock_raw_input.return_value = None
assert '0.1.0' == version.get_new_version(
module_name,
Expand Down

0 comments on commit b6d9acd

Please sign in to comment.