Related: https://pagure.io/koji/issue/3369
Metadata Update from @tkopecek: - Pull-request tagged with: testing-ready
Metadata Update from @jobrauer: - Pull-request tagged with: testing-done
Commit d6da86ef fixes this pull-request
Pull-Request has been merged by tkopecek
This is a "look before you leap" pattern with os.path.exists(). It's better to call your file operations directly, and ignore the exception if the file does not exist.
os.path.exists()
Python 3.6+ (ie, CentOS 8) has a FileNotFoundError exception that is handy for this:
FileNotFoundError
try: if os.path.getsize(options.ccache) == 0: os.remove(options.ccache) except (FileNotFoundError): pass
Maybe better. Anyway, it will mask potential "unlink" problem which raises the same exception. It shouldn't happen, but...
Related: https://pagure.io/koji/issue/3369