Skip to content

Commit

Permalink
Merge pull request #63 from mdmintz/shorten-path-and-refresh-dependen…
Browse files Browse the repository at this point in the history
…cies

Shorten path displayed and refresh dependencies
  • Loading branch information
mdmintz authored Jun 29, 2024
2 parents bbc3aea + 063985a commit f8c1dd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
print("\nERROR! Publishing to PyPI requires Python>=3.9")
sys.exit()
print("\n*** Checking code health with flake8:\n")
os.system("python -m pip install 'flake8==6.1.0'")
os.system("python -m pip install 'flake8==7.1.0'")
flake8_status = os.system("flake8 --exclude=.eggs,temp")
if flake8_status != 0:
print("\nERROR! Fix flake8 issues before publishing to PyPI!\n")
Expand Down Expand Up @@ -71,7 +71,7 @@

setup(
name="pdbp",
version="1.5.0",
version="1.5.1",
description="pdbp (Pdb+): A drop-in replacement for pdb and pdbpp.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down Expand Up @@ -121,7 +121,7 @@
],
python_requires=">=3.7",
install_requires=[
"pygments>=2.16.1",
"pygments>=2.17.2",
"tabcompleter>=1.3.0",
'colorama>=0.4.6;platform_system=="Windows"',
],
Expand Down
15 changes: 14 additions & 1 deletion src/pdbp.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class DefaultConfig(object):
stdin_paste = None
exec_if_unfocused = None # This option was removed!
truncate_long_lines = False
shorten_path = True
disable_pytest_capturing = True
enable_hidden_frames = False
show_hidden_frames_count = False
Expand Down Expand Up @@ -962,7 +963,19 @@ def _print_if_sticky(self):
frame, lineno = self.stack[self.curindex]
filename = self.canonic(frame.f_code.co_filename)
lno = Color.set(self.config.line_number_color, "%r" % lineno)
fname = Color.set(self.config.filename_color, filename)
short_filename = filename
if self.config.shorten_path:
try:
home_dir = os.path.expanduser("~")
if (
len(home_dir) > 4
and filename.startswith(home_dir)
and filename.count(home_dir) == 1
):
short_filename = filename.replace(home_dir, "~")
except Exception:
pass
fname = Color.set(self.config.filename_color, short_filename)
fnln = None
if not self.curindex:
self.curindex = 0
Expand Down

0 comments on commit f8c1dd4

Please sign in to comment.