changeset 1597:bbe187af4fc0

integrated MMDE (build scripts need more work)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 02 Oct 2006 15:46:27 +0200
parents 706de8a16147
children dec11b291ba5
files MoinMoin/config/multiconfig.py MoinMoin/user.py contrib/DesktopEdition/package_desktop.cmd contrib/DesktopEdition/setup_py2exe.py contrib/DesktopEdition/wikiconfig.py wiki/server/moin.py
diffstat 6 files changed, 316 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Mon Oct 02 00:38:07 2006 +0200
+++ b/MoinMoin/config/multiconfig.py	Mon Oct 02 15:46:27 2006 +0200
@@ -183,6 +183,9 @@
 class DefaultConfig:
     """ default config values """
 
+    # setting DesktopEdition = True gives all local users special powers - ONLY use for MMDE style usage!
+    DesktopEdition = False
+
     # All acl_rights_* lines must use unicode!
     acl_rights_default = u"Trusted:read,write,delete,revert Known:read,write,delete,revert All:read,write"
     acl_rights_before = u""
--- a/MoinMoin/user.py	Mon Oct 02 00:38:07 2006 +0200
+++ b/MoinMoin/user.py	Mon Oct 02 15:46:27 2006 +0200
@@ -890,7 +890,11 @@
         return self._request.user.name == self.name
 
     def isSuperUser(self):
