Skip to content

Commit

Permalink
/trunk as root of distribution
Browse files Browse the repository at this point in the history
--HG--
extra : convert_revision : svn%3A77541ad4-5f01-0410-9ede-a1b63cd9a898/trunk%403164
  • Loading branch information
alberto committed Jun 27, 2007
0 parents commit 662968e
Show file tree
Hide file tree
Showing 54 changed files with 2,228 additions and 0 deletions.
60 changes: 60 additions & 0 deletions INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
TurboGears2 Installation Guide
===============================

.. Note:: At current stage TurboGears2 is avaliable for developers.

Requirements
------------
To install TurboGears2, the following software packages must be installed:

* Python, version >= 2.3.
+ Please keep in mind, that for RPM-based systems you will also need
python-devel and python-xml packages.
* Pylons version > 0.9.5


Installing TurboGears2
-----------------------
The command:

$ python ./setup.py install

will byte-compile the python source code and install it in the
site-packages directory of your python installation.

Another way is getting the source from svn::

$ svn co http://svn.turbogears.org/branch/pygears pygears

and install the source in development mode::

$ python ./setup.py develop

Update the source
-----------------

To update the source to the current develop version. Enter the pygears folder and type the command::

$ svn update

Running the Demo
-----------------

TurboGears2 is built on Pylons and share pylons' "paster" commands.

enter the blogtutorial folder and type::

$ paster serve development.ini

Browse http://127.0.0.1:8080 for demo.


Creating a Quickstart Project
------------------------------

The command::

$ paster quickstart

will generate the quickstart templates for you.

15 changes: 15 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
TurboGears2
===========

Next generation Front-to-back web development megaframework built on Pylons.

TurboGears2, which provides a comprehensive web development toolkit,
is a web framework that could create a database-driven,
ready-to-extend application in minutes.
All with designer friendly templates, easy AJAX on the browser side and on the server side,
not a single SQL query in sight with code that is as natural as writing a function.

TurboGears is licensed under an MIT-style license (see LICENSE.txt).
Other incorporated projects may be licensed under different licenses.
All licenses allow for non-commercial and commercial use.

3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[egg_info]
tag_build = dev
tag_svn_revision = true
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from setuptools import setup, find_packages
import sys, os

version = '0.1'

setup(
name='TurboGears2',
version=version,
description='Next generation TurboGears',
long_description='Next generation TurboGears built on Pylons',
classifiers=[],
keywords='turbogears pylons',
author='Mark Ramm',
author_email='mark.ramm@gmail.com',
url='http://www.turbogears.org/',
license='MIT',
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=[
'PasteScript>=1.3',
'Pylons>0.9.5'
],
entry_points='''
[paste.paster_create_template]
turbogears2=tg.pastetemplate:TurboGearsTemplate
[paste.global_paster_command]
quickstart = tg.command.quickstart:quickstart
''',
)
2 changes: 2 additions & 0 deletions tg/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from controllers import TurboGearsController
from decorators import expose, validate
Empty file added tg/command/__init__.py
Empty file.
108 changes: 108 additions & 0 deletions tg/command/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"Commands for the TurboGears command line tool."
import optparse
import sys
import os
import pkg_resources
import turbogears
from turbogears.util import load_project_config, get_project_config


sys.path.insert(0, os.getcwd())


def silent_os_remove(fname):
"""
Tries to remove file FNAME but mutes any error that may happen.
Returns True if file was actually removed and false otherwise
"""
try:
os.remove(fname)
return True
except os.error:
pass
return False

class CommandWithDB(object):
"Base class for commands that need to use the database"
config = None

def __init__(self, version):
pass

def find_config(self):
"""Chooses the config file, trying to guess whether this is a
development or installed project."""
load_project_config(self.config)
self.dburi = turbogears.config.get("sqlobject.dburi", None)
if self.dburi and self.dburi.startswith("notrans_"):
self.dburi = self.dburi[8:]

commands = None

def main():
"Main command runner. Manages the primary command line arguments."
# add commands defined by entrypoints
commands = {}
for entrypoint in pkg_resources.iter_entry_points("turbogears.command"):
command = entrypoint.load()
commands[entrypoint.name] = (command.desc, entrypoint)

def _help():
"Custom help text for tg-admin."

print """
TurboGears %s command line interface
Usage: %s [options] <command>
Options:
-c CONFIG --config=CONFIG Config file to use
-e EGG_SPEC --egg=EGG_SPEC Run command on given Egg
Commands:""" % (turbogears.__version__, sys.argv[0])

longest = max([len(key) for key in commands.keys()])
format = "%" + str(longest) + "s %s"
commandlist = commands.keys()
commandlist.sort()
for key in commandlist:
print format % (key, commands[key][0])


parser = optparse.OptionParser()
parser.allow_interspersed_args = False
parser.add_option("-c", "--config", dest="config")
parser.add_option("-e", "--egg", dest="egg")
parser.print_help = _help
(options, args) = parser.parse_args(sys.argv[1:])

# if not command is found display help
if not args or not commands.has_key(args[0]):
_help()
sys.exit()

commandname = args[0]
# strip command and any global options from the sys.argv
sys.argv = [sys.argv[0],] + args[1:]
command = commands[commandname][1]
command = command.load()

if options.egg:
egg = pkg_resources.get_distribution(options.egg)
os.chdir(egg.location)

if hasattr(command,"need_project"):
if not turbogears.util.get_project_name():
print "This command needs to be run from inside a project directory"
return
elif not options.config and not os.path.isfile(get_project_config()):
print """No default config file was found.
If it has been renamed use:
tg-admin --config=<FILE> %s""" % commandname
return
command.config = options.config
command = command(turbogears.__version__)
command.run()

__all__ = ["main"]
Loading

0 comments on commit 662968e

Please sign in to comment.