Commits

Anonymous committed 60e20db

Improved posix installation by providing a configure script that generates a Makefile to invoke the installer.

Comments (0)

Files changed (5)

 ^zine/plugins/.*?/docs/.*?\.page$
 .coverage
 ^docs/_build/
+^Makefile$
+.PHONY: install uninstall
+
+PREFIX=%(PREFIX)s
+PYTHON=%(PYTHON)s
+
+# All is a no-op, we don't need compilation
+all:
+
+install:
+	@(PREFIX=$(PREFIX) PYTHON=$(PYTHON) ./scripts/install-posix)
+
+uninstall:
+	@(PREFIX=$(PREFIX) ./scripts/uninstall-posix)
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+    Configure
+    ~~~~~~~~~
+
+    Simple configure script that creates a makefile.
+
+    :copyright: 2008 by Armin Ronacher.
+    :license: BSD, see LICENSE for more details.
+"""
+import os
+import sys
+from optparse import OptionParser
+
+
+def main():
+    global parser
+    parser = OptionParser(usage='%prog')
+    parser.add_option('--prefix', dest='prefix', default='/usr/local',
+                      help='install architecture-independent files in PREFIX '
+                           '[/usr/local]')
+    parser.add_option('--python', dest='python', default=sys.executable,
+                      help='the python version to use for the installation')
+    options, args = parser.parse_args()
+
+    if args:
+        parser.error('too many arguments')
+
+    f = file('Makefile.in')
+    try:
+        makefile_in = f.read()
+    finally:
+        f.close()
+    f = file('Makefile', 'w')
+    try:
+        f.write(makefile_in % {
+            'PYTHON':       options.python,
+            'PREFIX':       os.path.abspath(options.prefix)
+        })
+    finally:
+        f.close()
+    print 'Generated Makefile'
+    print 'type "make install" to install Zine'
+
+
+if __name__ == '__main__':
+    os.chdir(os.path.dirname(__file__) or '.')
+    main()

scripts/install-posix

 # files with PYTHON.  If PREFIX is not defined /usr is assumed.
 
 SRC="`dirname $0`/../zine"
-PACKAGES="_dynamic _ext importers parsers utils views websetup i18n"
+PACKAGES="_dynamic _ext importers utils views websetup i18n docs"
 
 if [ x$PREFIX == x ]; then
   PREFIX=/usr
 done
 
 # all the plugins
-cp -R $SRC/{experimental_,}plugins $PREFIX/lib/zine
+cp -R $SRC/plugins $PREFIX/lib/zine
 
 # compile all files
 $PYTHON -O -mcompileall -qf $PREFIX/lib/zine/{zine,plugins}
 
 # copy the server files and adjust the ZINE_LIB path
 cp -R $SRC/../servers $PREFIX/share/zine
-sed -i'' -r "s|^ZINE_LIB\s*=.*$|ZINE_LIB = '$PREFIX/lib/zine'|g" $PREFIX/share/zine/servers/*
+sed -i '' -E -e "s|^ZINE_LIB =.*$|ZINE_LIB = '$PREFIX/lib/zine'|g" \
+    -e "s|^#!/usr/bin/python|#!$PYTHON|g" $PREFIX/share/zine/servers/*
 
 
 echo "All done."
     """This is called from the websetup which explains why it takes an engine
     and not a zine application.
     """
+    # XXX: consider using something like this for mysql:
+    #   cx = engine.connect()
+    #   cx.execute('set storage_engine=innodb')
+    #   metadata.create_all(cx)
     metadata.create_all(engine)