Skip to content

Instantly share code, notes, and snippets.

@kamitchell
Created April 28, 2013 17:53
Show Gist options
  • Save kamitchell/5477735 to your computer and use it in GitHub Desktop.
Save kamitchell/5477735 to your computer and use it in GitHub Desktop.
Example Nikola script generated by Buildout 2.1.0. Note that the __future__ import is stranded in the middle of the file.
#!/usr/bin/python
import sys
sys.path[0:0] = [
'/Users/kevin/src/nblog/eggs/Nikola-5.4.4-py2.7.egg',
'/Users/kevin/src/nblog/eggs/Markdown-2.3.1-py2.7.egg',
'/Users/kevin/src/nblog/eggs/configparser-3.3.0r2-py2.7.egg',
'/Users/kevin/src/nblog/eggs/pytz-2013b-py2.7.egg',
'/Users/kevin/src/nblog/eggs/PyRSS2Gen-1.1-py2.7.egg',
'/Users/kevin/src/nblog/eggs/Yapsy-1.9.2-py2.7.egg',
'/Users/kevin/src/nblog/eggs/lxml-3.1.2-py2.7-macosx-10.8-intel.egg',
'/Users/kevin/src/nblog/eggs/Unidecode-0.04.12-py2.7.egg',
'/Users/kevin/src/nblog/eggs/Mako-0.8.0-py2.7.egg',
'/Users/kevin/src/nblog/eggs/docutils-0.10-py2.7.egg',
'/Users/kevin/src/nblog/eggs/Pillow-2.0.0-py2.7-macosx-10.8-intel.egg',
'/Users/kevin/src/nblog/eggs/Pygments-1.6-py2.7.egg',
'/Users/kevin/src/nblog/eggs/doit-0.20.0-py2.7.egg',
'/Users/kevin/src/nblog/eggs/MarkupSafe-0.15-py2.7-macosx-10.8-intel.egg',
'/Users/kevin/src/nblog/eggs/MacFSEvents-0.3-py2.7-macosx-10.8-intel.egg',
]
"""Nikola main script."""
from __future__ import print_function
import os
import sys
# LIBDIR trick start (marker for removal on platforms that don't need it)
libdir = '@LIBDIR@'
# Two cases:
if libdir != '@' 'LIBDIR' '@':
# Changed by our distutils hook, then use the given path.
if not os.path.isabs(libdir):
libdir = os.path.join(os.path.dirname(
os.path.realpath(__file__)), libdir)
libdir = os.path.abspath(libdir)
else:
# Unchanged, running from checkout,
# use the parent directory, the nikola package ought be there.
libdir = os.path.join(os.path.dirname(__file__), "..")
sys.path.insert(0, libdir)
if "PYTHONPATH" not in os.environ:
os.environ["PYTHONPATH"] = libdir
else:
os.environ["PYTHONPATH"] = os.environ["PYTHONPATH"] + ":" + libdir
# LIBDIR trick end (marker for removal on platforms that don't need it)
from nikola import main
if __name__ == "__main__":
sys.exit(main.main(sys.argv[1:]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment