73edfd1a2cd120e8c3fdb71de924c5d4161b20bb

Author
Michael Aquilina <michaelaquilina@gmail.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

Change from Travis to CircleCI 2.0

Diff

  1diff --git a/.circleci/config.yml b/.circleci/config.yml
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..112cb9c9a86334a75e1bb3a1545b44ee646c6040
  4--- /dev/null
  5+++ b/.circleci/config.yml
  6@@ -0,0 +1,75 @@
  7+version: 2
  8+
  9+
 10+test: &test
 11+  steps:
 12+    - checkout
 13+    - run:
 14+        name: Install Dependencies
 15+        command: apt-get update && apt-get install -y curl python3-pip ncurses-bin python python-virtualenv git
 16+    - run:
 17+        name: install virtualenvwrapper
 18+        command: pip3 install virtualenvwrapper
 19+    - run:
 20+        name: Download Zunit
 21+        command: |
 22+          mkdir -p ~/bin
 23+          curl -L https://raw.githubusercontent.com/molovo/revolver/master/revolver > ~/bin/revolver
 24+          curl -L https://github.com/molovo/zunit/releases/download/v0.8.2/zunit > ~/bin/zunit
 25+          chmod u+x ~/bin/{revolver,zunit}
 26+    - run:
 27+        name: Run Zunit
 28+        command: |
 29+          export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3  # We have to manually set this for some reason
 30+          export TERM="xterm-256color"  # Required by tput
 31+          export PATH="$HOME/bin:$PATH"
 32+          zunit --verbose
 33+
 34+
 35+jobs:
 36+  lint:
 37+    docker:
 38+      - image: "python:3.7-stretch"
 39+    steps:
 40+      - checkout
 41+      - run:
 42+          name: run restructuredtext linter
 43+          command: |
 44+            pip install restructuredtext_lint
 45+            rst-lint *.rst
 46+
 47+  test-zsh-5.1:
 48+      docker:
 49+        - image: "zshusers/zsh-5.1.1"
 50+      <<: *test
 51+
 52+  test-zsh-5.2:
 53+      docker:
 54+        - image: "zshusers/zsh-5.2"
 55+      <<: *test
 56+
 57+  test-zsh-5.3:
 58+      docker:
 59+        - image: "zshusers/zsh-5.3.1"
 60+      <<: *test
 61+
 62+  test-zsh-5.4:
 63+      docker:
 64+        - image: "zshusers/zsh-5.4.2"
 65+      <<: *test
 66+
 67+  test-zsh-5.5:
 68+      docker:
 69+        - image: "zshusers/zsh-5.5.1"
 70+      <<: *test
 71+
 72+workflows:
 73+  version: 2
 74+  test:
 75+    jobs:
 76+      - lint
 77+      - test-zsh-5.1
 78+      - test-zsh-5.2
 79+      - test-zsh-5.3
 80+      - test-zsh-5.4
 81+      - test-zsh-5.5
 82diff --git a/.travis.yml b/.travis.yml
 83deleted file mode 100644
 84index 7253c44a7b9622178d8b24d237b6f7a4c244c019..0000000000000000000000000000000000000000
 85--- a/.travis.yml
 86+++ /dev/null
 87@@ -1,45 +0,0 @@
 88-sudo: false
 89-language: python
 90-python:
 91-  - "3.6"
 92-
 93-env:
 94-    - ZSH_TARGET="5.4.2"
 95-    - ZSH_TARGET="5.3.1"
 96-    - ZSH_TARGET="5.2"
 97-    - ZSH_TARGET="5.1.1"
 98-
 99-before_install:
