summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2015-07-08 07:35:02 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2015-07-08 07:35:02 -0300
commitb0b24795b24ee6809397fbbadf42f31f310a219f (patch)
tree46d05bb47460b4ec679211717c4ab07414b80d9c /scripts
parent5ec02211214350ee558fd9f6bb052264fd24f75e (diff)
Imported Upstream version 7.6.0upstream/7.6.0
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_conf.py9
-rwxr-xr-xscripts/getwheelhouse.sh2
-rwxr-xr-xscripts/github-release.py19
-rwxr-xr-xscripts/jinjify.py18
-rwxr-xr-xscripts/set_version.py16
-rwxr-xr-xscripts/update-bower.sh57
6 files changed, 111 insertions, 10 deletions
diff --git a/scripts/generate_conf.py b/scripts/generate_conf.py
new file mode 100755
index 0000000..37a3a94
--- /dev/null
+++ b/scripts/generate_conf.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+# Generate a conf.py file from the template, using default settings.
+
+import nikola.plugins.command.init
+
+try:
+ print(nikola.plugins.command.init.CommandInit.create_configuration_to_string())
+except:
+ print(nikola.plugins.command.init.CommandInit.create_configuration_to_string().encode('utf-8'))
diff --git a/scripts/getwheelhouse.sh b/scripts/getwheelhouse.sh
index 911ffbd..753fc2b 100755
--- a/scripts/getwheelhouse.sh
+++ b/scripts/getwheelhouse.sh
@@ -3,5 +3,7 @@ for i in $@; do
wget https://github.com/getnikola/wheelhouse/archive/v$i'.zip'
unzip 'v'$i'.zip'
pip install --use-wheel --no-index --find-links=wheelhouse-$i lxml Pillow ipython
+ # Install Markdown for Python 2.6.
+ pip install --use-wheel --no-index --find-links=wheelhouse-$i Markdown || true
rm -rf wheelhouse-$i 'v'$i'.zip'
done
diff --git a/scripts/github-release.py b/scripts/github-release.py
new file mode 100755
index 0000000..8280fda
--- /dev/null
+++ b/scripts/github-release.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+import subprocess
+import sys
+import os
+
+if not os.path.exists('.pypt/gh-token'):
+ print("To use this script, you must create a GitHub token first.")
+ print("Get a token here: https://github.com/settings/tokens")
+ print("Then, put it in a file named .pypt/gh-token")
+ exit(1)
+
+inpf = input if sys.version_info[0] == 3 else raw_input
+
+FILE = inpf("Markdown file to use: ")
+BASEDIR = os.getcwd()
+REPO = 'getnikola/nikola'
+TAG = inpf("Tag name (usually vX.Y.Z): ")
+
+subprocess.call(['.pypt/ghrel', FILE, BASEDIR, REPO, TAG])
diff --git a/scripts/jinjify.py b/scripts/jinjify.py
index be69731..30f8029 100755
--- a/scripts/jinjify.py
+++ b/scripts/jinjify.py
@@ -22,6 +22,7 @@ dumb_replacements = [
]
dumber_replacements = [
+ ['<%! import json %>\n\n', ''],
["<html\n\\", "<html\n"],
["\n'\\\n", "\n'\n"],
["{% endif %}\n\\", "{% endif %}\n"]
@@ -76,15 +77,18 @@ def jinjify(in_theme, out_theme):
if child in mappings:
parent = mappings[child]
- with open(os.path.join(out_theme, "parent"), "wb+") as outf:
- outf.write(parent + '\n')
+ with io.open(os.path.join(out_theme, "parent"), "w+", encoding='utf-8') as outf:
+ outf.write(u'{0}\n'.format(parent))
- with open(os.path.join(out_theme, "engine"), "wb+") as outf:
- outf.write("jinja\n")
+ with io.open(os.path.join(out_theme, "engine"), "w+", encoding='utf-8') as outf:
+ outf.write(u"jinja\n")
- # Copy assets
- # shutil.rmtree(os.path.join(out_theme, "assets"))
- # shutil.copytree(os.path.join(in_theme, "assets"), os.path.join(out_theme, "assets"))
+ # Copy assets in bootstrap/bootstrap3
+ if child in ('bootstrap-jinja', 'bootstrap3-jinja'):
+ shutil.rmtree(os.path.join(out_theme, "assets"))
+ shutil.copytree(
+ os.path.join(in_theme, "assets"), os.path.join(out_theme, "assets"),
+ symlinks=True)
# Copy bundles
# shutil.copy(os.path.join(in_theme, "bundles"), os.path.join(out_theme, "bundles"))
diff --git a/scripts/set_version.py b/scripts/set_version.py
index 6a64489..7e6c3e0 100755
--- a/scripts/set_version.py
+++ b/scripts/set_version.py
@@ -9,6 +9,8 @@ import os
import re
import sys
import glob
+import subprocess
+import io
def sed_like_thing(pattern, repl, path):
@@ -30,8 +32,16 @@ if __name__ == "__main__":
sed_like_thing(":Version: .*", ":Version: {0}".format(version), doc)
sed_like_thing("version='.+'", "version='{0}'".format(version), 'setup.py')
- sed_like_thing("version = '.+'", "version = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py'))
- sed_like_thing("release = '.+'", "release = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py'))
+ sed_like_thing("version = .*", "version = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py'))
+ sed_like_thing("release = .*", "release = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py'))
sed_like_thing('__version__ = ".*"', '__version__ = "{0}"'.format(version), os.path.join('nikola', '__init__.py'))
sed_like_thing('New in master', 'New in v{0}'.format(version), 'CHANGES.txt')
- os.system("help2man -h help -N --version-string='{0}' nikola > {1}".format(version, os.path.join('docs', 'man', 'nikola.1')))
+ sed_like_thing(':Version: .*', ':Version: Nikola v{0}'.format(version), os.path.join('docs', 'man', 'nikola.rst'))
+ man = subprocess.check_output(["rst2man", os.path.join('docs', 'man', 'nikola.rst')])
+ with io.open(os.path.join('docs', 'man', 'nikola.1'), 'w', encoding='utf-8') as fh:
+ try:
+ man = man.decode('utf-8')
+ except AttributeError:
+ pass
+ fh.write(man)
+ subprocess.call(["gzip", "-f", os.path.join('docs', 'man', 'nikola.1')])
diff --git a/scripts/update-bower.sh b/scripts/update-bower.sh
new file mode 100755
index 0000000..d077434
--- /dev/null
+++ b/scripts/update-bower.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# Update all bower packages
+bower update
+
+# Link bootstrap3 theme to bootstrap
+pushd nikola/data/themes/bootstrap3/assets/js/
+ln -sf ../../../../../../bower_components/bootstrap/dist/js/*js .
+rm npm.js
+git add .
+popd
+
+pushd nikola/data/themes/bootstrap3/assets/css/
+ln -sf ../../../../../../bower_components/bootstrap/dist/css/* .
+git add .
+popd
+
+pushd nikola/data/themes/bootstrap3/assets/fonts/
+ln -sf ../../../../../../bower_components/bootstrap/dist/fonts/* .
+git add .
+popd
+
+# Link moment.js to base theme
+pushd nikola/data/themes/base/assets/js
+ln -sf ../../../../../../bower_components/moment/min/moment-with-locales.min.js .
+git add moment-with-locales.min.js
+popd
+
+# Link jQuery to bootstrap theme
+pushd nikola/data/themes/bootstrap/assets/js
+ln -sf ../../../../../../bower_components/jquery/dist/* .
+git add .
+popd
+
+
+# Link colorbox into bootstrap theme
+pushd nikola/data/themes/bootstrap/assets/js
+ln -sf ../../../../../../bower_components/jquery-colorbox/jquery.colorbox.js .
+git add jquery.colorbox.js
+popd
+
+pushd nikola/data/themes/bootstrap/assets/js/colorbox-i18n
+ln -sf ../../../../../../../bower_components/jquery-colorbox/i18n/* .
+git add .
+popd
+
+pushd nikola/data/themes/bootstrap/assets/css/
+ln -sf ../../../../../../bower_components/jquery-colorbox/example3/colorbox.css .
+git add colorbox.css
+popd
+
+pushd nikola/data/themes/bootstrap/assets/css/images/
+ln -sf ../../../../../../../bower_components/jquery-colorbox/example3/images/* .
+git add .
+popd
+
+scripts/generate_symlinked_list.sh