# # # delete ".htaccess" # # patch "AUTHORS" # from [efc3dd1070798deb1fc2a2312204cc2f9faf00d4] # to [8d04d002de25e5b2befb3bad088b6da4b24b3470] # # patch "ChangeLog" # from [cbd1cfd71cca451ae75ac83a6315f783f1422de6] # to [1abb9ba9816cffc46d1e862c1092783b447bb48e] # # patch "INSTALL" # from [0733df65c4055cb30a766df4fdbc82ea1a1df412] # to [30d40cec7808ecda4f35315d2fa9764a7c71830f] # # patch "README" # from [5fa5a33cef3770ba09a216acc1659490712ba505] # to [51ea9bcf58e2383de5b13e36130946447ed07462] # # patch "authors.py" # from [0ed0661cf3ddf1b402a73dfc1ff0fccc64ad05f1] # to [ad0bc51aaca26a1595b56dc845b11da7f6ee4353] # # patch "common.py" # from [b5a9eb0d651eb4f1a41e94376d35b31f5c8efe5d] # to [39a5767f3123ff0819cf5dd20c8fffd2264ce328] # # patch "config.py.example" # from [a484f47e78d3b8aa4fcc875b44f1039220fb2837] # to [49e135fe5ecb78922ba027f1e68d7b55f040e37d] # # patch "fdo/xdgbasedir.py" # from [864ac96a21a2fe65c401a7beaf2c98513795751d] # to [6efff4cf0db2de43ca2801b9e89bdc7cc1c9b350] # # patch "genproxy.py" # from [408f46a3f5fe0d792eb62e92a8faaf5c28c67a54] # to [0b4728f487b54331d27276f09fe86a7b13ef07ce] # # patch "mtn.py" # from [0d4cebb009164df2416ea03172a37654f5c95f69] # to [be23fb4b716cb8a29ac4bf37981fe21a209c810f] # # patch "release.py" # from [456c957746d295e19427471ad9f0e94e1d80195e] # to [df0ab88561367dd15fff84282bf2699eeae86ee4] # # patch "release.sh" # from [1023631dc1b334d6460c18db73b74655744370da] # to [43e9d9753e5aa10695a21b9e2923237b805a3bad] # # patch "syntax.py" # from [cf93e6e6a6166204daaae6ec50819ba175fa3ed1] # to [b6b9a000432ab2854092f2f93cafad332fce24d4] # # patch "templates/about.html" # from [fea245cb17ab46a7766e03293800361db0b325b2] # to [309dd178a83ac76781efe00745d453d6e8dc0227] # # patch "utility.py" # from [78cd2c53af05e63bb76c097dc832b6f75394e40d] # to [93ac7b96f6909436af408f04446af4426fde207a] # # patch "viewmtn.py" # from [6f367b50c5e91faf4fc5405d7b9beb9f8092779d] # to [9f4b7cd096f5b356bb57935c61257d5369036508] # ============================================================ --- AUTHORS efc3dd1070798deb1fc2a2312204cc2f9faf00d4 +++ AUTHORS 8d04d002de25e5b2befb3bad088b6da4b24b3470 @@ -1,3 +1,4 @@ + Authors: Grahame Bowland @@ -7,4 +8,6 @@ David Reiss Bruce Stephens Lapo Luchini David Reiss +Matthias Radestock +Matthew Nicholson ============================================================ --- ChangeLog cbd1cfd71cca451ae75ac83a6315f783f1422de6 +++ ChangeLog 1abb9ba9816cffc46d1e862c1092783b447bb48e @@ -1,5 +1,23 @@ 2007-03-30 Grahame Bowland + * don't fail entirely if xdg_* can't be found; + add a new module option to fdo/xdgbasedir + determining whether exceptions should be raised, + or just silently ignored. + * work under Apache2! + * update INSTALL, README + * rename LICENSE to COPYING + * add AUTHORS credit to Matthias Radestock and + Matthew Nicholson + * add GNU GPL2 boilerplate to the top of all the + Python files. + * credit json.py in the about.html template + * remove cruft from config.py.example, update the + paths to be more sensible on a stock Debian/Redhat + machine. + +2007-03-30 Grahame Bowland + * upgrade to MochiKit development version (today's subversion trunk) to resolve issues with Opera and the elementPosition method. ============================================================ --- INSTALL 0733df65c4055cb30a766df4fdbc82ea1a1df412 +++ INSTALL 30d40cec7808ecda4f35315d2fa9764a7c71830f @@ -1,9 +1,11 @@ This document briefly describes what is Installing ViewMTN ------------------ This document briefly describes what is necessary to install ViewMTN -and configure a working installation. +and configure a working installation. If something goes awry and you +can't get ViewMTN to work, please feel free to contact me. See the +contact details in "README" Dependencies ------------ @@ -25,6 +27,13 @@ Version: flup-r2311.tar.gz is know to wo Flup: http://www.saddi.com/software/flup/dist/ Version: flup-r2311.tar.gz is know to work. +On a Debian machine, the following should give you what you need: + apt-get install python-flup python-cheetah python-graphviz gnome-icon-theme highlight shared-mime-info +You might also want: + apt-get install lighttpd +Unless you plan to run Apache, in which case: + apt-get install libapache2-mod-fastcgi + Optional -------- @@ -33,12 +42,11 @@ Shared Mime Info: http://freedesktop.org Highlight is required if source code is to be shown highlighted. Shared Mime Info: http://freedesktop.org/wiki/Software/shared-mime-info -Version 0.19 is known to work, although there is a specification -so older versions should be fine. Most distributions provide this -info. Note that if you install this into a non-standard path, -please export XDG_DATA_DIRS correctly (eg. XDG_DATA_DIRS=/opt/local/share) -Without this package, ViewMTN will only perform extremely basic -MIME type auto-detection. +Version 0.19 is known to work, although there is a specification so older +versions should be fine. Most distributions provide this info. Note that +if you install this into a non-standard path, please export XDG_DATA_DIRS +correctly (eg. XDG_DATA_DIRS=/opt/local/share) Without this package, +ViewMTN will only perform extremely basic MIME type auto-detection. Icon Theme: http://www.freedesktop.org/software/icon-theme/ Any version should be fine. If possible, use a distributor version @@ -59,9 +67,10 @@ You're then ready to run ViewMTN; too hard. You're then ready to run ViewMTN; - ./viewmtn.py -If you leave off the argument, ViewMTN will bind to port 8080. -You can access ViewMTN by visiting: + ./viewmtn.py + +If you omit the argument, ViewMTN will bind to port +127.0.0.1:8080. You can access ViewMTN by visiting: http://localhost:8080/ If everything has gone well, you should get the normal ViewMTN front @@ -69,6 +78,11 @@ cannot read your monotone database, the If not, look at the output of viewmtn.py on the console; perhaps it cannot read your monotone database, the path to 'mtn' is wrong, etc. +Running standalone in this mode is quite useful when using ViewMTN +as an application for a single user. However, if you want to run a +ViewMTN server for multiple users I suggest you have set up ViewMTN +to run under a web server. + Running ViewMTN in a web server ------------------------------- @@ -77,6 +91,12 @@ here: here: http://webpy.infogami.com/install +In any of the examples, substitute "code.py" (or whatever) for +web.py. + +Lighttpd +-------- + The following snippet of configuration is used to configure ViewMTN on http://viewmtn.angrygoats.net/ (running lighttpd) and is therefore known to work. You should be able to use it (with adjustment to @@ -102,3 +122,41 @@ suit your site). "^/(.*)$" => "/viewmtn.py/$1", ) } + +Apache2 +------- + +I've only tried ViewMTN under Apache with mod_fastcgi. Below is an +example htaccess file for ViewMTN: + # ExecCGI privilege is required to run the + # ViewMTN process + Options +ExecCGI + + # Make sure you update config.py with this URL. + + SetHandler fastcgi-script + + +Copy this file to .htaccess in the viewmtn directory. This directory +must have Options ExecCGI set. You might not be able to do this via +directives in .htaccess, depending on site configuration; you may need +to change the global server settings. + +Unfortunately mod_fastcgi does not provide information in the environment +so that web.py can automatically determine to run as fastcgi. Edit +config.py, and set running_under_apache2 to True. + running_under_apache2 = True + +Note that if you ever want to run ViewMTN in a different mode, you +will need reset this value to False. + +After all of this you should be able to access ViewMTN at: + http://hostname/path/to/viewmtn/viewmtn.py/ + +The trailing slash is important, otherwise you'll get a 404 error +trying to access the page. Note that the URL for static content +is: + http://hostname/path/to/viewmtn/static/ + +Be sure to set both of these in config.py. + ============================================================ --- README 5fa5a33cef3770ba09a216acc1659490712ba505 +++ README 51ea9bcf58e2383de5b13e36130946447ed07462 @@ -1,7 +1,7 @@ ViewMTN ------- -A web interface to monotone. See "LICENSE" for distribution terms. +A web interface to monotone. See "COPYING" for distribution terms. ViewMTN is Copyright 2005 Grahame Bowland. The minimum version of monotone required is: 0.32 @@ -11,11 +11,24 @@ Bugs, suggestions, feedback --------------------------- -Send any bugs, suggestions or feedback to: - Grahame Bowland - PO BOX 3105, Broadway, Nedlands WA 6009 Australia +If you need help with ViewMTN or there is any other issue, feel +free to get in touch with me: + Grahame Bowland + PO BOX 3105, Broadway, Nedlands WA 6009 Australia +I have put up a web page: + http://grahame.angrygoats.net/moinmoin/ViewMTN/Suggestions +Feel free to edit this page and list bugs or things you +would like to have implemented. + As monotone is a distributed version control system, feel free to grab a copy of viewmtn, commit to your local DB, etc. If you want to send me your commits, email me (or catch me in #monotone) and we'll work something out. + +I generally sync all my changes to the following public monotone +repositories: + venge.net + monotone.ucc.gu.uwa.edu.au +You should be able to grab the latest viewmtn from any of them. + ============================================================ --- authors.py 0ed0661cf3ddf1b402a73dfc1ff0fccc64ad05f1 +++ authors.py ad0bc51aaca26a1595b56dc845b11da7f6ee4353 @@ -1,3 +1,12 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + authors='''Authors: Grahame Bowland ============================================================ --- common.py b5a9eb0d651eb4f1a41e94376d35b31f5c8efe5d +++ common.py 39a5767f3123ff0819cf5dd20c8fffd2264ce328 @@ -1,4 +1,13 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + import datetime import time import fcntl ============================================================ --- config.py.example a484f47e78d3b8aa4fcc875b44f1039220fb2837 +++ config.py.example 49e135fe5ecb78922ba027f1e68d7b55f040e37d @@ -1,4 +1,13 @@ +# Copyright (C) 2005 Grahame Bowland # +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + +# # config.py # # This python script is imported by ViewMTN @@ -12,36 +21,37 @@ import sys import sys -dynamic_uri_path = 'http://glamdring.local:8080/' -static_uri_path = 'http://glamdring.local/~grahame/viewmtn/static/' +# default addresses should work without modification +# if running viewmtn standalone. You must change these +# if you run viewmtn with a web server, see INSTALL. +dynamic_uri_path = 'http://localhost:8080/' +static_uri_path = 'http://localhost:8080/static/' +# if you are running under Apache2, set this. +# don't set it otherwise, it breaks any other configuration +# including running standalone. +running_under_apache2 = False + # the path to the 'mtn' binary -monotone = '/opt/mtn/bin/mtn' +monotone = '/usr/bin/mtn' # the monotone database to be shared out -# obviously, everything in this database might -# become public if something goes wrong; probably -# a good idea not to leave your private key in it -dbfile = '/Users/grahame/mtn/db/angrygoats.db' +# everything in this database should be considered subject +# to disclosure. So don't store your private key in +# it! +dbfile = '/path/to/my/viewmtn.db' -# where to find GNOME icons (used in manifest listing) -# set to None to disableicon loading -gnome_mimetype_icon_path = '/Users/grahame/mtn/viewmtn/mimetypes/' - -# and where they are on the web -gnome_mimetype_uri = 'mimetypes/' - # highlight from http://andre-simon.de/ # if you don't have this available, just comment # the "highlight_command" line out -highlight_command = '/opt/local/bin/highlight' +highlight_command = '/usr/bin/highlight' graphopts = { # a directory (must be writable by the web user) # in which viewmtn can output graph files # (you should set up a cronjob to delete old ones # periodically) - 'directory' : '/Users/grahame/mtn/viewmtn/graph/', + 'directory' : '/var/tmp/viewmtn-graph/', # a URL, relative or absolute, at which the files # in the 'graphdir' directory can be found. Should @@ -49,7 +59,7 @@ graphopts = { 'uri' : 'graph/', # the path to the 'dot' program - 'dot' : '/opt/local/bin/dot', + 'dot' : '/usr/bin/dot', # options to use for nodes in the dot input file # we generate. ============================================================ --- fdo/xdgbasedir.py 864ac96a21a2fe65c401a7beaf2c98513795751d +++ fdo/xdgbasedir.py 6efff4cf0db2de43ca2801b9e89bdc7cc1c9b350 @@ -7,44 +7,49 @@ import os import os +strict = False + +def with_home (partial, exc_text): + home = os.getenv('HOME') + if home: + return partial(home) + elif strict: + raise Exception(exc_text) + else: + return None + def xdg_data_home(): rv = os.getenv('XDG_DATA_HOME') if rv: return rv - home = os.getenv('HOME') - if home: - return os.path.join(home, ".local", "share") - else: - raise Exception("Unable to determine xdg_data_home") + return with_home (lambda home: os.path.join(home, ".local", "share"), "Unable to determine xdg_data_home") def xdg_config_home(): rv = os.getenv('XDG_CONFIG_HOME') if rv: return rv - home = os.getenv('HOME') - if home: - return os.path.join(home, ".config") - else: - raise Exception("Unable to determine xdg_config_home") + return with_home (lambda home: os.path.join(home, ".config"), "Unable to determine xdg_config_home") def xdg_data_dirs(): - dirs = [xdg_data_home()] - for dir in os.getenv('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':'): - dirs.append(dir) + dirs = [] + dirname = xdg_data_home() + if dirname: + dirs.append(dirname) + for dirname in os.getenv('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':'): + dirs.append(dirname) return dirs def xdg_config_dirs(): - dirs = [xdg_config_home()] - for dir in os.getenv('XDG_DATA_DIRS', '/etc/xdg').split(':'): - dirs.append(dir) + dirs = [] + dirname = xdg_config_home() + if dirname: + dirs.append(dirname) + for dirname in os.getenv('XDG_DATA_DIRS', '/etc/xdg').split(':'): + dirs.append(dirname) return dirs def xdg_cache_home(): rv = os.getenv('XDG_CACHE_HOME') if rv: return rv + return with_home (lambda home: os.path.join(home, ".cache"), "Unable to determine xdg_cache_home") - home = os.getenv('HOME') - if home: - return os.path.join(home, ".cache") - else: - raise Exception("Unable to determine xdg_cache_home") ============================================================ --- genproxy.py 408f46a3f5fe0d792eb62e92a8faaf5c28c67a54 +++ genproxy.py 0b4728f487b54331d27276f09fe86a7b13ef07ce @@ -1,3 +1,12 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + #!/usr/bin/env python class GeneratorProxy(object): ============================================================ --- mtn.py 0d4cebb009164df2416ea03172a37654f5c95f69 +++ mtn.py be23fb4b716cb8a29ac4bf37981fe21a209c810f @@ -1,4 +1,13 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + import os import re import fcntl ============================================================ --- release.py 456c957746d295e19427471ad9f0e94e1d80195e +++ release.py df0ab88561367dd15fff84282bf2699eeae86ee4 @@ -1,3 +1,12 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + version='0.07beta' authors='''Authors: Grahame Bowland ============================================================ --- release.sh 1023631dc1b334d6460c18db73b74655744370da +++ release.sh 43e9d9753e5aa10695a21b9e2923237b805a3bad @@ -1,3 +1,12 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + #!/bin/sh # generate the help file data ============================================================ --- syntax.py cf93e6e6a6166204daaae6ec50819ba175fa3ed1 +++ syntax.py b6b9a000432ab2854092f2f93cafad332fce24d4 @@ -1,3 +1,12 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + #!/usr/bin/env python2.4 from common import set_nonblocking, terminate_popen3 ============================================================ --- templates/about.html fea245cb17ab46a7766e03293800361db0b325b2 +++ templates/about.html 309dd178a83ac76781efe00745d453d6e8dc0227 @@ -42,11 +42,15 @@ Foundation, Inc., 59 Temple Place, Suite

