comparison setup.py @ 1591:21312a7564fd

moving templates around
author Richard Jones <richard@users.sourceforge.net>
date Thu, 17 Apr 2003 03:38:00 +0000
parents 7c1a9b72f7fb
children eee8b5eecb33
comparison
equal deleted inserted replaced
1590:198dbefc1d5a 1591:21312a7564fd
14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18 # 18 #
19 # $Id: setup.py,v 1.47 2003-04-17 01:14:10 richard Exp $ 19 # $Id: setup.py,v 1.48 2003-04-17 03:37:57 richard Exp $
20 20
21 from distutils.core import setup, Extension 21 from distutils.core import setup, Extension
22 from distutils.util import get_platform 22 from distutils.util import get_platform
23 from distutils.command.build_scripts import build_scripts 23 from distutils.command.build_scripts import build_scripts
24 24
28 # patch distutils if it can't cope with the "classifiers" keyword 28 # patch distutils if it can't cope with the "classifiers" keyword
29 if sys.version < '2.2.3': 29 if sys.version < '2.2.3':
30 from distutils.dist import DistributionMetadata 30 from distutils.dist import DistributionMetadata
31 DistributionMetadata.classifiers = None 31 DistributionMetadata.classifiers = None
32 DistributionMetadata.download_url = None 32 DistributionMetadata.download_url = None
33
34 from roundup.templates.builder import makeHtmlBase
35 33
36 34
37 ############################################################################# 35 #############################################################################
38 ### Build script files 36 ### Build script files
39 ############################################################################# 37 #############################################################################
122 120
123 ############################################################################# 121 #############################################################################
124 ### Main setup stuff 122 ### Main setup stuff
125 ############################################################################# 123 #############################################################################
126 124
127 def isTemplateDir(dir):
128 return dir[0] != '.' and dir != 'CVS' and os.path.isdir(dir) \
129 and os.path.isfile(os.path.join(dir, '__init__.py'))
130
131 # use that function to list all the templates
132 templates = map(os.path.basename, filter(isTemplateDir,
133 glob(os.path.join('roundup', 'templates', '*'))))
134
135 def buildTemplates():
136 for template in templates:
137 tdir = os.path.join('roundup', 'templates', template)
138 makeHtmlBase(tdir)
139
140 def main(): 125 def main():
141 # build list of scripts from their implementation modules 126 # build list of scripts from their implementation modules
142 roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py')) 127 roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py'))
143 128
144 # template munching 129 # template munching
145 templates = map(os.path.basename, filter(isTemplateDir,
146 glob(os.path.join('roundup', 'templates', '*'))))
147 packagelist = [ 130 packagelist = [
148 'roundup', 131 'roundup',
149 'roundup.cgi', 132 'roundup.cgi',
150 'roundup.cgi.PageTemplates', 133 'roundup.cgi.PageTemplates',
151 'roundup.cgi.TAL', 134 'roundup.cgi.TAL',
152 'roundup.cgi.ZTUtils', 135 'roundup.cgi.ZTUtils',
153 'roundup.backends', 136 'roundup.backends',
154 'roundup.scripts', 137 'roundup.scripts'
155 'roundup.templates'
156 ] 138 ]
157 installdatafiles = [ 139 installdatafiles = [
158 ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']), 140 ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']),
159 ] 141 ]
160 142
161 # install man pages on POSIX platforms 143 # install man pages on POSIX platforms
162 if os.name == 'posix': 144 if os.name == 'posix':
163 installdatafiles.append(('man/man1', ['doc/roundup-admin.1', 145 installdatafiles.append(('man/man1', ['doc/roundup-admin.1',
164 'doc/roundup-mailgw.1', 'doc/roundup-server.1'])) 146 'doc/roundup-mailgw.1', 'doc/roundup-server.1']))
165 147
166 # munge the template HTML into the htmlbase module 148 # add the templates to the data files lists
167 buildTemplates() 149 from roundup.admin import listTemplates
168 150 templates = [t['path'] for t in listTemplates('.').values()]
169 # add the templates to the setup packages and data files lists 151 for tdir in templates:
170 for template in templates:
171 tdir = os.path.join('roundup', 'templates', template)
172
173 # add the template package and subpackage
174 packagelist.append('roundup.templates.%s' % template)
175 packagelist.append('roundup.templates.%s.detectors' % template)
176
177 # scan for data files 152 # scan for data files
178 tfiles = glob(os.path.join(tdir, 'html', '*')) 153 for idir in '. detectors html'.split():
179 tfiles = filter(os.path.isfile, tfiles) 154 idir = os.path.join(tdir, idir)
180 installdatafiles.append( 155 tfiles = []
181 ('share/roundup/templates/%s/html' % template, tfiles) 156 for f in os.listdir(idir):
182 ) 157 if f.startswith('.'):
158 continue
159 ifile = os.path.join(idir, f)
160 if os.path.isfile(ifile):
161 tfiles.append(ifile)
162 installdatafiles.append(
163 (os.path.join('share', 'roundup', idir), tfiles)
164 )
183 165
184 # perform the setup action 166 # perform the setup action
185 from roundup import __version__ 167 from roundup import __version__
186 setup( 168 setup(
187 name = "roundup", 169 name = "roundup",
231 shutil.rmtree(home) 213 shutil.rmtree(home)
232 except os.error, error: 214 except os.error, error:
233 if error.errno != errno.ENOENT: 215 if error.errno != errno.ENOENT:
234 raise 216 raise
235 from roundup import init, instance, password 217 from roundup import init, instance, password
236 init.install(home, 'classic') 218 init.install(home, os.path.join('templates', 'classic'))
237 # don't have email flying around 219 # don't have email flying around
238 os.remove(os.path.join(home, 'detectors', 'nosyreaction.py')) 220 os.remove(os.path.join(home, 'detectors', 'nosyreaction.py'))
239 init.write_select_db(home, 'anydbm') 221 init.write_select_db(home, 'anydbm')
240 222
241 # figure basic params for server 223 # figure basic params for server

Roundup Issue Tracker: http://roundup-tracker.org/