Skip to content

Commit

Permalink
added force download option to loading netlists
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdbrown4 committed Nov 7, 2023
1 parent 1b05f87 commit 2a76f0d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions spydrnet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_active_plugins():
from spydrnet.util.netlist_type import EDIF, VERILOG, EBLIF


def determine_example_netlists_path(download_option):
def determine_example_netlists_path(download_option, force_download=False):
example_netlists_path = pathlib.Path("example_netlists")
temp_dir_loc = pathlib.Path(
"/tmp/spydrnet_example_netlists/spydrnet-next_release/example_netlists/"
Expand All @@ -136,11 +136,13 @@ def determine_example_netlists_path(download_option):
None

if not example_netlists_path.exists() and download_option:
print(
response = None
if not force_download:
print(
"Could not find example netlists. Download to /tmp/spydrnet_example_netlists? y/n"
)
response = input()
if response == "y":
)
response = input()
if response == "y" or force_download:
print("Downloading example netlists...")
url = (
"https://github.com/byuccl/spydrnet/archive/refs/heads/next_release.zip"
Expand Down Expand Up @@ -198,8 +200,8 @@ def get_example_netlist_names(path):
get_example_netlist_names(example_netlists_path)


def load_example_netlist_by_name(name, netlist_format=EDIF):
example_netlists_path = determine_example_netlists_path(True)
def load_example_netlist_by_name(name, netlist_format=EDIF, force_download=False):
example_netlists_path = determine_example_netlists_path(True, force_download)
get_example_netlist_names(example_netlists_path)
error_message = "Example netlist not found. Either run 'export EXAMPLE_NETLISTS_PATH=<path>' \
or allow downloading to /tmp/spydrnet_example_netlists."
Expand Down

0 comments on commit 2a76f0d

Please sign in to comment.