-        superusers = self._request.cfg.superuser
+        request = self._request
+        if request.cfg.DesktopEdition and request.remote_addr == '127.0.0.1':
+            # the DesktopEdition gives any local user superuser powers
+            return True
+        superusers = request.cfg.superuser
         assert isinstance(superusers, (list, tuple))
         return self.valid and self.name and self.name in superusers
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/DesktopEdition/package_desktop.cmd	Mon Oct 02 15:46:27 2006 +0200
@@ -0,0 +1,139 @@
+@echo off
+rem ToDo:
+rem Fix for 1.6
+rem Translate to English
+rem setup.py, welches die configvariablen abfragt und in sich selbst speichert, browserstartoption
+rem bugs fixen (siehe lokales wiki)
+rem HowToBuild aktualisieren
+
+set version=Release 1.6.0dev-1
+set buildfile=moin-desktop-1.6.0dev-1
+
+rem MoinMoin Quelle
+set build=moin--main--1.6
+rem set build=z:\root\moin--main--1.3
+
+set sevenzippath=C:\Programme\7-Zip\7z
+
+echo Building DesktopEdition %version% ...
+
+if exist %build% (
+	if exist moin-desktop (
+		del /Q /F /S moin-desktop >NUL 2>NUL
+		rmdir /S /Q moin-desktop
+	)
+	echo Creating page packages ...
+	cd %build%
+	make pagepacks
+	cd ..
+	
+	echo Creating base system ...
+	md moin-desktop
+	xcopy /E /I /Q "%build%\MoinMoin" "moin-desktop\MoinMoin"
+	xcopy /E /I /Q "%build%\wiki" "moin-desktop\wiki"
+	xcopy /E /I /Q /Y "_underlay\*" "moin-desktop\wiki\underlay\pages\"
+	md moin-desktop\docs
+	sed -n "/MoinMoin Version History/,/default options for new users are same/p" <"%build%\docs\CHANGES">"moin-desktop\docs\CHANGES"
+	xcopy /I /Q "%build%\docs\licenses\COPYING" "moin-desktop\docs"
+	xcopy /I /Q "%build%\README" "moin-desktop\docs\"
+	copy _resources\moin.py moin-desktop\	>NUL
+	copy _resources\wikiconfig.py moin-desktop\	>NUL
+	copy _resources\ImageLink.py moin-desktop\wiki\data\plugin\macro\ >NUL
+	copy "_resources\MoinMoin DesktopEdition.url" moin-desktop\	>NUL
+	del /Q /F /S moin-desktop\.cvsignore>NUL
+	del /Q /F /S moin-desktop\CVS>NUL
+	del /Q /F moin-desktop\MoinMoin\i18n\*.po>NUL
+	del moin-desktop\wiki\underlay\pages\SystemPagesSetup\attachments\extra.zip >NUL
+	del moin-desktop\MoinMoin\_template.py>NUL
+	del moin-desktop\wiki\data\edit-log>NUL
+	del moin-desktop\wiki\README.underlay>NUL
+	del moin-desktop\wiki\underlay.tar.bz2>NUL
+	del moin-desktop\wiki\htdocs\index.html>NUL
+	del moin-desktop\wiki\htdocs\applets\index.html>NUL
+	
+	rd /Q /S moin-desktop\wiki\config\>NUL
+	rd /Q /S moin-desktop\wiki\server\>NUL
+	rd /Q /S moin-desktop\wiki\htdocs\applets\FCKeditor\_samples>NUL 2>NUL
+	rd /Q /S moin-desktop\wiki\htdocs\applets\FCKeditor\_testcases>NUL 2>NUL
+	del moin-desktop\wiki\htdocs\applets\FCKeditor\_documentation.html>NUL
+	del moin-desktop\wiki\htdocs\applets\FCKeditor\_whatsnew.html>NUL
+	del moin-desktop\wiki\htdocs\applets\FCKeditor\license.txt>NUL
+	
+	echo MoinMoin DesktopEdition - packaged by AlexanderSchremmer> moin-desktop\readme_desktop.txt
+	echo licensed under GNU GPL, see COPYING>> moin-desktop\readme_desktop.txt
+	echo %version%, see the page SystemInfo for exact revision>> moin-desktop\readme_desktop.txt
+	echo.>> moin-desktop\readme_desktop.txt
+	echo See http://moinmoin.wikiwikiweb.de/DesktopEdition for current information.>> moin-desktop\readme_desktop.txt
+	echo.>> moin-desktop\readme_desktop.txt
+	echo MoinMoin needs Python in order to run. You can download it here: http://www.python.org/download/>> moin-desktop\readme_desktop.txt
+	echo Python 2.4.2 is recommended, Python 2.3 is required. Nothing else is needed.>> moin-desktop\readme_desktop.txt
+	echo.>> moin-desktop\readme_desktop.txt
+	echo In order to start MoinMoin DesktopEdition, just run moin.py>> moin-desktop\readme_desktop.txt
+	echo and point your web browser to http://localhost:8080/>> moin-desktop\readme_desktop.txt
+
+	echo.>> moin-desktop\readme_desktop.txt
+	echo This build includes the following patches against the official release/tree:>> moin-desktop\readme_desktop.txt
+	echo.>> moin-desktop\readme_desktop.txt
+	echo patchlevel += "; DesktopEdition %version%">>moin-desktop\MoinMoin\patchlevel.py
+
+	for %%i in (_patches\*.patch) do (
+		cd moin-desktop
+		echo Applying %%i ...
+		patch -ENp 1 < ..\%%i
+		sed q < ..\%%i >> readme_desktop.txt
+		cd ..
+	)
+	if not exist _patches\*.patch echo * None>>moin-desktop\readme_desktop.txt
+	del /Q /F /S moin-desktop\*.orig>NUL 2>NUL
+
+
+	del /Q /F /S moin-desktop\*.pyc>NUL 2>NUL
+
+if exist %buildfile%.tbz del %buildfile%.tbz 
+if exist %buildfile%.zip del %buildfile%.zip
+if exist %buildfile%.exe del %buildfile%.exe
+echo Finished base build.
+echo.
+echo Press CTRL+C if you do not want to have any archives.
+echo Otherwise:
+pause
+
+echo Creating archives ...
+
+echo ZIP
+%sevenzippath% a -r -tzip -mx=9 %buildfile%.zip moin-desktop\*
+
+echo TBZ
+tar cjf %buildfile%.tbz moin-desktop
+
+echo Py2EXE
+	rem http://starship.python.net/crew/theller/moin.cgi/ExcludingDlls
+	cd moin-desktop
+	if not exist ..\setup_pyexe.py echo ERROR! setup_pyexe.py not found!
+	if exist build\NUL del /Q /F /S build
+	if exist dist\NUL del /Q /F /S dist
+	python ..\setup_pyexe.py py2exe -x -a
+	pause
+	del dist\w9xpopen.exe
+	rem C:\UTIL\#archiv\upx\upx --best --force dist\_socket.pyd dist\moin.exe
+	dir dist
+
+move dist MMDE
+move wikiconfig.py MMDE
+move docs MMDE\docs
+move "MoinMoin DesktopEdition.url" MMDE
+move readme_desktop.txt MMDE
+move wiki MMDE\wiki
+
+echo 7z,EXE
+%sevenzippath% a -r -t7z -sfx7z.sfx -mx=7 ..\%buildfile%.exe MMDE\*
+cd ..
+
+
+echo Created archives.
+
+) ELSE (
+	echo %build% was not found!
+)
+pause
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/DesktopEdition/setup_py2exe.py	Mon Oct 02 15:46:27 2006 +0200
@@ -0,0 +1,88 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - <short description>
+
+    <what this stuff does ... - verbose enough>
+
+    @copyright: 2006 by MoinMoin:YourNameHere 
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from distutils.core import setup
+import py2exe
+
+setup(
+    version = "1.6.0.0",
+    description = "MMDE is a wiki suitable for desktop use",
+    name = "MoinMoin DesktopEdition",
+
+    # targets to build
+    console = [{
+        "script": "moin.py",
+        "icon_resources": [(1, r"..\moin--main--1.6\wiki\htdocs\favicon.ico")],
+            }],
+    zipfile = r"pylib",
+    options = {
+        "py2exe": {
+            'bundle_files': 2,
+            "excludes": ["Tkconstants","Tkinter","tcl", "popen2", "gzip", "gdchart", "mod_python", "_pybsddb",
+                         "dbhash", # do not support hashed spellchecker dictionaries
+                         "_ssl", # do not support SSL connections
+                         "smtplib", 'email.MIMEText', # do not support mails
+                         "select", "tty", # just used by pydoc
+                         "os2emxpath", #used by os
+                         "doctest", # called by test code
+                         "MoinMoin.i18n.check_i18n",
+                         "teud", "xapian",
+                         'Ft.Lib', 'Ft.Xml', 'Ft.Xml.Xslt.Processor', "Ft",
+                         #"xml",
+                         'Image', 'xml.parsers','xml.sax', 'xml.xslt.Processor',
+                         "cookielib", # added because of rst/urllib2
+"wikiconfig", # we will supply it manually
+"hotshot",
+"stringprep", "encodings.idna",
+
+                         ],
+            "optimize": 2,
+            "includes": ['encodings', 'encodings.iso8859_1', 'encodings.utf_8', 'encodings.ascii', 'encodings.utf_16_be', 'encodings.latin_1', 'encodings.iso8859_15', 'encodings.cp437',
+                         'email.Utils',
+                         'MoinMoin.action.*', 'MoinMoin.formatter.*', 'MoinMoin.macro.*', 'MoinMoin.parser.*', 'MoinMoin.theme.*',
+                         'xml.dom', 'xml.dom.minidom',
+                         'docutils.readers.standalone',
+                         'docutils.languages.en',
+                         'docutils.parsers.rst.directives.*',
+                         'docutils.parsers.rst.directives.admonitions',
+'docutils.parsers.rst.directives.body',
+'docutils.parsers.rst.directives.html',
+'docutils.parsers.rst.directives.images',
+'docutils.parsers.rst.directives.parts',
+'docutils.parsers.rst.directives.references',
+"MoinMoin.i18n.zh_tw",
+"MoinMoin.i18n.zh",
+"MoinMoin.i18n.vi",
+"MoinMoin.i18n.sr",
+"MoinMoin.i18n.ru",
+"MoinMoin.i18n.nl",
+"MoinMoin.i18n.nb",
+"MoinMoin.i18n.meta",
+"MoinMoin.i18n.ko",
+"MoinMoin.i18n.ja",
+"MoinMoin.i18n.it",
+"MoinMoin.i18n.hu",
+"MoinMoin.i18n.he",
+"MoinMoin.i18n.fr",
+"MoinMoin.i18n.es",
+"MoinMoin.i18n.en",
+"MoinMoin.i18n.de",
+"MoinMoin.i18n.da",
+"MoinMoin.i18n.__init__",
+],
+            "dll_excludes": ["w9xpopen.exe", # we dont use popen
+                             "bz2.pyd",
+"unicodedata.pyd",
+
+                             ],
+        }
+    }
+    )
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/DesktopEdition/wikiconfig.py	Mon Oct 02 15:46:27 2006 +0200
@@ -0,0 +1,27 @@
+# -*- coding: iso-8859-1 -*-
+"""MoinMoin Desktop Edition (MMDE) - Configuration
+
+ONLY to be used for MMDE - if you run a personal wiki on your notebook or PC.
+
+This is NOT intended for internet or server or multiuser use due to relaxed security settings!
+"""
+
+from MoinMoin.multiconfig import DefaultConfig
+
+class Config(DefaultConfig):
+    # vvv DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO vvv
+    moinmoin_dir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
+    data_dir = os.path.join(moinmoin_dir, 'wiki', 'data')
+    data_underlay_dir = os.path.join(moinmoin_dir, 'wiki', 'underlay')
+
+    DesktopEdition = True # give all local users full powers
+    acl_rights_default = u"All:read,write,delete,revert,admin"
+    sitename = u'MoinMoin DesktopEdition'
+    logo_string = u'<img src="/wiki/common/moinmoin.png" alt="MoinMoin Logo">'
+    page_front_page = u'FrontPage' # change to some better value
+    page_credits = [
+        '<a href="http://moinmoin.wikiwikiweb.de/">MoinMoin DesktopEdition Powered</a>',
+        '<a href="http://www.python.org/">Python Powered</a>',
+    ]
+    # ^^^ DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO ^^^
+
--- a/wiki/server/moin.py	Mon Oct 02 00:38:07 2006 +0200
+++ b/wiki/server/moin.py	Mon Oct 02 15:46:27 2006 +0200
@@ -2,30 +2,56 @@
 """
     Start script for the standalone Wiki server.
 
-    @copyright: 2004-2005 Thomas Waldmann, Nir Soffer
+    @copyright: 2004-2006 Thomas Waldmann, Nir Soffer, Alexander Schremmer
     @license: GNU GPL, see COPYING for details.
 """
 
