Skip to content

Commit

Permalink
fixed system node using under python3.4; fixes #43
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed May 27, 2014
1 parent c34ff42 commit 46c0d20
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Nodeenv changelog
=================

Version 0.9.3
-------------
- Fixed npm when using prebuilt binaries on Mac OS X. See `# 68`_
- Fixed using ``system`` node under python3.4. See `# 43`_

.. _# 68: https://github.com/ekalinin/nodeenv/issues/68
.. _# 43: https://github.com/ekalinin/nodeenv/issues/43

Version 0.9.2
-------------
- Fixed infinite loop when system-wide node used. See `# 67`_
Expand Down
25 changes: 18 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,26 @@ test3:
python setup.py install && \
nodeenv -p

# https://github.com/ekalinin/nodeenv/issues/43
test4:
@echo " * test4: separate nodejs's env for python3.3"
@rm -rf env && \
virtualenv --no-site-packages --python=python3.3 env && \
. env/bin/activate && \
python3.3 setup.py install && \
python3.3 nodeenv -j 4 -p
@echo " * test4: separate nodejs's env for python3.4"
@rm -rf env && \
virtualenv --no-site-packages --python=python3.4 env && \
. env/bin/activate && \
python setup.py install && \
nodeenv 4 -p --prebuilt && \
nodeenv -p --node=system

tests: clean test1 clean test2 clean test3 clean
test5:
@echo " * test5: prebuilt nodejs's env for python2"
@rm -rf env && \
virtualenv --no-site-packages env && \
. env/bin/activate && \
python setup.py install && \
nodeenv 4 -p --prebuilt && \
nodeenv -p --node=system

tests: clean test1 clean test2 clean test3 clean test4 clean test5 clean

contributors:
@echo "Nodeenv is written and maintained by Eugene Kalinin." > AUTHORS
Expand Down
5 changes: 3 additions & 2 deletions nodeenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def node_version_from_opt(opt):
if opt.node == 'system':
out, err = subprocess.Popen(
["node", "--version"], stdout=subprocess.PIPE).communicate()
return parse_version(out.replace('\n', '').replace('v', ''))
return parse_version(
out.decode('utf-8').replace('\n', '').replace('v', ''))

return parse_version(opt.node)

Expand Down Expand Up @@ -525,7 +526,7 @@ def install_activate(env_dir, opt):
shim_node = join(bin_dir, "node")
if opt.node == "system":
_, which_node_output = callit(['which', 'node'])
shim_node = which_node_output[0]
shim_node = which_node_output[0].decode('utf-8')

for name, content in files.items():
file_path = join(bin_dir, name)
Expand Down

0 comments on commit 46c0d20

Please sign in to comment.