Skip to content

Commit

Permalink
feat: Add IDC_INDEX_DATA_GENERATE_CSV_ARCHIVE option (enabled by defa…
Browse files Browse the repository at this point in the history
…ult)
  • Loading branch information
jcfr committed Mar 25, 2024
1 parent 3324ffe commit 0ba0527
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ if(NOT DEFINED ENV{GCP_PROJECT})
message(FATAL_ERROR "GCP_PROJECT env. variable is not set")
endif()

option(IDC_INDEX_DATA_GENERATE_CSV_ARCHIVE "Generate idc_index.csv.zip file" ON)
option(IDC_INDEX_DATA_GENERATE_PARQUET "Generate idc_index.parquet file" OFF)

set(download_dir "${PROJECT_BINARY_DIR}")

add_custom_command(
OUTPUT
${download_dir}/idc_index.csv.zip
$<$<BOOL:IDC_INDEX_DATA_GENERATE_CSV_ARCHIVE>:${download_dir}/idc_index.csv.zip>
$<$<BOOL:IDC_INDEX_DATA_GENERATE_PARQUET>:${download_dir}/idc_index.parquet>
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/python/idc_index_data_manager.py
--generate-csv-archive
Expand All @@ -25,12 +26,12 @@ add_custom_command(

add_custom_target(run_idc_index_data_manager ALL
DEPENDS
${download_dir}/idc_index.csv.zip
$<$<BOOL:IDC_INDEX_DATA_GENERATE_CSV_ARCHIVE>:${download_dir}/idc_index.csv.zip>
$<$<BOOL:IDC_INDEX_DATA_GENERATE_PARQUET>:${download_dir}/idc_index.parquet>
)

install(
FILES
${download_dir}/idc_index.csv.zip
$<$<BOOL:IDC_INDEX_DATA_GENERATE_CSV_ARCHIVE>:${download_dir}/idc_index.csv.zip>
$<$<BOOL:IDC_INDEX_DATA_GENERATE_PARQUET>:${download_dir}/idc_index.parquet>
DESTINATION "idc_index_data")
6 changes: 3 additions & 3 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def test_version():


def test_filepath():
assert m.IDC_INDEX_CSV_ARCHIVE_FILEPATH is not None
assert m.IDC_INDEX_CSV_ARCHIVE_FILEPATH.is_file()
assert m.IDC_INDEX_CSV_ARCHIVE_FILEPATH.name == "idc_index.csv.zip"
if m.IDC_INDEX_CSV_ARCHIVE_FILEPATH is not None:
assert m.IDC_INDEX_CSV_ARCHIVE_FILEPATH.is_file()
assert m.IDC_INDEX_CSV_ARCHIVE_FILEPATH.name == "idc_index.csv.zip"

if m.IDC_INDEX_PARQUET_FILEPATH is not None:
assert m.IDC_INDEX_PARQUET_FILEPATH.is_file()
Expand Down

0 comments on commit 0ba0527

Please sign in to comment.