/
githubmirror
/
scikit-learn
Обзор
Документация
Войти
/
githubmirror
/
scikit-learn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.binder/postBuild
40 строк
2 KB
Yuvi Panda
MNT: Check if running inside repo2docker more explicitly (#30835)
17 фев 2025, 13:08
Не верифицирован
17 фев 2025, 13:08
033a46c
Код
Авторство
О чём код?
#!/bin/bash set -e # This script is called in a binder context. When this script is called, we are # inside a git checkout of the scikit-learn/scikit-learn repo. This script is # generating notebooks from the scikit-learn python examples. if [[ -z "${REPO_DIR}" ]]; then echo "This script was written for repo2docker and the REPO_DIR environment variable is supposed to be set." echo "Exiting because this script can delete data if run outside of a repo2docker context." exit 1 fi # Back up content we need from the scikit-learn repo TMP_CONTENT_DIR=/tmp/scikit-learn mkdir -p $TMP_CONTENT_DIR cp -r examples .binder $TMP_CONTENT_DIR # delete everything in current directory including dot files and dot folders find . -delete # Generate notebooks and remove other files from examples folder GENERATED_NOTEBOOKS_DIR=.generated-notebooks cp -r $TMP_CONTENT_DIR/examples $GENERATED_NOTEBOOKS_DIR find $GENERATED_NOTEBOOKS_DIR -name '*.py' -exec sphinx_gallery_py2jupyter '{}' + NON_NOTEBOOKS=$(find $GENERATED_NOTEBOOKS_DIR -type f | grep -v '\.ipynb') rm -f $NON_NOTEBOOKS # Put the .binder folder back (may be useful for debugging purposes) mv $TMP_CONTENT_DIR/.binder . # Final clean up rm -rf $TMP_CONTENT_DIR # This is for compatibility with binder sphinx-gallery integration: this makes # sure that the binder links generated by sphinx-gallery are correct even tough # the repo we use for binder (scikit-learn/scikit-learn) is not the repo of the # generated doc (scikit-learn/scikit-learn.github.io) mkdir notebooks ln -s ../$GENERATED_NOTEBOOKS_DIR notebooks/auto_examples