From b9d16ca74b49820412f13d15ab191190cd69e786 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Wed, 27 Nov 2024 15:54:55 -0600 Subject: [PATCH] MANIFEST.in not working --- MANIFEST.in | 2 ++ zppy_interfaces/global_time_series/coupled_global.py | 5 +---- zppy_interfaces/global_time_series/coupled_global_utils.py | 6 ++---- zppy_interfaces/global_time_series/coupled_global_viewer.py | 6 +----- 4 files changed, 6 insertions(+), 13 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..0c94372 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include zppy-interfaces zppy_interfaces/global_time_series/zppy_land_fields.csv +recursive-include zppy-interfaces zppy_interfaces/global_time_series/index_template.html diff --git a/zppy_interfaces/global_time_series/coupled_global.py b/zppy_interfaces/global_time_series/coupled_global.py index 35464fb..a22f626 100644 --- a/zppy_interfaces/global_time_series/coupled_global.py +++ b/zppy_interfaces/global_time_series/coupled_global.py @@ -70,10 +70,7 @@ def land_csv_row_to_var(csv_row: List[str]) -> Variable: def construct_land_variables(requested_vars: List[str]) -> List[Variable]: var_list: List[Variable] = [] header = True - # TODO: how do we make sure the csv is actually accessible???? - # The current directory is where we ran the code from, which is not necessarily where the csv is. - csv_path = INCLUSIONS_DIR - with open(f"{csv_path}/zppy_land_fields.csv", newline="") as csv_file: + with open(f"{INCLUSIONS_DIR}/zppy_land_fields.csv", newline="") as csv_file: logger.debug("Reading zppy_land_fields.csv") var_reader = csv.reader(csv_file) for row in var_reader: diff --git a/zppy_interfaces/global_time_series/coupled_global_utils.py b/zppy_interfaces/global_time_series/coupled_global_utils.py index b54f956..11768b2 100644 --- a/zppy_interfaces/global_time_series/coupled_global_utils.py +++ b/zppy_interfaces/global_time_series/coupled_global_utils.py @@ -1,9 +1,7 @@ from enum import Enum -# TODO: how to determine this automatically? -INCLUSIONS_DIR = ( - "/home/ac.forsyth2/ez/zppy-interfaces/zppy_interfaces/global_time_series/" -) +# Relies on MANIFEST.in to include files +INCLUSIONS_DIR = "zppy_interfaces/global_time_series" class Metric(Enum): diff --git a/zppy_interfaces/global_time_series/coupled_global_viewer.py b/zppy_interfaces/global_time_series/coupled_global_viewer.py index 271c9a9..4c7a058 100644 --- a/zppy_interfaces/global_time_series/coupled_global_viewer.py +++ b/zppy_interfaces/global_time_series/coupled_global_viewer.py @@ -95,11 +95,7 @@ def insert_data_in_row(row_obj, name: str, url: str): td.append(a) row_obj.append(td) - # import sys - # logger.debug(f"sys.prefix: {sys.prefix}, ls sys.prefix: {os.listdir(sys.prefix)}") - # TODO: figure out install_path - install_path: str = INCLUSIONS_DIR - path: str = os.path.join(install_path, "index_template.html") + path: str = os.path.join(INCLUSIONS_DIR, "index_template.html") output: str = os.path.join(root_dir, "index.html") soup = BeautifulSoup(open(path), "lxml")