-# System path configuration
+print "Loading ..."
 
-import sys
+import os, sys
+
+class PythonTooOldError:
+    pass
+
+try:
+    if sys.version_info[:3] < (2, 3, 0):
+        raise PythonTooOldError
+except:
+    sys.exit("Unfortunately, your installed Python is too old. Please download at "
+             "least Python 2.3.0 (Python 2.4.3 is recommended).\n\n"
+             "You can get Python here: http://www.python.org/download/")
+
+
+# We insert the path where THIS script is located into the python search path.
+# If your wikiconfig.py / farmconfig.py / etc. is located there, this is all
+# you'll need.
+moinpath = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
+sys.path.insert(0, moinpath)
 
 # Path of the directory where wikiconfig.py is located.
-# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
-sys.path.insert(0, '/path/to/wikiconfig')
+# YOU MAYBE NEED TO CHANGE THIS TO MATCH YOUR SETUP.
+#sys.path.insert(0, '/path/to/wikiconfig')
 
 # Path to MoinMoin package, needed if you installed with --prefix=PREFIX
 # or if you did not use setup.py.
-## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
+#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
 
 # Path of the directory where farmconfig is located (if different).
-## sys.path.insert(0, '/path/to/farmconfig')
+#sys.path.insert(0, '/path/to/farmconfig')
 
 # Debug mode - show detailed error reports
 ## import os
 ## os.environ['MOIN_DEBUG'] = '1'
 
 from MoinMoin.server.standalone import StandaloneConfig, run
