Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3 compatibility and some general improvements #93

Merged
merged 1 commit into from
Jul 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions nodeenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def callit(cmd, show_stdout=True, in_shell=False,
line = stdout.readline()
if not line:
break
line = line.rstrip()
line = line.decode('utf-8').rstrip()
all_output.append(line)
if show_stdout:
logger.info(line)
Expand Down Expand Up @@ -496,8 +496,10 @@ def build_node_from_src(env_dir, src_dir, node_src_dir, opt):
# therefore we need to temporarily point python exec to the
# python 2.* version in this case.
try:
_, which_python2_output = callit(['which', 'python2'])
python2_path = which_python2_output[0].decode('utf-8')
_, which_python2_output = callit(
['which', 'python2'], opt.verbose, True, node_src_dir, env
)
python2_path = which_python2_output[0]
except (OSError, IndexError):
raise OSError(
'Python >=3.0 virtualenv detected, but no python2 '
Expand Down Expand Up @@ -536,7 +538,7 @@ def install_node(env_dir, src_dir, opt):
Download source code for node.js, unpack it
and install it in virtual environment.
"""
logger.info(' * Install node.js (%s' % opt.node,
logger.info(' * Install node.js (%s)' % opt.node,
extra=dict(continued=True))

node_url = get_node_src_url(opt.node, get_node_src_url_postfix(opt))
Expand Down Expand Up @@ -699,7 +701,7 @@ def print_node_versions():
if not row:
logger.info('\t'.join(rowx))
break
rowx.append(row.replace('\n', ''))
rowx.append(row.decode('utf-8').replace('\n', ''))
if pos % 8 == 0:
logger.info('\t'.join(rowx))
rowx = []
Expand Down