Skip to content

Commit

Permalink
Merge pull request #1084 from notoraptor/fix-detecting-dashboard-buil…
Browse files Browse the repository at this point in the history
…d-on-install

Fix detection of dashboard build files in installed packages.
  • Loading branch information
bouthilx authored Feb 22, 2023
2 parents 35e8332 + 9edaf06 commit 85bb4ee
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,18 @@ jobs:
if ( ls ${ORION_PREFIX}/orion-dashboard/build/static/js/main.*.js ); then true; else false; fi
echo Check if frontend script can find dashboard build
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();"
echo Check if frontend script can find dashboard build on sys.prefix/local
mkdir -p ${ORION_PREFIX}/local/
mv ${ORION_PREFIX}/orion-dashboard ${ORION_PREFIX}/local/orion-dashboard
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then false; else true; fi
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then true; else false; fi
python -c "from orion.core.cli.frontend import get_dashboard_build_path; get_dashboard_build_path();"
echo Move build back to initial installation
mv ${ORION_PREFIX}/local/orion-dashboard ${ORION_PREFIX}/orion-dashboard
if ( [ -d "${ORION_PREFIX}/orion-dashboard" ] ); then true; else false; fi
if ( [ -d "${ORION_PREFIX}/local/orion-dashboard" ] ); then false; else true; fi
echo Clean-up
pip uninstall -y orion
echo Check if dashboard build is correctly removed
Expand Down
7 changes: 4 additions & 3 deletions conda/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ conda config --set channel_priority strict

pip uninstall -y setuptools
conda install -c anaconda setuptools
conda install conda-build

conda update -q conda
conda info -a
conda install conda-build anaconda-client

conda build conda --python 3.7
conda build conda --python 3.8
conda build conda --python 3.9
conda-build conda --python 3.7
conda-build conda --python 3.8
conda-build conda --python 3.9

# Conda 3.10 does not work because of a bug inside conda itself
# conda build conda --python 3.10
13 changes: 13 additions & 0 deletions src/orion/core/cli/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,25 @@ def get_dashboard_build_path():
https://docs.python.org/3/distutils/setupscript.html#installing-additional-files
Otherwise, dashboard build should be in dashboard folder near src
in orion repository.
NB (2023/02/20): It seems that, depending on installation, additional files may
be installed in `<sys.prefix>/local` instead of just `<sys.prefix>`.
More info:
https://stackoverflow.com/questions/14211575/any-python-function-to-get-data-files-root-directory#comment99087548_14211600
"""
current_file_path = __file__
if current_file_path.startswith(sys.prefix):
dashboard_build_path = os.path.join(sys.prefix, "orion-dashboard", "build")
if not os.path.isdir(dashboard_build_path):
dashboard_build_path = os.path.join(
sys.prefix, "local", "orion-dashboard", "build"
)
elif current_file_path.startswith(site.USER_BASE):
dashboard_build_path = os.path.join(site.USER_BASE, "orion-dashboard", "build")
if not os.path.isdir(dashboard_build_path):
dashboard_build_path = os.path.join(
site.USER_BASE, "local", "orion-dashboard", "build"
)
else:
dashboard_build_path = os.path.abspath(
os.path.join(
Expand Down

0 comments on commit 85bb4ee

Please sign in to comment.