Dependencies

-ViewMTN is written in Python and runs under web.py. Code highlighting via Highlight. -Graphing via GraphViz. Graph colour generation algorithm -from monotone-viz with modifications from Matt Johnston. AJAX funtionality uses the MochiKit Javascript library. +ViewMTN is written in Python and +runs under web.py. Code highlighting +via Highlight. Graphing via GraphViz. Graph +colour generation algorithm from monotone-viz with +modifications from Matt Johnston. AJAX funtionality uses the MochiKit Javascript library and json.py by Patrick +D. Logan

============================================================ --- utility.py 78cd2c53af05e63bb76c097dc832b6f75394e40d +++ utility.py 93ac7b96f6909436af408f04446af4426fde207a @@ -1,4 +1,13 @@ +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + import popen2 import select import fcntl ============================================================ --- viewmtn.py 6f367b50c5e91faf4fc5405d7b9beb9f8092779d +++ viewmtn.py 9f4b7cd096f5b356bb57935c61257d5369036508 @@ -1,5 +1,14 @@ #!/usr/bin/env python2.4 +# Copyright (C) 2005 Grahame Bowland +# +# This program is made available under the GNU GPL version 2.0 or +# greater. See the accompanying file COPYING for details. +# +# This program is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + import os import cgi import mtn @@ -1123,9 +1132,10 @@ if __name__ == '__main__': return func(*args, **kwargs) if __name__ == '__main__': -# NB: if you're running Apache, uncomment the following line. Otherwise, don't. -# web.wsgi.runwsgi = runfcgi_apache - web.webapi.internalerror = web.debugerror + if hasattr(config, "running_under_apache2") and config.running_under_apache2: + web.wsgi.runwsgi = runfcgi_apache + if hasattr(config, "debug") and config.debug: + web.webapi.internalerror = web.debugerror func = lambda : per_request_wrapper(web.webpyfunc(urls, fvars=globals())) web.run(func, globals(), web.reloader)