Mercurial > p > roundup > code
annotate setup.py @ 1576:80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Added an "instant gratification" mode - "python setup.py demo" installs a
simple instance and runs the web server on it. Nosy is disabled.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 07 Apr 2003 03:47:44 +0000 |
| parents | c0673f1739c3 |
| children | 070b56a0b2f6 |
| rev | line source |
|---|---|
|
85
fe0b33370244
Made setup.py executable, added id and log.
Richard Jones <richard@users.sourceforge.net>
parents:
78
diff
changeset
|
1 #! /usr/bin/env python |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
2 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
3 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
4 # This module is free software, and you may redistribute it and/or modify |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
5 # under the same terms as Python, so long as this copyright message and |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
6 # disclaimer are retained in their original form. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
7 # |
| 214 | 8 # IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR |
|
213
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
9 # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
10 # OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
11 # POSSIBILITY OF SUCH DAMAGE. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
12 # |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
13 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
d45384bc6420
Added the copyright/license notice to (nearly) all files...
Richard Jones <richard@users.sourceforge.net>
parents:
210
diff
changeset
|
18 # |
|
1576
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
19 # $Id: setup.py,v 1.45 2003-04-07 03:47:44 richard Exp $ |
|
85
fe0b33370244
Made setup.py executable, added id and log.
Richard Jones <richard@users.sourceforge.net>
parents:
78
diff
changeset
|
20 |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
21 from distutils.core import setup, Extension |
|
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
22 from distutils.util import get_platform |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
23 from distutils.command.build_scripts import build_scripts |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
25 import sys, os, string |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
26 from glob import glob |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
27 |
|
1320
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
28 # patch distutils if it can't cope with the "classifiers" keyword |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
29 if sys.version < '2.2.3': |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
30 from distutils.dist import DistributionMetadata |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
31 DistributionMetadata.classifiers = None |
|
1461
c0673f1739c3
oops, handle older pythons w.r.t. download_url
Richard Jones <richard@users.sourceforge.net>
parents:
1458
diff
changeset
|
32 DistributionMetadata.download_url = None |
|
1320
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
33 |
|
937
fb8a8eb55aac
cleanup: moved templatebuilder into templates.builder
Richard Jones <richard@users.sourceforge.net>
parents:
773
diff
changeset
|
34 from roundup.templates.builder import makeHtmlBase |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
35 |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
36 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
37 ############################################################################# |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
38 ### Build script files |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
39 ############################################################################# |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
40 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
41 class build_scripts_create(build_scripts): |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
42 """ Overload the build_scripts command and create the scripts |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
43 from scratch, depending on the target platform. |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
44 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
45 You have to define the name of your package in an inherited |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
46 class (due to the delayed instantiation of command classes |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
47 in distutils, this cannot be passed to __init__). |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
48 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
49 The scripts are created in an uniform scheme: they start the |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
50 run() function in the module |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
51 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
52 <packagename>.scripts.<mangled_scriptname> |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
53 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
54 The mangling of script names replaces '-' and '/' characters |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
55 with '-' and '.', so that they are valid module paths. |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
56 """ |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
57 package_name = None |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
58 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
59 def copy_scripts(self): |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
60 """ Create each script listed in 'self.scripts' |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
61 """ |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
62 if not self.package_name: |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
63 raise Exception("You have to inherit build_scripts_create and" |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
64 " provide a package name") |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
65 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
66 to_module = string.maketrans('-/', '_.') |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
67 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
68 self.mkpath(self.build_dir) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
69 for script in self.scripts: |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
70 outfile = os.path.join(self.build_dir, os.path.basename(script)) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
71 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
72 #if not self.force and not newer(script, outfile): |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
73 # self.announce("not copying %s (up-to-date)" % script) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
74 # continue |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
75 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
76 if self.dry_run: |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
77 self.announce("would create %s" % outfile) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
78 continue |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
79 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
80 module = os.path.splitext(os.path.basename(script))[0] |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
81 module = string.translate(module, to_module) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
82 script_vars = { |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
83 'python': os.path.normpath(sys.executable), |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
84 'package': self.package_name, |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
85 'module': module, |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
86 } |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
87 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
88 self.announce("creating %s" % outfile) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
89 file = open(outfile, 'w') |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
90 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
91 try: |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
92 if sys.platform == "win32": |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
93 file.write('@echo off\n' |
|
1287
5402a6f2a754
Added quotes around python interpreter in windows bat [SF#623963]
Richard Jones <richard@users.sourceforge.net>
parents:
1188
diff
changeset
|
94 'if NOT "%%_4ver%%" == "" "%(python)s" -O -c "from %(package)s.scripts.%(module)s import run; run()" %%$\n' |
|
5402a6f2a754
Added quotes around python interpreter in windows bat [SF#623963]
Richard Jones <richard@users.sourceforge.net>
parents:
1188
diff
changeset
|
95 'if "%%_4ver%%" == "" "%(python)s" -O -c "from %(package)s.scripts.%(module)s import run; run()" %%*\n' |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
96 % script_vars) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
97 else: |
|
1188
2add60346bf7
run python in optimise mode
Richard Jones <richard@users.sourceforge.net>
parents:
1092
diff
changeset
|
98 file.write('#! %(python)s -O\n' |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
99 'from %(package)s.scripts.%(module)s import run\n' |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
100 'run()\n' |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
101 % script_vars) |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
102 finally: |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
103 file.close() |
|
669
fbe3c24c499d
chmod +x for scripts
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
593
diff
changeset
|
104 os.chmod(outfile, 0755) |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
105 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
106 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
107 class build_scripts_roundup(build_scripts_create): |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
108 package_name = 'roundup' |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
109 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
110 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
111 def scriptname(path): |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
112 """ Helper for building a list of script names from a list of |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
113 module files. |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
114 """ |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
115 script = os.path.splitext(os.path.basename(path))[0] |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
116 script = string.replace(script, '_', '-') |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
117 if sys.platform == "win32": |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
118 script = script + ".bat" |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
119 return script |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
120 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
121 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
122 |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
123 ############################################################################# |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
124 ### Main setup stuff |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
125 ############################################################################# |
|
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
126 |
|
437
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
127 def isTemplateDir(dir): |
|
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
128 return dir[0] != '.' and dir != 'CVS' and os.path.isdir(dir) \ |
|
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
129 and os.path.isfile(os.path.join(dir, '__init__.py')) |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
130 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
131 # use that function to list all the templates |
|
437
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
132 templates = map(os.path.basename, filter(isTemplateDir, |
|
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
133 glob(os.path.join('roundup', 'templates', '*')))) |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
134 |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
135 def buildTemplates(): |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
136 for template in templates: |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
137 tdir = os.path.join('roundup', 'templates', template) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
138 makeHtmlBase(tdir) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
139 |
|
1576
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
140 def main(): |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
141 # build list of scripts from their implementation modules |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
142 roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) |
|
437
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
143 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
144 # template munching |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
145 templates = map(os.path.basename, filter(isTemplateDir, |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
146 glob(os.path.join('roundup', 'templates', '*')))) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
147 packagelist = [ |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
148 'roundup', |
|
1059
3f20880c2a7e
additional packages
Richard Jones <richard@users.sourceforge.net>
parents:
937
diff
changeset
|
149 'roundup.cgi', |
|
3f20880c2a7e
additional packages
Richard Jones <richard@users.sourceforge.net>
parents:
937
diff
changeset
|
150 'roundup.cgi.PageTemplates', |
|
3f20880c2a7e
additional packages
Richard Jones <richard@users.sourceforge.net>
parents:
937
diff
changeset
|
151 'roundup.cgi.TAL', |
|
3f20880c2a7e
additional packages
Richard Jones <richard@users.sourceforge.net>
parents:
937
diff
changeset
|
152 'roundup.cgi.ZTUtils', |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
153 'roundup.backends', |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
154 'roundup.scripts', |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
155 'roundup.templates' |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
156 ] |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
157 installdatafiles = [ |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
158 ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']), |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
159 ] |
|
437
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
160 |
|
1419
c717b8d63a7e
included UN*X manual pages from Bastian Kleineidam
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
161 # install man pages on POSIX platforms |
|
c717b8d63a7e
included UN*X manual pages from Bastian Kleineidam
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
162 if os.name == 'posix': |
|
c717b8d63a7e
included UN*X manual pages from Bastian Kleineidam
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
163 installdatafiles.append(('man/man1', ['doc/roundup-admin.1', |
|
c717b8d63a7e
included UN*X manual pages from Bastian Kleineidam
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
164 'doc/roundup-mailgw.1', 'doc/roundup-server.1'])) |
|
c717b8d63a7e
included UN*X manual pages from Bastian Kleineidam
Richard Jones <richard@users.sourceforge.net>
parents:
1320
diff
changeset
|
165 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
166 # munge the template HTML into the htmlbase module |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
167 buildTemplates() |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
168 |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
169 # add the templates to the setup packages and data files lists |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
170 for template in templates: |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
171 tdir = os.path.join('roundup', 'templates', template) |
|
437
a1e778940f92
Install html template files to share/roundup/templates
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
402
diff
changeset
|
172 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
173 # add the template package and subpackage |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
174 packagelist.append('roundup.templates.%s' % template) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
175 packagelist.append('roundup.templates.%s.detectors' % template) |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
176 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
177 # scan for data files |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
178 tfiles = glob(os.path.join(tdir, 'html', '*')) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
179 tfiles = filter(os.path.isfile, tfiles) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
180 installdatafiles.append( |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
181 ('share/roundup/templates/%s/html' % template, tfiles) |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
182 ) |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
183 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
184 # perform the setup action |
|
773
6e6c63a57df9
[SF#569415] {version]]
Richard Jones <richard@users.sourceforge.net>
parents:
753
diff
changeset
|
185 from roundup import __version__ |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
186 setup( |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
187 name = "roundup", |
|
773
6e6c63a57df9
[SF#569415] {version]]
Richard Jones <richard@users.sourceforge.net>
parents:
753
diff
changeset
|
188 version = __version__, |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
189 description = "Roundup issue tracking system.", |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
190 author = "Richard Jones", |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
191 author_email = "richard@users.sourceforge.net", |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
192 url = 'http://sourceforge.net/projects/roundup/', |
| 1458 | 193 download_url = 'http://sourceforge.net/project/showfiles.php?group_id=31577', |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
194 packages = packagelist, |
|
1320
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
195 classifiers = [ |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
196 'Development Status :: 4 - Beta', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
197 'Environment :: Console', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
198 'Environment :: Web Environment', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
199 'Intended Audience :: End Users/Desktop', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
200 'Intended Audience :: Developers', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
201 'Intended Audience :: System Administrators', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
202 'License :: OSI Approved :: Python Software Foundation License', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
203 'Operating System :: MacOS :: MacOS X', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
204 'Operating System :: Microsoft :: Windows', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
205 'Operating System :: POSIX', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
206 'Programming Language :: Python', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
207 'Topic :: Communications :: Email', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
208 'Topic :: Office/Business', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
209 'Topic :: Software Development :: Bug Tracking', |
|
3758a5af985f
Lots of little fixes in this update:
Richard Jones <richard@users.sourceforge.net>
parents:
1287
diff
changeset
|
210 ], |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
211 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
212 # Override certain command classes with our own ones |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
213 cmdclass = { |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
214 'build_scripts': build_scripts_roundup, |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
215 }, |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
216 scripts = roundup_scripts, |
|
593
2256f81293c1
Conversion to generated script stubs
Jürgen Hermann <jhermann@users.sourceforge.net>
parents:
580
diff
changeset
|
217 |
|
753
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
218 data_files = installdatafiles |
|
938edfdeac6e
Sorry about this huge checkin!
Richard Jones <richard@users.sourceforge.net>
parents:
675
diff
changeset
|
219 ) |
|
78
edcca72de643
first cut at setup.py - installs the package, but not the bin/cgi-bin yet
Anthony Baxter <anthonybaxter@users.sourceforge.net>
parents:
diff
changeset
|
220 |
|
1576
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
221 def install_demo(): |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
222 ''' Install a demo server for users to play with for instant gratification. |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
223 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
224 Sets up the web service on localhost port 8080. Disables nosy lists. |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
225 ''' |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
226 import shutil, socket, errno, BaseHTTPServer |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
227 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
228 # create the instance |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
229 home = os.path.abspath('demo') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
230 try: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
231 shutil.rmtree(home) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
232 except os.error, error: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
233 if error.errno != errno.ENOENT: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
234 raise |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
235 from roundup import init, instance, password |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
236 init.install(home, 'classic') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
237 # don't have email flying around |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
238 os.remove(os.path.join(home, 'detectors', 'nosyreaction.py')) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
239 init.write_select_db(home, 'anydbm') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
240 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
241 # figure basic params for server |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
242 hostname = socket.gethostname() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
243 port = 8080 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
244 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
245 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
246 while 1: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
247 print 'Trying to set up web server on port %d ...'%port, |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
248 try: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
249 s.bind((hostname, port)) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
250 except socket.error, error: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
251 if error.errno != errno.EADDRINUSE: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
252 raise |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
253 print 'already in use.' |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
254 port += 100 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
255 else: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
256 print 'should be ok.' |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
257 break |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
258 url = 'http://%s:%s/demo/'%(hostname, port) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
259 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
260 # write the config |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
261 f = open(os.path.join(home, 'config.py'), 'r') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
262 s = f.read().replace('http://tracker.example/cgi-bin/roundup.cgi/bugs/', |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
263 url) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
264 f.close() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
265 f = open(os.path.join(home, 'config.py'), 'w') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
266 f.write(s) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
267 f.close() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
268 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
269 # initialise the database |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
270 init.initialise(home, 'admin') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
271 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
272 # add the "demo" user |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
273 tracker = instance.open(home) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
274 db = tracker.open('admin') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
275 db.user.create(username='demo', password=password.Password('demo'), |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
276 realname='Demo User', roles='User') |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
277 db.commit() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
278 db.close() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
279 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
280 # ok, so start up the server |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
281 from roundup.scripts.roundup_server import RoundupRequestHandler |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
282 RoundupRequestHandler.TRACKER_HOMES = {'demo': home} |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
283 httpd = BaseHTTPServer.HTTPServer((hostname, port), RoundupRequestHandler) |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
284 print 'Server running - connect to:\n %s'%url |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
285 print 'You may log in as "demo"/"demo" or "admin"/"admin".' |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
286 try: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
287 httpd.serve_forever() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
288 except KeyboardInterrupt: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
289 print 'Keyboard Interrupt: exiting' |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
290 |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
291 if __name__ == '__main__': |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
292 if len(sys.argv) > 1 and sys.argv[1] == 'demo': |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
293 install_demo() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
294 else: |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
295 main() |
|
80519db85eac
More tweaks to the licensing to make the Debian folks happy :)
Richard Jones <richard@users.sourceforge.net>
parents:
1461
diff
changeset
|
296 |
|
127
0791d13baea7
Added vim command to all source so that we don't get no steenkin' tabs :)
Richard Jones <richard@users.sourceforge.net>
parents:
105
diff
changeset
|
297 # vim: set filetype=python ts=4 sw=4 et si |
