From e51634d830f26c8cd0d449d97ae3345e20446dcd Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Fri, 5 Aug 2022 18:25:05 +0200 Subject: [PATCH] Add suggestions from #246 --- setup.py | 2 +- src/wireviz/tools/build_examples.py | 2 +- src/wireviz/wv_cli.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 54c8026e..8ef73a62 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ author="Daniel Rojas", # author_email='', description="Easily document cables and wiring harnesses", - long_description=open(README_PATH).read(), + long_description=README_PATH.read_text(), long_description_content_type="text/markdown", install_requires=[ "click", diff --git a/src/wireviz/tools/build_examples.py b/src/wireviz/tools/build_examples.py index 5ce9fe42..fe9ba4a3 100755 --- a/src/wireviz/tools/build_examples.py +++ b/src/wireviz/tools/build_examples.py @@ -97,7 +97,7 @@ def clean_generated(groupkeys): for filename in collect_filenames("Cleaning", key, generated_extensions): if filename.is_file(): print(f' rm "{filename}"') - Path(filename).unlink() + filename.unlink() def compare_generated(groupkeys, branch="", include_graphviz_output=False): diff --git a/src/wireviz/wv_cli.py b/src/wireviz/wv_cli.py index eb0f33c7..7acff8a1 100644 --- a/src/wireviz/wv_cli.py +++ b/src/wireviz/wv_cli.py @@ -111,6 +111,8 @@ def wireviz(file, format, prepend, output_dir, output_name, version): prepend_file = Path(prepend_file) if not prepend_file.exists(): raise Exception(f"File does not exist:\n{prepend_file}") + if not prepend_file.is_file(): + raise Exception(f"Path is not a file:\n{prepend_file}") print("Prepend file:", prepend_file) prepend_input += open_file_read(prepend_file).read() + "\n" @@ -122,6 +124,8 @@ def wireviz(file, format, prepend, output_dir, output_name, version): file = Path(file) if not file.exists(): raise Exception(f"File does not exist:\n{file}") + if not file.is_file(): + raise Exception(f"Path is not a file:\n{file}") # file_out = file.with_suffix("") if not output_file else output_file _output_dir = file.parent if not output_dir else output_dir