Skip to content

Commit

Permalink
BUG FIX: Use Path.relative_to() for Python 3.8 compatibility (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
bswck committed Jan 26, 2024
1 parent ec406ff commit 2aea99d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion devtools/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def install() -> int:
print(f'Found path `{install_path}` to install devtools into `builtins`')
print('To install devtools, run the following command:\n')
print(f' python -m devtools print-code >> {install_path}\n')
if not install_path.is_relative_to(Path.home()):
try:
install_path.relative_to(Path.home())
except ValueError:
print('or maybe\n')
print(f' python -m devtools print-code | sudo tee -a {install_path} > /dev/null\n')
print('Note: "sudo" might be required because the path is in your home directory.')
Expand Down

0 comments on commit 2aea99d

Please sign in to comment.