Skip to content

Commit

Permalink
fix: Write version to file doesn't work for editable installs
Browse files Browse the repository at this point in the history
Fixes #192

Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Aug 9, 2023
1 parent 353dcf2 commit abd5537
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pdm/backend/hooks/version/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def _write_version(
write_to = os.path.join(
context.config.build_config.package_dir, write_to
)
target = context.build_dir / write_to
if context.target == "editable":
target = Path(context.config.build_config.package_dir or ".") / write_to
else:
target = context.build_dir / write_to
if not target.parent.exists():
target.parent.mkdir(0o700, parents=True)
with open(target, "w", encoding="utf-8", newline="") as fp:
Expand Down

0 comments on commit abd5537

Please sign in to comment.