Skip to content

Commit 9834fb5

Browse files
committed
Try again
1 parent 4968a4c commit 9834fb5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

hatch_build.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ class GitignoreBuildHook(BuildHookInterface):
99
def initialize(self, _version, _build_data):
1010
"""Temporarily modify .gitignore so data is included when the sdist is installed using pip. """
1111

12-
# On Windows .gitignore.tmp may already exist and cause an error, when calling rename later.
13-
Path('.gitignore.tmp').unlink(missing_ok=True)
14-
1512
gi = Path('.gitignore')
1613
if gi.exists():
1714
cleaned = gi.read_text().replace('geonamescache/data/', '')
15+
# On Windows .gitignore.tmp may already exist and cause an error, when calling rename.
16+
Path('.gitignore.tmp').unlink(missing_ok=True)
1817
gi.rename('.gitignore.tmp')
1918
Path('.gitignore').write_text(cleaned)
2019

2120

2221
def finalize(self, _version, _build_data, _artifact):
2322
gi = Path('.gitignore.tmp')
2423
if gi.exists():
24+
# On Windows .gitignore may already exist and cause an error, when calling rename.
25+
Path('.gitignore').unlink(missing_ok=True)
2526
gi.rename('.gitignore')

0 commit comments

Comments
 (0)