aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-07-01 18:12:44 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2020-07-01 18:12:44 +0300
commit14cc2efcfef9a404498b3532ffa8130cc092f6f6 (patch)
treeae2cdf743848d7bbc31cdb670e8d2b23a5e34cfe /tools
parent64f36613ef5d54de9d2040da60b225c1ef11140d (diff)
downloadmeson-14cc2efcfef9a404498b3532ffa8130cc092f6f6.zip
meson-14cc2efcfef9a404498b3532ffa8130cc092f6f6.tar.gz
meson-14cc2efcfef9a404498b3532ffa8130cc092f6f6.tar.bz2
Store website build script. [skip ci]
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build_website.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/build_website.py b/tools/build_website.py
new file mode 100755
index 0000000..5486b69
--- /dev/null
+++ b/tools/build_website.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python3
+
+import os, sys, subprocess, shutil
+
+assert(os.getcwd() == '/home/jpakkane')
+
+from glob import glob
+
+def purge(fname):
+ if not os.path.exists(fname):
+ return
+ if os.path.isdir(fname):
+ shutil.rmtree(fname)
+ os.unlink(fname)
+
+def update():
+ webdir = 'mesonweb'
+ repodir = 'mesonwebbuild'
+ docdir = os.path.join(repodir, 'docs')
+ builddir = os.path.join(docdir, 'builddir')
+ htmldir = os.path.join(builddir, 'Meson documentation-doc/html')
+# subprocess.check_call(['git', 'pull'], cwd=webdir)
+ subprocess.check_call(['git', 'fetch', '-a'], cwd=repodir)
+ subprocess.check_call(['git', 'reset', '--hard', 'origin/master'],
+ cwd=repodir)
+ if os.path.isdir(htmldir):
+ shutil.rmtree(htmldir)
+ if os.path.isdir(builddir):
+ shutil.rmtree(builddir)
+ env = os.environ.copy()
+ env['PATH'] = env['PATH'] + ':/home/jpakkane/.local/bin'
+ subprocess.check_call(['../meson.py', '.', 'builddir'], cwd=docdir, env=env)
+ subprocess.check_call(['ninja'], cwd=builddir)
+ old_files = glob(os.path.join(webdir, '*'))
+ for f in old_files:
+ base = f[len(webdir)+1:]
+ if base == 'CNAME' or base == 'favicon.png':
+ continue
+ subprocess.check_call(['git', 'rm', '-rf', base], cwd=webdir)
+ assert(os.path.isdir(webdir))
+ new_entries = glob(os.path.join(htmldir, '*'))
+ for e in new_entries:
+ shutil.move(e, webdir)
+ subprocess.check_call('git add *', shell=True, cwd=webdir)
+ subprocess.check_call(['git', 'commit', '-a', '-m', 'Bleep. Bloop. I am a bot.'],
+ cwd=webdir)
+ subprocess.check_call(['git', 'push'], cwd=webdir)
+ shutil.rmtree(builddir)
+
+if __name__ == '__main__':
+ update()