Skip to content

Commit

Permalink
Create pypackages with default ignore files
Browse files Browse the repository at this point in the history
Close #446
  • Loading branch information
frostming committed May 11, 2021
1 parent 995277f commit fbe4cae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/446.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a default `.gitignore` file in the `__pypacakges__` directory.
5 changes: 4 additions & 1 deletion pdm/models/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,11 @@ def packages_path(self) -> Path:
if compatible_packages.exists():
pypackages = compatible_packages
scripts = "Scripts" if os.name == "nt" else "bin"
if not pypackages.parent.exists():
pypackages.parent.mkdir(parents=True)
pypackages.joinpath(".gitignore").write_text("*\n!.gitignore\n")
for subdir in [scripts, "include", "lib"]:
pypackages.joinpath(subdir).mkdir(exist_ok=True, parents=True)
pypackages.joinpath(subdir).mkdir(exist_ok=True)
return pypackages

def _get_build_dir(self, ireq: pip_shims.InstallRequirement) -> str:
Expand Down

0 comments on commit fbe4cae

Please sign in to comment.