X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=roundup%2Finit.py;h=d4afecc9e8a50da5e33c7fc7d0dee6a3ff4e6918;hb=c28424f9add2dfbcb11b5288c4d5f8e6d99e1d8b;hp=b0e2b5b8bc03f0e38078dc3276f84f76e3541347;hpb=9c438c70783bcdc1f659796bc95404848cd61786;p=roundup.git diff --git a/roundup/init.py b/roundup/init.py index b0e2b5b..d4afecc 100644 --- a/roundup/init.py +++ b/roundup/init.py @@ -14,22 +14,23 @@ # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -# -# $Id: init.py,v 1.24 2002-09-10 12:44:42 richard Exp $ +# +# $Id: init.py,v 1.36 2005-12-03 11:22:50 a1s Exp $ -__doc__ = """ -Init (create) a roundup instance. +"""Init (create) a roundup instance. """ +__docformat__ = 'restructuredtext' -import os, sys, errno +import os, errno, rfc822 -import roundup.instance, password -from roundup import install_util +from roundup import install_util, password +from roundup.configuration import CoreConfig +from roundup.i18n import _ def copytree(src, dst, symlinks=0): """Recursively copy a directory tree using copyDigestedFile(). - The destination directory os allowed to exist. + The destination directory is allowed to exist. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if @@ -37,9 +38,10 @@ def copytree(src, dst, symlinks=0): links are copied. This was copied from shutil.py in std lib. - """ - names = os.listdir(src) + + # Prevent 'hidden' files (those starting with '.') from being considered. + names = [f for f in os.listdir(src) if not f.startswith('.')] try: os.mkdir(dst) except OSError, error: @@ -55,62 +57,137 @@ def copytree(src, dst, symlinks=0): else: install_util.copyDigestedFile(srcname, dstname) -def install(instance_home, template, backend): +def install(instance_home, template, settings={}): '''Install an instance using the named template and backend. - instance_home - the directory to place the instance data in - template - the template to use in creating the instance data - backend - the database to use to store the instance data + 'instance_home' + the directory to place the instance data in + 'template' + the directory holding the template to use in creating the instance data + 'settings' + config.ini setting overrides (dictionary) The instance_home directory will be created using the files found in - the named template (roundup.templates.). A standard instance_home + the named template (roundup.templates.). A usual instance_home contains: - . config.py - - simple configuration of things like the email address for the - mail gateway, the mail domain, the mail host, ... - . dbinit.py and select_db.py - - defines the schema for the hyperdatabase and indicates which - backend to use. - . interfaces.py - - defines the CGI Client and mail gateway MailGW classes that are - used by roundup.cgi, roundup-server and roundup-mailgw. - . __init__.py - - ties together all the instance information into one interface - . db/ - - the actual database that stores the instance's data - . html/ - - the html templates that are used by the CGI Client - . detectors/ - - the auditor and reactor modules for this instance - - The html directory is typically extracted from the htmlbase module in - the template. - ''' - # first, copy the template dir over - from roundup.templates import builder - # copy the roundup.templates.