Skip to content

Commit

Permalink
Remove se.quiet_remove() now that we're on a newer Python version
Browse files Browse the repository at this point in the history
  • Loading branch information
acabal committed Nov 30, 2023
1 parent 2d91e58 commit 93d18b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
11 changes: 0 additions & 11 deletions se/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,6 @@ def is_positive_integer(value: str) -> int:

return int_value

def quiet_remove(file: Path) -> None:
"""
Helper function to delete a file without crashing if it doesn't exist.
This has to remain until the SE server is on Ubuntu 22.04 or Python 3.8.5+
"""

try:
file.unlink()
except Exception:
pass

def get_target_filenames(targets: list, allowed_extensions: Union[tuple, str]) -> list:
"""
Helper function to convert a list of filenames or directories into a list of filenames based on some parameters.
Expand Down
12 changes: 6 additions & 6 deletions se/se_epub_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ def build(self, run_epubcheck: bool, check_only: bool, build_kobo: bool, build_k
shutil.rmtree(work_compatible_epub_dir / ".git", ignore_errors=True)

# We may have a .gitignore file in the epub root if this is a white-label epub. If so, remove it before continuing
se.quiet_remove(work_compatible_epub_dir / ".gitignore")
(work_compatible_epub_dir / ".gitignore").unlink(True)

# Clean up old output files if any
se.quiet_remove(output_dir / f"thumbnail_{asin}_EBOK_portrait.jpg")
se.quiet_remove(output_dir / compatible_epub_output_filename)
se.quiet_remove(output_dir / advanced_epub_output_filename)
se.quiet_remove(output_dir / kobo_output_filename)
se.quiet_remove(output_dir / kindle_output_filename)
(output_dir / f"thumbnail_{asin}_EBOK_portrait.jpg").unlink(True)
(output_dir / compatible_epub_output_filename).unlink(True)
(output_dir / advanced_epub_output_filename).unlink(True)
(output_dir / kobo_output_filename).unlink(True)
(output_dir / kindle_output_filename).unlink(True)

# Are we including proofreading CSS?
if proof:
Expand Down

0 comments on commit 93d18b6

Please sign in to comment.