From 5a60c973538f824b8a26b2b7650f7513c58e47b6 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Sat, 3 Oct 2020 15:47:03 +1000 Subject: [PATCH 1/5] copy stable and dev docs --- maintainer/deploy_docs_via_travis.sh | 11 ++-- maintainer/update_json_stubs_sitemap.py | 68 ++++++++++++++++++------- 2 files changed, 57 insertions(+), 22 deletions(-) diff --git a/maintainer/deploy_docs_via_travis.sh b/maintainer/deploy_docs_via_travis.sh index af503e56727..7c36560bc6f 100644 --- a/maintainer/deploy_docs_via_travis.sh +++ b/maintainer/deploy_docs_via_travis.sh @@ -54,7 +54,7 @@ git fetch --depth 50 upstream ${GH_DOC_BRANCH} gh-pages git reset upstream/gh-pages # for dev, latest, home redirects -mkdir dev latest +mkdir latest export URL="https://docs.mdanalysis.org" python ${MAINTAIN_DIR}/update_json_stubs_sitemap.py touch . @@ -62,8 +62,13 @@ touch .nojekyll git add -A ${VERSION}/ git add .nojekyll versions.json -git add index.html dev latest -git add *.xml +git add index.html latest + +for dirname in dev stable documentation_pages ; do + if [ -d $dirname ]; then git add $dirname; fi +done + +git add *.xml *.html # check for anything to commit # https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes diff --git a/maintainer/update_json_stubs_sitemap.py b/maintainer/update_json_stubs_sitemap.py index 662e5df2e89..2ac88f62f71 100644 --- a/maintainer/update_json_stubs_sitemap.py +++ b/maintainer/update_json_stubs_sitemap.py @@ -16,6 +16,7 @@ import errno import glob import textwrap +import shutil try: from urllib.request import Request, urlopen @@ -76,9 +77,10 @@ def write_redirect(file, version='', outfile=None): already_exists = VERSION in existing latest = 'dev' not in VERSION -if not already_exists and latest: - for ver in versions: - ver['latest'] = False +if not already_exists: + if latest: + for ver in versions: + ver['latest'] = False versions.append({ 'version': VERSION, @@ -87,17 +89,6 @@ def write_redirect(file, version='', outfile=None): 'latest': latest }) -versions.sort(key=lambda x: x["version"]) - -with open("versions.json", 'w') as f: - json.dump(versions, f, indent=2) - -# ========= WRITE HTML STUBS ========= -# Add HTML files to redirect: -# index.html -> latest release -# latest/index.html -> latest release -# dev/index.html -> dev docs - for ver in versions[::-1]: if ver['latest']: latest_version = ver['version'] @@ -118,11 +109,20 @@ def write_redirect(file, version='', outfile=None): except IndexError: dev_version = None +versions.sort(key=lambda x: x["version"]) + +# ========= WRITE HTML STUBS ========= +# Add HTML files to redirect: +# index.html -> latest release +# latest/index.html -> latest release +# dev/index.html -> dev docs if latest: - html_files = glob.glob(f'{VERSION}/**/*.html', recursive=True) + shutil.copytree(VERSION, "stable") + print(f"Copied {VERSION} to stable/") + html_files = glob.glob(f'stable/**/*.html', recursive=True) for file in html_files: - outfile = file.strip(f'{VERSION}/') + outfile = file[7:] # strip "stable/" dirname = os.path.dirname(outfile) if dirname and not os.path.exists(dirname): try: @@ -132,15 +132,45 @@ def write_redirect(file, version='', outfile=None): raise write_redirect(file, '', outfile) + + if latest_version: - write_redirect('index.html', latest_version) - write_redirect('objects.inv', latest_version, 'latest/objects.inv') + write_redirect('index.html', "stable") write_redirect('index.html', latest_version, 'latest/index.html') + for ver in versions: + if ver["version"] == "stable": + ver["url"] = os.path.join(URL, "stable") + break + else: + versions.append({ + "version": "stable", + "display": "stable", + "url": os.path.join(URL, "stable"), + "latest": False + }) if dev_version: - write_redirect('index.html', dev_version, 'dev/index.html') + if dev_version == VERSION: + shutil.copytree(VERSION, "dev") + print(f"Copied {VERSION} to dev/") + + for ver in versions: + if ver["version"] == "dev": + ver["url"] = os.path.join(URL, "dev") + break + else: + versions.append({ + "version": "dev", + "display": "dev", + "url": os.path.join(URL, "dev"), + "latest": False + }) + + +with open("versions.json", 'w') as f: + json.dump(versions, f, indent=2) # ========= WRITE SUPER SITEMAP.XML ========= # make one big sitemap.xml From c2343540fe321b6be18cd587aa42057f1bbfb0cf Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Sat, 3 Oct 2020 15:51:28 +1000 Subject: [PATCH 2/5] to undo: change site to lilyminium's --- .travis.yml | 101 +++++++++++++++------------ maintainer/deploy_docs_via_travis.sh | 4 +- package/doc/sphinx/source/conf.py | 4 +- 3 files changed, 63 insertions(+), 46 deletions(-) diff --git a/.travis.yml b/.travis.yml index d94dc955f0a..f4b6f4e7c81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ os: env: global: - - secure: "VJ8cMKXuVe7e6vlBeUkd8j6wUbxYF0Yja6CHn0tmpzVGm3CCBXxoZcgvgtfyJTjf+2nqKIjsIy4FdYIkotXYaDwAX5XHHHWS/++7917pddJ2nZkBnBI069c2gLL6vU7E7jbGUzmKywsA73Of44pVsYgtGneK0F7/guLawpWBOOpLsui+pL2X4jYXZL4WHjTPGTphUN4uhQIkqKkuu9ZSR6uodzZDjzkH+q0FT5RLqmgVttnCD9ZmS2ppQsI9f0jZUd8V0M4NGaTHd439uj1UpMMriSJEzcq9DsKZEncjoJZGqfnXPUG9j5Z+jZ8TyxClma93HxeXbXa8A4B6V0wwNA2VG3ZCCeSQon2iNVl8YNZLPaMQleeoQ+uT6D4z26fHVGzk4knMeTROCfHoZo2T8as5EeFDvcbXGva82BnF+aCFxj/d9f1VC3too7bsY+gBBUu/oxVizDWDEby+2Iz2EzUGG3YltF0MjaLrFQ5ggox4vZVVgmlJo8KT6zonTNl8EdKwIzUDh1ZrpiNv3yMgt030heTFL6EJ30xRQJZkwwklJBPgDuARz2FxyKk+hO8IR7AuGLICwP1IpUASXaKeSD1K09qUnmB8W8RO5YhnLu7ABr6oghU9t63r1V0jLTCvYbO4SQIJ2muNsTay/rKo5QtzklPka/5Kud6KyIrsKb4=" + # - secure: "VJ8cMKXuVe7e6vlBeUkd8j6wUbxYF0Yja6CHn0tmpzVGm3CCBXxoZcgvgtfyJTjf+2nqKIjsIy4FdYIkotXYaDwAX5XHHHWS/++7917pddJ2nZkBnBI069c2gLL6vU7E7jbGUzmKywsA73Of44pVsYgtGneK0F7/guLawpWBOOpLsui+pL2X4jYXZL4WHjTPGTphUN4uhQIkqKkuu9ZSR6uodzZDjzkH+q0FT5RLqmgVttnCD9ZmS2ppQsI9f0jZUd8V0M4NGaTHd439uj1UpMMriSJEzcq9DsKZEncjoJZGqfnXPUG9j5Z+jZ8TyxClma93HxeXbXa8A4B6V0wwNA2VG3ZCCeSQon2iNVl8YNZLPaMQleeoQ+uT6D4z26fHVGzk4knMeTROCfHoZo2T8as5EeFDvcbXGva82BnF+aCFxj/d9f1VC3too7bsY+gBBUu/oxVizDWDEby+2Iz2EzUGG3YltF0MjaLrFQ5ggox4vZVVgmlJo8KT6zonTNl8EdKwIzUDh1ZrpiNv3yMgt030heTFL6EJ30xRQJZkwwklJBPgDuARz2FxyKk+hO8IR7AuGLICwP1IpUASXaKeSD1K09qUnmB8W8RO5YhnLu7ABr6oghU9t63r1V0jLTCvYbO4SQIJ2muNsTay/rKo5QtzklPka/5Kud6KyIrsKb4=" - GH_DOC_BRANCH=develop - - GH_REPOSITORY=github.com/MDAnalysis/mdanalysis.git + - GH_REPOSITORY=github.com/lilyminium/mdanalysis.git - GIT_CI_USER=TravisCI - GIT_CI_EMAIL=TravisCI@mdanalysis.org - MDA_DOCDIR=${TRAVIS_BUILD_DIR}/package/doc/html/html @@ -41,11 +41,12 @@ env: matrix: # Run a coverage test for most versions - - CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - - PYTHON_VERSION=3.8 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - - PYTHON_VERSION=3.7 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - - NUMPY_VERSION=1.16.0 - - NUMPY_VERSION=dev EVENT_TYPE="cron" + # - CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + # - PYTHON_VERSION=3.8 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + # - PYTHON_VERSION=3.7 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + # - PYTHON_VERSION=3.6 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - NUMPY_VERSION=1.13.3 + # - NUMPY_VERSION=dev EVENT_TYPE="cron" matrix: fast_finish: true @@ -59,41 +60,54 @@ matrix: INSTALL_HOLE="false" PIP_DEPENDENCIES="${PIP_DEPENDENCIES} sphinx==1.8.5 sphinx-sitemap sphinx_rtd_theme msmb_theme==1.2.0" - - env: NAME="Lint" - PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc" - MAIN_CMD="pylint --py3k package/MDAnalysis && pylint --py3k testsuite/MDAnalysisTests" - SETUP_CMD="" - BUILD_CMD="" - CONDA_DEPENDENCIES="" - INSTALL_HOLE="false" - - - env: NAME="asv check" - PYTHON_VERSION=3.6 - CODECOV="false" - MAIN_CMD="" - SETUP_CMD="" - PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0" - ASV_CHECK="true" - - - env: NAME="pypi check" - PYTHON_VERSION=3.7 - CODECOV="false" - MAIN_CMD="cd package && python setup.py" - SETUP_CMD="sdist" - BUILD_CMD="" - INSTALL_HOLE="false" - CONDA_DEPENDENCIES="setuptools cython twine" - PYPI_CHECK="true" - - - os: osx - env: PYTHON_VERSION=3.6 - NUMPY_VERSION=1.17.3 - - - env: NAME='minimal' - PIP_DEPENDENCIES="" - CONDA_DEPENDENCIES=${CONDA_MIN_DEPENDENCIES} - INSTALL_HOLE="false" - CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + # - env: NAME="Lint" + # PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc" + # MAIN_CMD="pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests" + # SETUP_CMD="" + # BUILD_CMD="" + # CONDA_DEPENDENCIES="" + # INSTALL_HOLE="false" + + # # pin dependencies for legacy: + # # - ensure that chemfiles can get the last netcdf4 that is still supported + # # see https://github.com/MDAnalysis/mdanalysis/pull/2798#issuecomment-679991785 + # # - install chemfiles and chemfiles-lib via pip (conda times out) + # - env: NAME="python 2.7" + # PYTHON_VERSION=2.7 + # CODECOV="true" + # NUMPY_VERSION=1.16 + # CONDA_DEPENDENCIES="${CONDA_STANDARD_DEPENDENCIES}" + # SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + # PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0 chemfiles" + + # - env: NAME="asv check" + # PYTHON_VERSION=2.7 + # CODECOV="false" + # MAIN_CMD="" + # SETUP_CMD="" + # NUMPY_VERSION=1.16 + # PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0" + # ASV_CHECK="true" + + # - env: NAME="pypi check" + # PYTHON_VERSION=3.7 + # CODECOV="false" + # MAIN_CMD="cd package && python setup.py" + # SETUP_CMD="sdist" + # BUILD_CMD="" + # INSTALL_HOLE="false" + # CONDA_DEPENDENCIES="setuptools cython twine" + # PYPI_CHECK="true" + + # - os: osx + # env: PYTHON_VERSION=3.6 + # NUMPY_VERSION=1.17.3 + + # - env: NAME='minimal' + # PIP_DEPENDENCIES="" + # CONDA_DEPENDENCIES=${CONDA_MIN_DEPENDENCIES} + # INSTALL_HOLE="false" + # CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" allow_failures: - env: NUMPY_VERSION=dev EVENT_TYPE="cron" @@ -154,11 +168,12 @@ after_success: # turn off blocking as it causes large writes to stdout to fail # (see https://github.com/travis-ci/travis-ci/issues/4704) - | - if [[ ${TRAVIS_PULL_REQUEST} == "false" ]] && [[ ${BUILD_DOCS} == "true" ]] ; then + if [[ ${BUILD_DOCS} == "true" ]] ; then python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);' cd ${TRAVIS_BUILD_DIR}/package/MDAnalysis export GH_DOC_BRANCH=${TRAVIS_BRANCH} export VERSION=$(python -c "import version; print(version.__version__)") + export GH_TOKEN=$GH_TOKEN cd - bash ${TRAVIS_BUILD_DIR}/maintainer/deploy_docs_via_travis.sh; fi diff --git a/maintainer/deploy_docs_via_travis.sh b/maintainer/deploy_docs_via_travis.sh index 7c36560bc6f..d2380199de7 100644 --- a/maintainer/deploy_docs_via_travis.sh +++ b/maintainer/deploy_docs_via_travis.sh @@ -55,7 +55,7 @@ git reset upstream/gh-pages # for dev, latest, home redirects mkdir latest -export URL="https://docs.mdanalysis.org" +export URL="https://minium.com.au/mdanalysis" python ${MAINTAIN_DIR}/update_json_stubs_sitemap.py touch . touch .nojekyll @@ -70,6 +70,8 @@ done git add *.xml *.html +ls * + # check for anything to commit # https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes git diff-index --quiet HEAD -- || git commit -m "rebuilt html docs for version ${VERSION} from branch ${GH_DOC_BRANCH} with sphinx at ${rev}" diff --git a/package/doc/sphinx/source/conf.py b/package/doc/sphinx/source/conf.py index 35e01de1ff6..8d1030e4cd4 100644 --- a/package/doc/sphinx/source/conf.py +++ b/package/doc/sphinx/source/conf.py @@ -49,7 +49,7 @@ # they are now at docs.mdanalysis.org/, which requires a CNAME DNS record # pointing to mdanalysis.github.io. To change this URL you should change/delete # the CNAME record for "docs" and update the URL in GitHub settings -site_url = "https://docs.mdanalysis.org/" +site_url = "https://minium.com.au/mdanalysis" # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -161,7 +161,7 @@ } html_context = { - 'versions_json_url': 'https://docs.mdanalysis.org/versions.json' + 'versions_json_url': 'https://minium.com.au/mdanalysis/versions.json' } # Add any paths that contain custom themes here, relative to this directory. From d8caf7afa26464c666cb70b7236b0c6f4695f478 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Sun, 4 Oct 2020 15:58:33 +1100 Subject: [PATCH 3/5] Revert "to undo: change site to lilyminium's" This reverts commit c2343540fe321b6be18cd587aa42057f1bbfb0cf. --- .travis.yml | 101 ++++++++++++--------------- maintainer/deploy_docs_via_travis.sh | 4 +- package/doc/sphinx/source/conf.py | 4 +- 3 files changed, 46 insertions(+), 63 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4b6f4e7c81..d94dc955f0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ os: env: global: - # - secure: "VJ8cMKXuVe7e6vlBeUkd8j6wUbxYF0Yja6CHn0tmpzVGm3CCBXxoZcgvgtfyJTjf+2nqKIjsIy4FdYIkotXYaDwAX5XHHHWS/++7917pddJ2nZkBnBI069c2gLL6vU7E7jbGUzmKywsA73Of44pVsYgtGneK0F7/guLawpWBOOpLsui+pL2X4jYXZL4WHjTPGTphUN4uhQIkqKkuu9ZSR6uodzZDjzkH+q0FT5RLqmgVttnCD9ZmS2ppQsI9f0jZUd8V0M4NGaTHd439uj1UpMMriSJEzcq9DsKZEncjoJZGqfnXPUG9j5Z+jZ8TyxClma93HxeXbXa8A4B6V0wwNA2VG3ZCCeSQon2iNVl8YNZLPaMQleeoQ+uT6D4z26fHVGzk4knMeTROCfHoZo2T8as5EeFDvcbXGva82BnF+aCFxj/d9f1VC3too7bsY+gBBUu/oxVizDWDEby+2Iz2EzUGG3YltF0MjaLrFQ5ggox4vZVVgmlJo8KT6zonTNl8EdKwIzUDh1ZrpiNv3yMgt030heTFL6EJ30xRQJZkwwklJBPgDuARz2FxyKk+hO8IR7AuGLICwP1IpUASXaKeSD1K09qUnmB8W8RO5YhnLu7ABr6oghU9t63r1V0jLTCvYbO4SQIJ2muNsTay/rKo5QtzklPka/5Kud6KyIrsKb4=" + - secure: "VJ8cMKXuVe7e6vlBeUkd8j6wUbxYF0Yja6CHn0tmpzVGm3CCBXxoZcgvgtfyJTjf+2nqKIjsIy4FdYIkotXYaDwAX5XHHHWS/++7917pddJ2nZkBnBI069c2gLL6vU7E7jbGUzmKywsA73Of44pVsYgtGneK0F7/guLawpWBOOpLsui+pL2X4jYXZL4WHjTPGTphUN4uhQIkqKkuu9ZSR6uodzZDjzkH+q0FT5RLqmgVttnCD9ZmS2ppQsI9f0jZUd8V0M4NGaTHd439uj1UpMMriSJEzcq9DsKZEncjoJZGqfnXPUG9j5Z+jZ8TyxClma93HxeXbXa8A4B6V0wwNA2VG3ZCCeSQon2iNVl8YNZLPaMQleeoQ+uT6D4z26fHVGzk4knMeTROCfHoZo2T8as5EeFDvcbXGva82BnF+aCFxj/d9f1VC3too7bsY+gBBUu/oxVizDWDEby+2Iz2EzUGG3YltF0MjaLrFQ5ggox4vZVVgmlJo8KT6zonTNl8EdKwIzUDh1ZrpiNv3yMgt030heTFL6EJ30xRQJZkwwklJBPgDuARz2FxyKk+hO8IR7AuGLICwP1IpUASXaKeSD1K09qUnmB8W8RO5YhnLu7ABr6oghU9t63r1V0jLTCvYbO4SQIJ2muNsTay/rKo5QtzklPka/5Kud6KyIrsKb4=" - GH_DOC_BRANCH=develop - - GH_REPOSITORY=github.com/lilyminium/mdanalysis.git + - GH_REPOSITORY=github.com/MDAnalysis/mdanalysis.git - GIT_CI_USER=TravisCI - GIT_CI_EMAIL=TravisCI@mdanalysis.org - MDA_DOCDIR=${TRAVIS_BUILD_DIR}/package/doc/html/html @@ -41,12 +41,11 @@ env: matrix: # Run a coverage test for most versions - # - CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - # - PYTHON_VERSION=3.8 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - # - PYTHON_VERSION=3.7 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - # - PYTHON_VERSION=3.6 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - - NUMPY_VERSION=1.13.3 - # - NUMPY_VERSION=dev EVENT_TYPE="cron" + - CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - PYTHON_VERSION=3.8 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - PYTHON_VERSION=3.7 CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - NUMPY_VERSION=1.16.0 + - NUMPY_VERSION=dev EVENT_TYPE="cron" matrix: fast_finish: true @@ -60,54 +59,41 @@ matrix: INSTALL_HOLE="false" PIP_DEPENDENCIES="${PIP_DEPENDENCIES} sphinx==1.8.5 sphinx-sitemap sphinx_rtd_theme msmb_theme==1.2.0" - # - env: NAME="Lint" - # PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc" - # MAIN_CMD="pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests" - # SETUP_CMD="" - # BUILD_CMD="" - # CONDA_DEPENDENCIES="" - # INSTALL_HOLE="false" - - # # pin dependencies for legacy: - # # - ensure that chemfiles can get the last netcdf4 that is still supported - # # see https://github.com/MDAnalysis/mdanalysis/pull/2798#issuecomment-679991785 - # # - install chemfiles and chemfiles-lib via pip (conda times out) - # - env: NAME="python 2.7" - # PYTHON_VERSION=2.7 - # CODECOV="true" - # NUMPY_VERSION=1.16 - # CONDA_DEPENDENCIES="${CONDA_STANDARD_DEPENDENCIES}" - # SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" - # PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0 chemfiles" - - # - env: NAME="asv check" - # PYTHON_VERSION=2.7 - # CODECOV="false" - # MAIN_CMD="" - # SETUP_CMD="" - # NUMPY_VERSION=1.16 - # PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0" - # ASV_CHECK="true" - - # - env: NAME="pypi check" - # PYTHON_VERSION=3.7 - # CODECOV="false" - # MAIN_CMD="cd package && python setup.py" - # SETUP_CMD="sdist" - # BUILD_CMD="" - # INSTALL_HOLE="false" - # CONDA_DEPENDENCIES="setuptools cython twine" - # PYPI_CHECK="true" - - # - os: osx - # env: PYTHON_VERSION=3.6 - # NUMPY_VERSION=1.17.3 - - # - env: NAME='minimal' - # PIP_DEPENDENCIES="" - # CONDA_DEPENDENCIES=${CONDA_MIN_DEPENDENCIES} - # INSTALL_HOLE="false" - # CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" + - env: NAME="Lint" + PYLINTRC="${TRAVIS_BUILD_DIR}/package/.pylintrc" + MAIN_CMD="pylint --py3k package/MDAnalysis && pylint --py3k testsuite/MDAnalysisTests" + SETUP_CMD="" + BUILD_CMD="" + CONDA_DEPENDENCIES="" + INSTALL_HOLE="false" + + - env: NAME="asv check" + PYTHON_VERSION=3.6 + CODECOV="false" + MAIN_CMD="" + SETUP_CMD="" + PIP_DEPENDENCIES="${PIP_DEPENDENCIES} setuptools<45.0.0" + ASV_CHECK="true" + + - env: NAME="pypi check" + PYTHON_VERSION=3.7 + CODECOV="false" + MAIN_CMD="cd package && python setup.py" + SETUP_CMD="sdist" + BUILD_CMD="" + INSTALL_HOLE="false" + CONDA_DEPENDENCIES="setuptools cython twine" + PYPI_CHECK="true" + + - os: osx + env: PYTHON_VERSION=3.6 + NUMPY_VERSION=1.17.3 + + - env: NAME='minimal' + PIP_DEPENDENCIES="" + CONDA_DEPENDENCIES=${CONDA_MIN_DEPENDENCIES} + INSTALL_HOLE="false" + CODECOV="true" SETUP_CMD="${PYTEST_FLAGS} --cov=MDAnalysis" allow_failures: - env: NUMPY_VERSION=dev EVENT_TYPE="cron" @@ -168,12 +154,11 @@ after_success: # turn off blocking as it causes large writes to stdout to fail # (see https://github.com/travis-ci/travis-ci/issues/4704) - | - if [[ ${BUILD_DOCS} == "true" ]] ; then + if [[ ${TRAVIS_PULL_REQUEST} == "false" ]] && [[ ${BUILD_DOCS} == "true" ]] ; then python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);' cd ${TRAVIS_BUILD_DIR}/package/MDAnalysis export GH_DOC_BRANCH=${TRAVIS_BRANCH} export VERSION=$(python -c "import version; print(version.__version__)") - export GH_TOKEN=$GH_TOKEN cd - bash ${TRAVIS_BUILD_DIR}/maintainer/deploy_docs_via_travis.sh; fi diff --git a/maintainer/deploy_docs_via_travis.sh b/maintainer/deploy_docs_via_travis.sh index d2380199de7..7c36560bc6f 100644 --- a/maintainer/deploy_docs_via_travis.sh +++ b/maintainer/deploy_docs_via_travis.sh @@ -55,7 +55,7 @@ git reset upstream/gh-pages # for dev, latest, home redirects mkdir latest -export URL="https://minium.com.au/mdanalysis" +export URL="https://docs.mdanalysis.org" python ${MAINTAIN_DIR}/update_json_stubs_sitemap.py touch . touch .nojekyll @@ -70,8 +70,6 @@ done git add *.xml *.html -ls * - # check for anything to commit # https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes git diff-index --quiet HEAD -- || git commit -m "rebuilt html docs for version ${VERSION} from branch ${GH_DOC_BRANCH} with sphinx at ${rev}" diff --git a/package/doc/sphinx/source/conf.py b/package/doc/sphinx/source/conf.py index 8d1030e4cd4..35e01de1ff6 100644 --- a/package/doc/sphinx/source/conf.py +++ b/package/doc/sphinx/source/conf.py @@ -49,7 +49,7 @@ # they are now at docs.mdanalysis.org/, which requires a CNAME DNS record # pointing to mdanalysis.github.io. To change this URL you should change/delete # the CNAME record for "docs" and update the URL in GitHub settings -site_url = "https://minium.com.au/mdanalysis" +site_url = "https://docs.mdanalysis.org/" # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -161,7 +161,7 @@ } html_context = { - 'versions_json_url': 'https://minium.com.au/mdanalysis/versions.json' + 'versions_json_url': 'https://docs.mdanalysis.org/versions.json' } # Add any paths that contain custom themes here, relative to this directory. From d3fe05a228fbd51a2dd33abc24a24456e4d893b7 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Sun, 4 Oct 2020 16:22:59 +1100 Subject: [PATCH 4/5] pep8 --- maintainer/update_json_stubs_sitemap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainer/update_json_stubs_sitemap.py b/maintainer/update_json_stubs_sitemap.py index 2ac88f62f71..59384a2b1e1 100644 --- a/maintainer/update_json_stubs_sitemap.py +++ b/maintainer/update_json_stubs_sitemap.py @@ -132,7 +132,7 @@ def write_redirect(file, version='', outfile=None): raise write_redirect(file, '', outfile) - + if latest_version: From 2a7f38bb49e0ff8f3c936d91767de42d9e4a4695 Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Mon, 5 Oct 2020 17:38:30 +1100 Subject: [PATCH 5/5] add comments --- maintainer/deploy_docs_via_travis.sh | 6 +++++- maintainer/update_json_stubs_sitemap.py | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/maintainer/deploy_docs_via_travis.sh b/maintainer/deploy_docs_via_travis.sh index 7c36560bc6f..52c613e6b89 100644 --- a/maintainer/deploy_docs_via_travis.sh +++ b/maintainer/deploy_docs_via_travis.sh @@ -53,7 +53,11 @@ git remote add upstream "https://${GH_TOKEN}@${GH_REPOSITORY}" git fetch --depth 50 upstream ${GH_DOC_BRANCH} gh-pages git reset upstream/gh-pages -# for dev, latest, home redirects +# === REDIRECTS AND COPIES ==== +# home (index.html) redirects to stable/ +# latest (latest/index.html) redirects to most recent release +# dev/ is a copy of the dev docs with the highest number (so 2.0.0-dev instead of 1.0.1-dev) +# stable/ is a copy of the release docs with the highest number mkdir latest export URL="https://docs.mdanalysis.org" python ${MAINTAIN_DIR}/update_json_stubs_sitemap.py diff --git a/maintainer/update_json_stubs_sitemap.py b/maintainer/update_json_stubs_sitemap.py index 59384a2b1e1..b0c493e5f4e 100644 --- a/maintainer/update_json_stubs_sitemap.py +++ b/maintainer/update_json_stubs_sitemap.py @@ -111,17 +111,20 @@ def write_redirect(file, version='', outfile=None): versions.sort(key=lambda x: x["version"]) -# ========= WRITE HTML STUBS ========= +# ========= WRITE HTML STUBS AND COPY DOCS ========= # Add HTML files to redirect: -# index.html -> latest release -# latest/index.html -> latest release -# dev/index.html -> dev docs +# index.html -> stable/ docs +# latest/index.html -> latest release (not dev docs) +# stable/ : a copy of the release docs with the highest number (2.0.0 instead of 1.0.0) +# dev/ : a copy of the develop docs with the highest number (2.0.0-dev instead of 1.0.1-dev) if latest: shutil.copytree(VERSION, "stable") print(f"Copied {VERSION} to stable/") html_files = glob.glob(f'stable/**/*.html', recursive=True) for file in html_files: + # below should be true because we only globbed stable/* paths + assert file.startswith("stable/") outfile = file[7:] # strip "stable/" dirname = os.path.dirname(outfile) if dirname and not os.path.exists(dirname):