Skip to content

Commit 5624963

Browse files
committed
Properly handle non relative paths
Fixes #37 Signed-off-by: Pedro Algarvio <[email protected]>
1 parent c222966 commit 5624963

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

changelog/37.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Properly handle non relative paths

src/ptscripts/virtualenv.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ def _create_virtualenv(self) -> None:
176176
if self.system_site_packages:
177177
cmd.append("--system-site-packages")
178178
cmd.append(str(self.venv_dir))
179-
self.ctx.info(f"Creating virtualenv({self.name}) in {self.venv_dir.relative_to(CWD)}")
179+
try:
180+
relative_venv_path = self.venv_dir.relative_to(CWD)
181+
except ValueError:
182+
relative_venv_path = self.venv_dir
183+
self.ctx.info(f"Creating virtualenv({self.name}) in {relative_venv_path}")
180184
self.run(*cmd, cwd=str(self.venv_dir.parent))
181185
self.install(
182186
"-U",

0 commit comments

Comments
 (0)