Skip to content

Commit

Permalink
Merge pull request #345 from jakirkham/improved_file_removal
Browse files Browse the repository at this point in the history
Handle a subtle case involving file removal during re-rendering
  • Loading branch information
jakirkham authored Oct 31, 2016
2 parents 7f0ac61 + 58e7fdd commit 4ff7875
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions conda_smithy/feedstock_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ def write_file(filename):
repo.index.add([filename])


def touch_file(filename):
with write_file(filename) as fh:
fh.write("")


def remove_file(filename):
if os.path.exists(filename):
repo = get_repo(filename)
if repo:
repo.index.remove([filename])
touch_file(filename)

repo = get_repo(filename)
if repo:
repo.index.remove([filename])

os.remove(filename)
os.remove(filename)


def copy_file(src, dst):
Expand Down

0 comments on commit 4ff7875

Please sign in to comment.