comparison roundup/init.py @ 2766:b2cd472919c8

if there is no config installed from the template, write default config text; fix import statements; fix vim modeline
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sat, 16 Oct 2004 14:45:12 +0000
parents 4c08ca1e2460
children 22c459281026
comparison
equal deleted inserted replaced
2765:3468f74bd7ce 2766:b2cd472919c8
12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 12 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: init.py,v 1.31 2004-09-29 07:13:44 richard Exp $ 18 # $Id: init.py,v 1.32 2004-10-16 14:45:12 a1s Exp $
19 19
20 """Init (create) a roundup instance. 20 """Init (create) a roundup instance.
21 """ 21 """
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
24 import os, sys, errno, rfc822 24 import os, sys, errno, rfc822
25 25
26 import roundup.instance, password 26 import roundup.instance
27 from roundup import install_util 27 from roundup import install_util, password
28 from roundup.configuration import CoreConfig
28 29
29 def copytree(src, dst, symlinks=0): 30 def copytree(src, dst, symlinks=0):
30 """Recursively copy a directory tree using copyDigestedFile(). 31 """Recursively copy a directory tree using copyDigestedFile().
31 32
32 The destination directory os allowed to exist. 33 The destination directory os allowed to exist.
91 92
92 # rename the tempate in the TEMPLATE-INFO.txt file 93 # rename the tempate in the TEMPLATE-INFO.txt file
93 ti = loadTemplateInfo(instance_home) 94 ti = loadTemplateInfo(instance_home)
94 ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1] 95 ti['name'] = ti['name'] + '-' + os.path.split(instance_home)[1]
95 saveTemplateInfo(instance_home, ti) 96 saveTemplateInfo(instance_home, ti)
97
98 # if there is no config.ini or old-style config.py
99 # installed from the template, write default config text
100 config_ini_file = os.path.join(instance_home, CoreConfig.INI_FILE)
101 if not (os.path.isfile(config_ini_file)
102 or os.path.isfile(os.path.join(instance_home, 'config.py'))
103 ):
104 config = CoreConfig()
105 config.save(config_ini_file)
96 106
97 107
98 def listTemplates(dir): 108 def listTemplates(dir):
99 ''' List all the Roundup template directories in a given directory. 109 ''' List all the Roundup template directories in a given directory.
100 110
168 f.write(backend+'\n') 178 f.write(backend+'\n')
169 f.close() 179 f.close()
170 180
171 181
172 182
173 # vim: set filetype=python ts=4 sw=4 et si 183 # vim: set filetype=python sts=4 sw=4 et si :

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