+from MoinMoin.version import project, release, revision
+
+print "%s - %s [%s]" % (project, release, revision)
+
+if os.name == 'nt':
+    print
+    print "Just close this window to shutdown MoinMoin DesktopEdition."
+print
 
 
 class Config(StandaloneConfig):
@@ -36,7 +62,10 @@
 
     # Path to moin shared files (default '/usr/share/moin/wiki/htdocs')
     # If you installed with --prefix=PREFIX, use 'PREFIX/share/moin/wiki/htdocs'
-    docs = '/usr/share/moin/htdocs'
+    #docs = '/usr/share/moin/htdocs'
+    # If your wiki/ directory is below the moin.py command, you don't need to
+    # change this:
+    docs = os.path.join(moinpath, 'wiki', 'htdocs')
 
     # URL prefix for the static stuff (used to access stuff in docs) - you
     # usually should not need to change this because moin standalone uses
@@ -44,16 +73,15 @@
     #url_prefix_static = '/moin_static160'
 
     # The server will run with as this user and group (default 'www-data')
-    user = 'www-data'
-    group = 'www-data'
+    #user = 'www-data'
+    #group = 'www-data'
 
     # Port (default 8000)
-    # To serve privileged port under 1024 you will have to run as root.
-    port = 8000
+    # To serve privileged port under 1024 you will have to run as root
+    port = 8080
 
     # Interface (default 'localhost')
-    # The default will listen only to localhost.
-    # '' will listen to any interface
+    # '' - will listen to any interface
     interface = 'localhost'
 
     # Log (default commented)
@@ -72,21 +100,21 @@
     # If you set one of the threading servers and threads are not
     # available, the server will fallback to ForkingServer. If fork is
     # not available, the server will fallback to SimpleServer.
-    serverClass = 'ThreadPoolServer'
-    
+    #serverClass = 'ThreadPoolServer'
+
     # Thread limit (default 10)
     # Limit the number of threads created. Ignored on non threaded servers.
-    threadLimit = 10
+    #threadLimit = 10
 
     # Request queue size (default 50)
     # The size of the socket listen backlog.
-    requestQueueSize = 50
+    #requestQueueSize = 50
 
     # Properties
     # Allow overriding any request property by the value defined in
     # this dict e.g properties = {'script_name': '/mywiki'}.
-    properties = {}
-    
+    #properties = {}
+
     # Memory profile (default commented)
     # Useful only if you are a developer or interested in moin memory usage
     # A memory profile named 'moin--2004-09-27--01-24.log' is
@@ -99,6 +127,12 @@
     ## hotshotProfile = name + '.prof'
 
 
+try:
+    from wikiserverconfig import Config
+except ImportError:
+    Config = DefaultConfig
+
 if __name__ == '__main__':
+    # Run moin moin server:
     run(Config)