100-    # Setup ccache to run instead of gcc
101-    - export PATH="/usr/lib/ccache:$PATH"
102-    - which gcc
103-    # Download zsh
104-    - export LOCAL="$(mktemp --directory --tmpdir=${TMPDIR:/tmp} local.bin.XXXXXX)"
105-    - wget "https://downloads.sourceforge.net/project/zsh/zsh/$ZSH_TARGET/zsh-$ZSH_TARGET.tar.xz"
106-
107-install:
108-    - pip install virtualenvwrapper restructuredtext_lint
109-    # Build and Install zsh
110-    - tar -xf "zsh-$ZSH_TARGET.tar.xz"*
111-    - cd "zsh-$ZSH_TARGET"
112-    - ./configure --prefix="$LOCAL"
113-    - make
114-    - make install
115-    - cd -
116-    - export PATH="$LOCAL/bin:$PATH"
117-
118-
119-before_script:
120-    - mkdir -p ~/bin
121-    - curl -L "https://raw.githubusercontent.com/molovo/revolver/master/revolver" > ~/bin/revolver
122-    - curl -L "https://github.com/molovo/zunit/releases/download/v0.8.2/zunit" > ~/bin/zunit
123-    - chmod u+x ~/bin/{revolver,zunit}
124-
125-script:
126-    - rst-lint *.rst
127-    - zunit --verbose
128-
129-cache:
130-  directories:
131-  - "$HOME/.cache/pip"
132-  - "$HOME/.ccache"
133diff --git a/README.rst b/README.rst
134index f0627a28096437d377a0a85643fe7efe5255f0e5..4c94b2df8353e4f9ff6210d0f8a3b974f39ead82 100644
135--- a/README.rst
136+++ b/README.rst
137@@ -1,7 +1,7 @@
138 Autoswitch Python Virtualenv
139 ============================
140 
141-|TravisCI| |Release| |GPLv3|
142+|CircleCI| |Release| |GPLv3|
143 
144 *zsh-autoswitch-virtualenv* is a simple ZSH plugin that switches python
145 virtualenvs automatically as you move between directories.
146@@ -250,11 +250,11 @@ NOTE: It is required that you use a minimum zunit version of 0.8.2
147 
148 .. _ZGen: https://github.com/tarjoilija/zgen
149 
150-.. |TravisCI| image:: https://travis-ci.org/MichaelAquilina/zsh-autoswitch-virtualenv.svg?branch=master
151-   :target: https://travis-ci.org/MichaelAquilina/zsh-autoswitch-virtualenv
152+.. |CircleCI| image:: https://circleci.com/gh/MichaelAquilina/zsh-autoswitch-virtualenv.svg?style=svg
153+   :target: https://circleci.com/gh/MichaelAquilina/zsh-autoswitch-virtualenv
154 
155 .. |Release| image:: https://badge.fury.io/gh/MichaelAquilina%2Fzsh-autoswitch-virtualenv.svg
156-    :target: https://badge.fury.io/gh/MichaelAquilina%2Fzsh-autoswitch-virtualenv
157+   :target: https://badge.fury.io/gh/MichaelAquilina%2Fzsh-autoswitch-virtualenv
158 
159 .. |GPLv3| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg
160    :target: https://www.gnu.org/licenses/gpl-3.0
161diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
162index 1d6d2f6721c3cc009ed9f8ea847c2dbb7c2d7460..d412e66dc24dc9eab614621d607c75146e48dce9 100644
163--- a/autoswitch_virtualenv.plugin.zsh
164+++ b/autoswitch_virtualenv.plugin.zsh
165@@ -25,8 +25,14 @@ function _maybeworkon() {
166      workon "$1"
167 
168      if [ -z "$AUTOSWITCH_SILENT" ]; then
169-       # For some reason python --version writes to st derr
170-       printf "[%s]\n" "$(python --version 2>&1)"
171+       # For some reason python --version writes to stderr
172+       if type python > /dev/null; then
173+           printf "[%s]\n" "$(python --version 2>&1)"
174+       elif type python3 > /dev/null; then
175+           printf "[%s]\n" "$(python3 --version 2>&1)"
176+       else
177+           printf "Unable to find python installed on this machine"
178+        fi
179      fi
180   fi
181 }