Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function test_venv() {
  4. cmd=$1
  5. venv_dir=$(mktemp -d)
  6. tmp_dir=$(mktemp -d)
  7.  
  8.  
  9. if ! $cmd ${venv_dir} > /dev/null 2>&1; then
  10. return
  11. fi
  12.  
  13. ln -s ${venv_dir}/bin/python ${tmp_dir}/python
  14. if [ ! "$(${tmp_dir}/python -c 'import sys; print(sys.path)'|grep ${venv_dir})" ]; then
  15. echo "$cmd: venv lost"
  16. else
  17. echo "$cmd: venv ok"
  18. fi
  19. }
  20.  
  21. uname -a
  22. test_venv 'python3.6 -m venv'
  23. test_venv 'python3.7 -m venv'
  24. test_venv 'virtualenv-2'
  25. test_venv 'virtualenv -p python3.6'
  26. test_venv 'virtualenv -p python2.7'
  27. test_venv 'virtualenv -p python3.7'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement