Skip to content

Commit

Permalink
Merge pull request #14 from kevinconway/quote-char-fixes
Browse files Browse the repository at this point in the history
Quote char fixes
  • Loading branch information
kevinconway authored Apr 18, 2020
2 parents 19f64d7 + 5598a4c commit 66f11d6
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 24 deletions.
75 changes: 59 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,90 @@ matrix:
- name: "Python 2.6"
python: 2.6
dist: trusty
env: TARGET_VENV_VERSION="<16.0.0"
- name: "Python 2.7"
python: 2.7
dist: trusty
- name: "Python 3.3"
python: 3.3
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "Python 3.4"
python: 3.4
dist: trusty
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "Python 3.5"
python: 3.5
dist: trusty
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "Python 3.6"
python: 3.6
dist: trusty
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "Python 3.7"
python: 3.7
dist: xenial
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "Python 3.8"
python: 3.8
dist: xenial
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "PyPy"
python: pypy
dist: trusty
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"
- name: "PyPy3"
python: pypy3
dist: trusty
env: TARGET_VENV_VERSION=">16.7.0,<20.0.0"

- name: "Python 2.7"
python: 2.7
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
- name: "Python 3.4"
python: 3.4
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
- name: "Python 3.5"
python: 3.5
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
- name: "Python 3.6"
python: 3.6
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
- name: "Python 3.7"
python: 3.7
dist: xenial
env: TARGET_VENV_VERSION=">20.0.0"
- name: "Python 3.8"
python: 3.8
dist: xenial
env: TARGET_VENV_VERSION=">20.0.0"
- name: "PyPy"
python: pypy
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
- name: "PyPy3"
python: pypy3
dist: trusty
env: TARGET_VENV_VERSION=">20.0.0"
addons:
apt:
update: true
packages:
- enchant
- enchant
install:
- pip install -rrequirements.txt
- pip install -rtest-requirements.txt
- pip install -e ./
- pip install --force-reinstall "virtualenv${TARGET_VENV_VERSION}"
- pip install -rrequirements.txt
- pip install -rtest-requirements.txt
- pip install -e ./
script:
# NOTE: We are ignoring Python 3.2 for all linters because virtually all of
# them dropped support for that Python version. Likewise, Pylint dropped
# support for Python3.3 so we have ignored it there as well. The expectation
# is that running these tools under the various other versions will be
# sufficient. Unfortunately for this project, these tools continue to
# periodically drop support for older versions of Python.
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[3-7].*) ]]; then pycodestyle venvctrl/; else echo "Skipping PEP8 for $(python --version 2>&1)."; fi
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[3-7].*) ]]; then pyflakes venvctrl/; else echo "Skipping PyFlakes for $(python --version 2>&1)."; fi
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[4-7].*) ]]; then pylint --rcfile=.pylintrc venvctrl/; else echo "Skipping PyLint for $(python --version 2>&1)."; fi
- py.test tests/
# NOTE: We are ignoring Python 3.2 for all linters because virtually all of
# them dropped support for that Python version. Likewise, Pylint dropped
# support for Python3.3 so we have ignored it there as well. The expectation
# is that running these tools under the various other versions will be
# sufficient. Unfortunately for this project, these tools continue to
# periodically drop support for older versions of Python.
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[3-7].*) ]]; then pycodestyle venvctrl/; else echo "Skipping PEP8 for $(python --version 2>&1)."; fi
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[3-7].*) ]]; then pyflakes venvctrl/; else echo "Skipping PyFlakes for $(python --version 2>&1)."; fi
- if [[ "$(python --version 2>&1)" =~ Python\ (2\.7.*|3\.[4-7].*) ]]; then pylint --rcfile=.pylintrc venvctrl/; else echo "Skipping PyLint for $(python --version 2>&1)."; fi
- py.test tests/
6 changes: 5 additions & 1 deletion tests/test_virtual_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from __future__ import unicode_literals

import os
import subprocess
import uuid

import pytest
Expand All @@ -31,7 +32,10 @@ def test_create(random, tmpdir):
"""Test if new virtual environments can be created."""
path = str(tmpdir.join(random))
venv = api.VirtualEnvironment(path)
venv.create()
try:
venv.create()
except subprocess.CalledProcessError as exc:
assert False, exc.output
assert tmpdir.join(random).check()


Expand Down
14 changes: 7 additions & 7 deletions venvctrl/venv/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ class ActivateFile(BinFile):

"""The virtual environment /bin/activate script."""

read_pattern = re.compile(r'^VIRTUAL_ENV="(.*)"$')
write_pattern = 'VIRTUAL_ENV="{0}"'
read_pattern = re.compile(r'''^VIRTUAL_ENV=["'](.*)["']$''')
write_pattern = 'VIRTUAL_ENV=\'{0}\''

def _find_vpath(self):
"""Find the VIRTUAL_ENV path entry."""
Expand Down Expand Up @@ -240,23 +240,23 @@ class ActivateFishFile(ActivateFile):

"""The virtual environment /bin/activate.fish script."""

read_pattern = re.compile(r'^set -gx VIRTUAL_ENV "(.*)"$')
write_pattern = 'set -gx VIRTUAL_ENV "{0}"'
read_pattern = re.compile(r'''^set -gx VIRTUAL_ENV ["'](.*)["']$''')
write_pattern = 'set -gx VIRTUAL_ENV \'{0}\''


class ActivateCshFile(ActivateFile):

"""The virtual environment /bin/activate.csh script."""

read_pattern = re.compile(r'^setenv VIRTUAL_ENV "(.*)"$')
write_pattern = 'setenv VIRTUAL_ENV "{0}"'
read_pattern = re.compile(r'''^setenv VIRTUAL_ENV ["'](.*)["']$''')
write_pattern = 'setenv VIRTUAL_ENV \'{0}\''


class ActivateXshFile(ActivateFile):

"""The virtual environment /bin/activate.xsh script."""

read_pattern = re.compile(r'^\$VIRTUAL_ENV = r"(.*)"$')
read_pattern = re.compile(r'''^\$VIRTUAL_ENV = r["'](.*)["']$''')
write_pattern = '$VIRTUAL_ENV = r"{0}"'


Expand Down

0 comments on commit 66f11d6

Please sign in to comment.