Skip to content

Commit

Permalink
Merge pull request #42 from fedorov/fix-s5cmd-regression
Browse files Browse the repository at this point in the history
BUG: fix regression in looking up s5cmd
  • Loading branch information
fedorov authored Feb 14, 2024
2 parents 597aef6 + aa8c034 commit fcedf4a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion idc_index/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess
import tempfile
import urllib.request
from pathlib import Path

import duckdb
import pandas as pd
Expand Down Expand Up @@ -49,11 +50,24 @@ def __init__(self):
)

# Lookup s5cmd
self.s5cmdPath = shutil.which("s5cmd")
self.s5cmdPath = None

logger.debug("Checking if s5cmd is available in the package folder")
self.s5cmdPath = str(
next(Path(os.path.join(current_dir, "s5cmd")).glob("s5cmd*"), None)
)

if self.s5cmdPath is None:
logger.debug("Falling back to system s5cmd")
self.s5cmdPath = shutil.which("s5cmd")

if self.s5cmdPath is None:
raise FileNotFoundError(
"s5cmd executable not found. Please install s5cmd from https://github.com/peak/s5cmd#installation"
)

self.s5cmdPath = str(self.s5cmdPath)

logger.debug(f"Found s5cmd executable: {self.s5cmdPath}")

# ... and check it can be executed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ classifiers = [
dynamic = ["version"]
dependencies = [
'duckdb;python_version<"3.12"',
'duckdb==0.9.3.dev3597;python_version=="3.12"',
'duckdb>0.9.2;python_version=="3.12"',
"pandas<2.2",
"psutil",
]
Expand Down

0 comments on commit fcedf4a

Please sign in to comment.