Skip to content

Commit

Permalink
fix for to find HSDS executables in Windows w/ Anaconda (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey authored Aug 9, 2023
1 parent ff13a70 commit 21e0e25
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ Make sure you have Python 3, Pip, and git installed, then:
5. Create a directory the server will use to store data, and then set the ROOT_DIR environment variable to point to it: `$ mkdir hsds_data; export ROOT_DIR="${PWD}/hsds_data"` For Windows: `C:> set ROOT_DIR=%CD%\hsds_data`
6. Create the hsds test bucket: `$ mkdir hsds_data/hsdstest`
7. Start server: `$ ./runall.sh --no-docker` For Windows: `C:> runall.bat`
8. In a new shell, set the environment variable HSDS_ENDPOINT to the string displayed. E.g.: `$ export HSDS_ENDPOINT=http+unix://%2Ftmp%2Fhs%2Fsn_1.sock`. For Windows, this step can be skipped
9. Set environment variables for the admin account: `$ export ADMIN_USERNAME=admin` and `$ export ADMIN_PASSWORD=admin` (adjust for any changes made to the passwd.txt file). For Windows - use the corresponding set commands
10. Run the test suite: `$ python testall.py`
11. (Optional) Post install setup (test data, home folders, cli tools, etc): [docs/post_install.md](docs/post_install.md)
12. (Optional) Install the h5pyd package for an h5py compatible api and tool suite: https://github.com/HDFGroup/h5pyd
8. In a new shell, set environment variables for the admin account: `$ export ADMIN_USERNAME=admin` and `$ export ADMIN_PASSWORD=admin` (adjust for any changes made to the passwd.txt file). For Windows - use the corresponding set commands
9. Run the test suite: `$ python testall.py --skip_unit`
10. (Optional) Post install setup (test data, home folders, cli tools, etc): [docs/post_install.md](docs/post_install.md)
11. (Optional) Install the h5pyd package for an h5py compatible api and tool suite: https://github.com/HDFGroup/h5pyd

To shut down the server, and the server was started with the --no-docker option, just control-C.

Expand Down
15 changes: 9 additions & 6 deletions hsds/hsds_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ def get_cmd_dir():
logging.info(f"using cmd_dir: {cmd_dir}")
return cmd_dir

sys_bin_dir = os.path.join(sys.exec_prefix, "bin")
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
# look for binaries in exec_prefix in "bin" or "Scripts"
# (Anaconda seems to use Scripts on Windows)
for bin_dir in ("bin", "Scripts"):
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

# fall back to just use __file__.parent
bin_dir = Path(__file__).parent
Expand Down

0 comments on commit 21e0e25

Please sign in to comment.