Mercurial > p > roundup > code
changeset 4766:86ef4ab17dc5
Run scripts (roundup_admin.py, ...) directly from checkout.
Convenient when you don't want to install Roundup, but want
to run latest version.
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Thu, 21 Feb 2013 20:49:45 +0300 |
| parents | c6694cff29bc |
| children | 696c5a929349 |
| files | CHANGES.txt roundup/scripts/roundup_admin.py roundup/scripts/roundup_demo.py roundup/scripts/roundup_gettext.py roundup/scripts/roundup_mailgw.py roundup/scripts/roundup_server.py roundup/scripts/roundup_xmlrpc_server.py |
| diffstat | 7 files changed, 89 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Thu Feb 21 19:36:49 2013 +0300 +++ b/CHANGES.txt Thu Feb 21 20:49:45 2013 +0300 @@ -13,6 +13,8 @@ - A new jinja2 template based on Classic schema and using Twitter bootstrap for responsive behaviour. Run as - python demo.py -t jinja2 nuke (Pradip P Caulagi) +- roundup_admin.py and other scripts can now be run directly from the + sources dir as roundup\scripts\roundup_admin.py (anatoly techtonik) - Renamed old Templates classes to Loader classes to clarify sources for alternative templating engines, updated docs (anatoly techtonik) - Template selection code is moved from Loader classes into cgi.client
--- a/roundup/scripts/roundup_admin.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_admin.py Thu Feb 21 20:49:45 2013 +0300 @@ -18,6 +18,21 @@ """ __docformat__ = 'restructuredtext' +import sys + + +# --- patch sys.path to make sure 'import roundup' finds correct version +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + # python version check from roundup import version_check @@ -25,8 +40,6 @@ from roundup.admin import AdminTool from roundup.i18n import _ -import sys - def run(): # time out after a minute if we can import socket
--- a/roundup/scripts/roundup_demo.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_demo.py Thu Feb 21 20:49:45 2013 +0300 @@ -3,14 +3,28 @@ # Copyright 2004 Richard Jones (richard@mechanicalcat.net) # +DEFAULT_HOME = './demo' +DEFAULT_TEMPLATE = 'classic' + + import sys + +# --- patch sys.path to make sure 'import roundup' finds correct version +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + from roundup import admin, configuration, demo, instance from roundup.i18n import _ -DEFAULT_HOME = './demo' -DEFAULT_TEMPLATE = 'classic' - def run(): home = DEFAULT_HOME template = DEFAULT_TEMPLATE
--- a/roundup/scripts/roundup_gettext.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_gettext.py Thu Feb 21 20:49:45 2013 +0300 @@ -7,6 +7,19 @@ import os import sys + +# --- patch sys.path to make sure 'import roundup' finds correct version +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + from roundup.i18n import _ from roundup.cgi.TAL import talgettext
--- a/roundup/scripts/roundup_mailgw.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_mailgw.py Thu Feb 21 20:49:45 2013 +0300 @@ -18,6 +18,20 @@ """ __docformat__ = 'restructuredtext' + +# --- patch sys.path to make sure 'import roundup' finds correct version +import sys +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + # python version check from roundup import version_check from roundup import __version__ as roundup_version
--- a/roundup/scripts/roundup_server.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_server.py Thu Feb 21 20:49:45 2013 +0300 @@ -19,6 +19,20 @@ """ __docformat__ = 'restructuredtext' + +# --- patch sys.path to make sure 'import roundup' finds correct version +import sys +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + import errno, cgi, getopt, os, socket, sys, traceback, urllib, time import ConfigParser, BaseHTTPServer, SocketServer, StringIO
--- a/roundup/scripts/roundup_xmlrpc_server.py Thu Feb 21 19:36:49 2013 +0300 +++ b/roundup/scripts/roundup_xmlrpc_server.py Thu Feb 21 20:49:45 2013 +0300 @@ -5,6 +5,20 @@ # For license terms see the file COPYING.txt. # + +# --- patch sys.path to make sure 'import roundup' finds correct version +import sys +import os.path as osp + +thisdir = osp.dirname(osp.abspath(__file__)) +rootdir = osp.dirname(osp.dirname(thisdir)) +if (osp.exists(thisdir + '/__init__.py') and + osp.exists(rootdir + '/roundup/__init__.py')): + # the script is located inside roundup source code + sys.path.insert(0, rootdir) +# --/ + + import base64, getopt, os, sys, socket, urllib from roundup.xmlrpc import translate from roundup.xmlrpc import RoundupInstance
