Skip to content

Commit 45a834b

Browse files
committed
Run scripts (roundup_admin.py, ...) directly from checkout.
Convenient when you don't want to install Roundup, but want to run latest version.
1 parent d7708b7 commit 45a834b

File tree

7 files changed

+89
-5
lines changed

7 files changed

+89
-5
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Features:
1313
- A new jinja2 template based on Classic schema and using Twitter
1414
bootstrap for responsive behaviour. Run as -
1515
python demo.py -t jinja2 nuke (Pradip P Caulagi)
16+
- roundup_admin.py and other scripts can now be run directly from the
17+
sources dir as roundup\scripts\roundup_admin.py (anatoly techtonik)
1618
- Renamed old Templates classes to Loader classes to clarify sources
1719
for alternative templating engines, updated docs (anatoly techtonik)
1820
- Template selection code is moved from Loader classes into cgi.client

roundup/scripts/roundup_admin.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,28 @@
1818
"""
1919
__docformat__ = 'restructuredtext'
2020

21+
import sys
22+
23+
24+
# --- patch sys.path to make sure 'import roundup' finds correct version
25+
import os.path as osp
26+
27+
thisdir = osp.dirname(osp.abspath(__file__))
28+
rootdir = osp.dirname(osp.dirname(thisdir))
29+
if (osp.exists(thisdir + '/__init__.py') and
30+
osp.exists(rootdir + '/roundup/__init__.py')):
31+
# the script is located inside roundup source code
32+
sys.path.insert(0, rootdir)
33+
# --/
34+
35+
2136
# python version check
2237
from roundup import version_check
2338

2439
# import the admin tool guts and make it go
2540
from roundup.admin import AdminTool
2641
from roundup.i18n import _
2742

28-
import sys
29-
3043
def run():
3144
# time out after a minute if we can
3245
import socket

roundup/scripts/roundup_demo.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,28 @@
33
# Copyright 2004 Richard Jones ([email protected])
44
#
55

6+
DEFAULT_HOME = './demo'
7+
DEFAULT_TEMPLATE = 'classic'
8+
9+
610
import sys
711

12+
13+
# --- patch sys.path to make sure 'import roundup' finds correct version
14+
import os.path as osp
15+
16+
thisdir = osp.dirname(osp.abspath(__file__))
17+
rootdir = osp.dirname(osp.dirname(thisdir))
18+
if (osp.exists(thisdir + '/__init__.py') and
19+
osp.exists(rootdir + '/roundup/__init__.py')):
20+
# the script is located inside roundup source code
21+
sys.path.insert(0, rootdir)
22+
# --/
23+
24+
825
from roundup import admin, configuration, demo, instance
926
from roundup.i18n import _
1027

11-
DEFAULT_HOME = './demo'
12-
DEFAULT_TEMPLATE = 'classic'
13-
1428
def run():
1529
home = DEFAULT_HOME
1630
template = DEFAULT_TEMPLATE

roundup/scripts/roundup_gettext.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@
77
import os
88
import sys
99

10+
11+
# --- patch sys.path to make sure 'import roundup' finds correct version
12+
import os.path as osp
13+
14+
thisdir = osp.dirname(osp.abspath(__file__))
15+
rootdir = osp.dirname(osp.dirname(thisdir))
16+
if (osp.exists(thisdir + '/__init__.py') and
17+
osp.exists(rootdir + '/roundup/__init__.py')):
18+
# the script is located inside roundup source code
19+
sys.path.insert(0, rootdir)
20+
# --/
21+
22+
1023
from roundup.i18n import _
1124
from roundup.cgi.TAL import talgettext
1225

roundup/scripts/roundup_mailgw.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@
1818
"""
1919
__docformat__ = 'restructuredtext'
2020

21+
22+
# --- patch sys.path to make sure 'import roundup' finds correct version
23+
import sys
24+
import os.path as osp
25+
26+
thisdir = osp.dirname(osp.abspath(__file__))
27+
rootdir = osp.dirname(osp.dirname(thisdir))
28+
if (osp.exists(thisdir + '/__init__.py') and
29+
osp.exists(rootdir + '/roundup/__init__.py')):
30+
# the script is located inside roundup source code
31+
sys.path.insert(0, rootdir)
32+
# --/
33+
34+
2135
# python version check
2236
from roundup import version_check
2337
from roundup import __version__ as roundup_version

roundup/scripts/roundup_server.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@
1919
"""
2020
__docformat__ = 'restructuredtext'
2121

22+
23+
# --- patch sys.path to make sure 'import roundup' finds correct version
24+
import sys
25+
import os.path as osp
26+
27+
thisdir = osp.dirname(osp.abspath(__file__))
28+
rootdir = osp.dirname(osp.dirname(thisdir))
29+
if (osp.exists(thisdir + '/__init__.py') and
30+
osp.exists(rootdir + '/roundup/__init__.py')):
31+
# the script is located inside roundup source code
32+
sys.path.insert(0, rootdir)
33+
# --/
34+
35+
2236
import errno, cgi, getopt, os, socket, sys, traceback, urllib, time
2337
import ConfigParser, BaseHTTPServer, SocketServer, StringIO
2438

roundup/scripts/roundup_xmlrpc_server.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55
# For license terms see the file COPYING.txt.
66
#
77

8+
9+
# --- patch sys.path to make sure 'import roundup' finds correct version
10+
import sys
11+
import os.path as osp
12+
13+
thisdir = osp.dirname(osp.abspath(__file__))
14+
rootdir = osp.dirname(osp.dirname(thisdir))
15+
if (osp.exists(thisdir + '/__init__.py') and
16+
osp.exists(rootdir + '/roundup/__init__.py')):
17+
# the script is located inside roundup source code
18+
sys.path.insert(0, rootdir)
19+
# --/
20+
21+
822
import base64, getopt, os, sys, socket, urllib
923
from roundup.xmlrpc import translate
1024
from roundup.xmlrpc import RoundupInstance

0 commit comments

Comments
 (0)