Skip to content

Commit

Permalink
download: don't write a lock file if not necessary
Browse files Browse the repository at this point in the history
this is needed on read-only filesystems
  • Loading branch information
kidanger committed Jan 19, 2024
1 parent de59345 commit c68fa34
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions srtm4/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ def get_srtm_tile(srtm_tile, out_dir):
# the tif file is either being written or finished writing
# locking will ensure it is not being written.
# Also by construction we won't write on something complete.
lock_tif = filelock.FileLock(srtm_tif_write_lock)
lock_tif.acquire()
lock_tif.release()
if os.path.exists(srtm_tif_write_lock):
lock_tif = filelock.FileLock(srtm_tif_write_lock)
lock_tif.acquire()
lock_tif.release()
return

# download the zip file
Expand Down

0 comments on commit c68fa34

Please sign in to comment.