1
0
Fork 0

- more setuptools magic

- move configuration to config files
 - default configuration in defaults.cfg
 - site configuration in gva.cfg


git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@221 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
Jan Dittberner 2007-02-13 18:18:09 +00:00
parent bd306389f0
commit 3f099c72ff
5 changed files with 37 additions and 39 deletions

View File

@ -19,16 +19,16 @@
# #
# Version: $Id$ # Version: $Id$
"""Distributed default settings for significant GnuviechAdmin config # Distributed default settings for significant GnuviechAdmin config
variables.""" # variables.
#
# NEVER make site configuration changes to this file. ALWAYS make # NEVER make site configuration changes to this file. ALWAYS make
# them in gva_cfg.py instead, in the designated area. See the # them in gva.cfg instead, in the designated area. See the comments
# comments in that file for details. # in that file for details.
#---------------------------------------------------------------------- [database]
# The database connection string in a format usable for # The database connection string in a format usable for
# sqlalchemy. The default is an sqlite in memory database which is not # sqlalchemy. The default is an sqlite in memory database which is not
# very usable for a real installation. # very usable for a real installation.
# #
GVA_DBE = 'sqlite:///:memory:' uri = sqlite:///:memory:

View File

@ -19,30 +19,9 @@
# #
# Version: $Id$ # Version: $Id$
"""This is the module which takes your site-specific settings. [database]
From a raw distribution it should be copied to gva_cfg.py. If you
already have a gva_cfg.py, be careful to add in only the new settings
you want. The complete set of distributed defaults, with annotation,
are in ./Defaults. In mm_cfg, override only those you want to change,
after the
from Defaults import *
line (see below)."""
###############################################################
# Here's where we get the distributed defaults. #
from Defaults import *
###############################################################
# Put YOUR site-specific configuration below, in gva_cfg.py . #
# See Defaults.py for explanations of the values. #
#--------------------------------------------------------------
# The database connection string in a format usable for # The database connection string in a format usable for
# sqlalchemy. For examples see # sqlalchemy. For examples see
# http://www.sqlalchemy.org/docs/dbengine.myt # http://www.sqlalchemy.org/docs/dbengine.myt
# #
GVA_DBE = 'sqlite:///database.txt' uri = sqlite:///database.txt

View File

@ -20,9 +20,19 @@
# Version: $Id$ # Version: $Id$
from sqlalchemy import * from sqlalchemy import *
from gnuviechadmin import gva_cfg from pkg_resources import Requirement, resource_filename
import ConfigParser, os
meta = BoundMetaData(gva_cfg.GVA_DBE) config = ConfigParser.ConfigParser()
config.readfp(
open(resource_filename(Requirement.parse('gnuviechadmin'),
'gnuviechadmin/defaults.cfg')))
config.read([
resource_filename(Requirement.parse('gnuviechadmin'),
'gnuviechadmin/gva.cfg'),
os.path.expanduser('~/.gva.cfg')])
meta = BoundMetaData(config.get('database', 'uri'))
client_table = Table( client_table = Table(
'client', meta, 'client', meta,
Column('clientid', Integer, primary_key=True), Column('clientid', Integer, primary_key=True),

3
setup.cfg Normal file
View File

@ -0,0 +1,3 @@
[egg_info]
tag_build = .dev
tag_svn_revision = 1

View File

@ -20,7 +20,7 @@
# #
# Version: $Id$ # Version: $Id$
from setuptools import setup,find_packages from setuptools import setup, find_packages
try: try:
import buildutils import buildutils
@ -30,15 +30,21 @@ except ImportError:
setup( setup(
name = 'gnuviechadmin', name = 'gnuviechadmin',
version = '0.1', version = '0.1',
packages = find_packages(),
scripts = ['bin/createclient', 'bin/listclients'],
install_requires = ['sqlalchemy >= 0.3.0'],
setup_requires = [],
include_package_data = True,
exclude_package_data = { '' : ['gva.cfg'] },
author = 'Jan Dittberner',
author_email = 'jan@dittberner.info',
description = 'gnuviechadmin server administration suite', description = 'gnuviechadmin server administration suite',
long_description = """this is a suite of tools for administering a server long_description = """this is a suite of tools for administering a server
it contains tools for maintaining e.g. clients, domains, users, mail it contains tools for maintaining e.g. clients, domains, users, mail
accounts""", accounts""",
author = 'Jan Dittberner',
author_email = 'jan@dittberner.info',
url = 'http://www.gnuviech-server.de/gnuviechadmin',
packages = ['gnuviechadmin'],
scripts = ['bin/createclient', 'bin/listclients'],
install_requires = ['sqlalchemy >= 0.3.0'],
license= 'GPL', license= 'GPL',
url = 'http://www.gnuviech-server.de/gnuviechadmin',
) )