Skip to content

Commit

Permalink
search for executable with exe suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Oct 3, 2023
1 parent da76616 commit c24dd6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [ $run_pyflakes ]; then
fi
fi

pip install --upgrade build
#pip install --upgrade build

echo "running build"
python -m build
Expand Down
18 changes: 11 additions & 7 deletions hsds/hsds_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,13 @@ def get_cmd_dir():
sys_bin_dir = os.path.join(sys.exec_prefix, bin_dir)
if os.path.isdir(sys_bin_dir):
logging.debug(f"sys bin_dir: {sys_bin_dir}")
if os.path.isfile(os.path.join(sys_bin_dir, hsds_shortcut)):
logging.info(f"using cmd_dir: {sys_bin_dir}")
return sys_bin_dir
hsds_executable = os.path.join(sys_bin_dir, hsds_shortcut)
# window builds add on a .exe suffix,
# so check with and without the suffix
for suffix in ("", ".exe"):
if os.path.isfile(hsds_executable + suffix):
logging.info(f"using cmd_dir: {sys_bin_dir}")
return sys_bin_dir

# fall back to just use __file__.parent
bin_dir = Path(__file__).parent
Expand Down Expand Up @@ -260,11 +264,11 @@ def run(self):

py_exe = sys.executable
cmd_path = os.path.join(self._cmd_dir, "hsds-node")

if not os.path.isfile(cmd_path):
# search corresponding location for windows installs
cmd_path = os.path.join(sys.exec_prefix, "Scripts")
cmd_path = os.path.join(cmd_path, "hsds-node-script.py")
if not os.path.isfile(cmd_path):
if os.path.isfile(cmd_path + ".exe"):
cmd_path += ".exe"
else:
raise FileNotFoundError("can't find hsds-node executable")

for i in range(count):
Expand Down
6 changes: 6 additions & 0 deletions tests/integ/dataset_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,12 @@ def testResizableDataset(self):
self.assertEqual(rsp.status_code, 201)
rspJson = json.loads(rsp.text)

# reduce the size to 5 elements
payload = {"shape": 5}
rsp = self.session.put(req, data=json.dumps(payload), headers=headers)
self.assertEqual(rsp.status_code, 201)
rspJson = json.loads(rsp.text)

# verify updated-shape using the GET shape request
rsp = self.session.get(req, headers=headers)
self.assertEqual(rsp.status_code, 200)
Expand Down

0 comments on commit c24dd6a

Please sign in to comment.