| 1 |
# |
| 2 |
# KIM-API: An API for interatomic models |
| 3 |
# Copyright (c) 2013--2022, Regents of the University of Minnesota. |
| 4 |
# All rights reserved. |
| 5 |
# |
| 6 |
# Contributors: |
| 7 |
# Ryan S. Elliott |
| 8 |
# |
| 9 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 10 |
# |
| 11 |
# This library is free software; you can redistribute it and/or |
| 12 |
# modify it under the terms of the GNU Lesser General Public |
| 13 |
# License as published by the Free Software Foundation; either |
| 14 |
# version 2.1 of the License, or (at your option) any later version. |
| 15 |
# |
| 16 |
# This library is distributed in the hope that it will be useful, |
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 |
# Lesser General Public License for more details. |
| 20 |
# |
| 21 |
# You should have received a copy of the GNU Lesser General Public License |
| 22 |
# along with this library; if not, write to the Free Software Foundation, |
| 23 |
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 24 |
# |
| 25 |
|
| 26 |
# |
| 27 |
# Release: This file is part of the kim-api.git repository. |
| 28 |
# |
| 29 |
|
| 30 |
import subprocess |
| 31 |
import shutil |
| 32 |
|
| 33 |
analyticsScript = '''\ |
| 34 |
<!-- Global site tag (gtag.js) - Google Analytics --> |
| 35 |
<script async |
| 36 |
src="https://www.googletagmanager.com/gtag/js?id=G-HT7Y2LG7BB"></script> |
| 37 |
<script> |
| 38 |
window.dataLayer = window.dataLayer || []; |
| 39 |
function gtag(){dataLayer.push(arguments);} |
| 40 |
gtag('js', new Date()); |
| 41 |
gtag('config', 'G-HT7Y2LG7BB'); |
| 42 |
</script> |
| 43 |
''' |
| 44 |
|
| 45 |
script=open('script.html', 'w') |
| 46 |
script.write(analyticsScript) |
| 47 |
script.close() |
| 48 |
|
| 49 |
subprocess.call('conda install -y cmake', shell=True) |
| 50 |
subprocess.call('conda env export -n root', shell=True) |
| 51 |
subprocess.call('doxygen -w html orig_header.html orig_footer.html orig_stylesheet.css', shell=True) |
| 52 |
subprocess.call('cat script.html orig_footer.html > footer.html', shell=True) |
| 53 |
subprocess.call('rm -rf build; mkdir build; cd build; FC=true cmake ../../../ -DREADTHEDOCS=ON; make docs', shell=True) |
| 54 |
html_extra_path = ['./build/docs/html'] |
| 55 |
|
| 56 |
|
| 57 |
### Sphinx keep overwriting the index.html |
| 58 |
### This will keep a kopy of the original html file, and restore it in the end |
| 59 |
|
| 60 |
# ------------------------------------------------------- |
| 61 |
shutil.copy(html_extra_path[0] + "/index.html", html_extra_path[0] + "/index.html_bak") |
| 62 |
|
| 63 |
def restore_index_html(app, exception): |
| 64 |
sphinx_output_path = app.outdir |
| 65 |
shutil.copy(html_extra_path[0] + "/index.html_bak", f"{sphinx_output_path}/index.html") |
| 66 |
|
| 67 |
def setup(app): |
| 68 |
app.connect("build-finished", restore_index_html) |
| 69 |
|
| 70 |
# ---------------------------------------------------------- |
| 71 |
|
| 72 |
################################################################################ |
| 73 |
|
| 74 |
project = u'kim-api' |
| 75 |
author = u'Ryan S. Elliott' |
| 76 |
|
| 77 |
# The suffix(es) of source filenames. |
| 78 |
source_suffix = '.rst' |
| 79 |
|
| 80 |
# The master toctree document. |
| 81 |
master_doc = 'index' |
| 82 |
|
| 83 |
# The language for content autogenerated by Sphinx. |
| 84 |
language = None |
| 85 |
|
| 86 |
# List of patterns, relative to source directory, that match files and |
| 87 |
# directories to ignore when looking for source files. |
| 88 |
# This pattern also affects html_static_path and html_extra_path. |
| 89 |
exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] |
| 90 |
|
| 91 |
# The name of the Pygments (syntax highlighting) style to use. |
| 92 |
pygments_style = None |
| 93 |
|
| 94 |
|