Skip to content

Commit

Permalink
v1.2.25
Browse files Browse the repository at this point in the history
Fixes #44
  • Loading branch information
onelivesleft committed Nov 24, 2021
1 parent 85b187c commit f61574e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# v1.2.25

* Fixed problem installing into virtualenv paths.


# v1.2.24

* Fixed problem when running in container which reports a terminal width of 0
Expand Down
2 changes: 1 addition & 1 deletion pretty_errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
terminal_is_interactive = sys.stderr.isatty()

name = "pretty_errors"
__version__ = "1.2.24" # remember to update version in setup.py!
__version__ = "1.2.25" # remember to update version in setup.py!

active = 'PYTHON_PRETTY_ERRORS' not in os.environ or os.environ['PYTHON_PRETTY_ERRORS'] != '0'
interactive_tty_only = 'PYTHON_PRETTY_ERRORS_ISATTY_ONLY' in os.environ and os.environ['PYTHON_PRETTY_ERRORS_ISATTY_ONLY'] != '0'
Expand Down
11 changes: 8 additions & 3 deletions pretty_errors/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@
# in virtualenv, `site` has no attribute `getsitepackages` or `getusersitepackages`
if in_virtualenv:
def getsitepackages():
sep = "\\\\" if os.path.sep == "\\" else os.path.sep
pattern1 = re.compile(r'^%s$' % sep.join([os.environ['VIRTUAL_ENV'], 'lib', 'python[0-9.]+', 'site-packages']))
pattern2 = re.compile(r'^%s$' % sep.join([os.environ['VIRTUAL_ENV'], 'lib', 'site-packages']))
if os.path.sep == "\\":
sep = "\\\\"
env_path = os.environ['VIRTUAL_ENV'].replace("\\", "\\\\")
else:
sep = os.path.sep
env_path = os.environ['VIRTUAL_ENV']
pattern1 = re.compile(r'^%s$' % sep.join([env_path, 'lib', 'python[0-9.]+', 'site-packages']))
pattern2 = re.compile(r'^%s$' % sep.join([env_path, 'lib', 'site-packages']))
paths = [path for path in set(sys.path) if pattern1.search(path) or pattern2.search(path)]
return paths

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pretty_errors",
version="1.2.24", # remember to also update __version__ in __init__.py!
version="1.2.25", # remember to also update __version__ in __init__.py!
author="Iain King",
author_email="[email protected]",
description="Prettifies Python exception output to make it legible.",
Expand Down

0 comments on commit f61574e

Please sign in to comment.