Changeset 3778

Show
Ignore:
Timestamp:
11/27/07 17:43:56 (1 year ago)
Author:
carndt
Message:

Fix #1386 by turning start script into an entry point and adding 'commands' module to new projects

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/CHANGELOG.txt

    r3766 r3778  
    1919  the shipped MochiKit 1.3.1. That allows to include custom mochikit versions. 
    2020* PaginateDataGrid template now makes use of paginate attributes to render 
    21   the links for first/previous/next/last page
     21  the links for first/previous/next/last page (#1617)
    2222* ``paginate.href_last`` returns a special URL that allows paginate decorator 
    23   to compute the correct last page number at server-side. 
     23  to compute the correct last page number at server-side (#1617). 
     24* The ``start-<project>.py`` script in a quickstarted project is now only a 
     25  wrapper for the ``start()`` function in a new ``commands`` module in the  
     26  project's package. The ``setup.py`` in new project also creates a console 
     27  script entry point for this, so easy_install can create a start script 
     28  when the project's egg is installed. It also allows to package a default 
     29  configuration file in the egg. For details see ticket #1386. 
     30* Installation of TurboGears now does not require installation of an ORM. 
     31  Instead, a project that relies on SQLObject or SQLAlchemy will have a 
     32  ``setup.py`` file written with the proper requirements (#1501,#1620). 
    2433 
    2534Features 
    2635~~~~~~~~ 
    2736 
    28 * Introduction of tg.mochikit_suppress to prevent the inclusion of 
    29   the shipped MochiKit 1.3.1. That allows to include custom mochikit versions. 
     37* Introduction of tg.mochikit_suppress to (see "Changes"). 
    3038* Workaround in paginate for databases without ``OFFSET`` (#1601). 
    3139* The database module exports a mapper which is either session.mapper 
     
    7886~~~~~~~~~~~~ 
    7987 
    80 Joel Pearson, Christoph Zwerschke, Roger Demetrescu, Juan Germano
    81 Diez B. Roggisch
     88Florent Aide, Christopher Arndt, Roger Demetrescu, Juan Germano, Joel Pearson
     89Diez B. Roggisch, Christoph Zwerschke
    8290 
    8391 
  • branches/1.0/turbogears/qstemplates/quickstart/setup.py_tmpl

    r3772 r3778  
     1# -*- coding: UTF-8 -*- 
     2 
    13from setuptools import setup, find_packages 
    24from turbogears.finddata import find_package_data 
     
    3335#end if 
    3436    ], 
    35     scripts=["start-${package}.py"], 
    3637    zip_safe=False, 
    3738    packages=packages, 
     
    7172    ], 
    7273    test_suite='nose.collector', 
     74    entry_points = { 
     75        'console_scripts': [ 
     76            'start-${package} = ${package}.commands:start', 
     77        ], 
     78    }, 
     79    # Uncomment next line and create a default.cfg file in your project dir 
     80    # if you want to package a default configuration in your egg. 
     81    #data_files = [('config', ['default.cfg'])], 
    7382    ) 
    7483 
  • branches/1.0/turbogears/qstemplates/quickstart/start-+package+.py_tmpl

    r3063 r3778  
    11#!${sys_executable} 
    2 import pkg_resources 
    3 pkg_resources.require("TurboGears") 
     2# -*- coding: UTF-8 -*- 
     3"""Start script for the ${project} TurboGears project. 
    44 
    5 from turbogears import config, update_config, start_server 
    6 import cherrypy 
    7 cherrypy.lowercase_api = True 
    8 from os.path import * 
     5This script is only needed during development for running from the project  
     6directory. When the project is installed, easy_install will create a 
     7proper start script. 
     8""" 
     9 
    910import sys 
     11from ${package}.commands import start, ConfigurationError 
    1012 
    11 # first look on the command line for a desired config file, 
    12 # if it's not on the command line, then 
    13 # look for setup.py in this directory. If it's not there, this script is 
    14 # probably installed 
    15 if len(sys.argv) > 1: 
    16     update_config(configfile=sys.argv[1], 
    17         modulename="${package}.config") 
    18 elif exists(join(dirname(__file__), "setup.py")): 
    19     update_config(configfile="dev.cfg",modulename="${package}.config") 
    20 else: 
    21     update_config(configfile="prod.cfg",modulename="${package}.config") 
    22 config.update(dict(package="${package}")) 
    23  
    24 from ${package}.controllers import Root 
    25  
    26 start_server(Root()) 
     13if __name__ == "__main__": 
     14    try: 
     15        start() 
     16    except ConfigurationError, exc: 
     17        sys.stderr.write(str(exc)) 
     18        sys.exit(1)