diff options
| author | Jacob Kaplan-Moss | 2009-04-12 15:02:44 -0500 | 
|---|---|---|
| committer | Jacob Kaplan-Moss | 2009-04-12 15:02:44 -0500 | 
| commit | 4391a39ee4cde31ff9c9a56cd8d452b934136b4e (patch) | |
| tree | 2404ec68497730360482d78c523f25f03855ab84 | |
| download | django-shorturls-4391a39ee4cde31ff9c9a56cd8d452b934136b4e.tar.bz2 | |
Buildout bootstrap setup.
| -rw-r--r-- | .gitignore | 9 | ||||
| -rw-r--r-- | LICENSE | 27 | ||||
| -rw-r--r-- | README | 15 | ||||
| -rwxr-xr-x | bootstrap.py | 78 | ||||
| -rw-r--r-- | buildout.cfg | 13 | ||||
| -rw-r--r-- | setup.py | 31 | ||||
| -rw-r--r-- | src/shorturls/__init__.py | 0 | ||||
| -rw-r--r-- | src/shorturls/models.py | 1 | ||||
| -rw-r--r-- | src/shorturls/tests/__init__.py | 1 | ||||
| -rw-r--r-- | src/shorturls/tests/models.py | 3 | ||||
| -rw-r--r-- | src/shorturls/tests/test_views.py | 5 | ||||
| -rw-r--r-- | src/shorturls/testsettings.py | 3 | 
12 files changed, 186 insertions, 0 deletions
| diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd54d38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.pyc +*.pyo +.installed.cfg +bin +develop-eggs +downloads +eggs +parts +src/*.egg-info
\ No newline at end of file @@ -0,0 +1,27 @@ +Copyright (c) 2008 Simon Willison and Jacob Kaplan-Moss +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +    1. Redistributions of source code must retain the above copyright notice,  +       this list of conditions and the following disclaimer. +     +    2. Redistributions in binary form must reproduce the above copyright  +       notice, this list of conditions and the following disclaimer in the +       documentation and/or other materials provided with the distribution. + +    3. Neither the name of this project nor the names of its contributors may be +       used to endorse or promote products derived from this software without +       specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file @@ -0,0 +1,15 @@ +django-shorturls +================ + +A custom URL shortening app for Django, including easy ``rev=cannonical`` +support. + +Most code was originally by Simon Willison; see +http://simonwillison.net/2009/Apr/11/revcanonical/ for details. Improved +slightly and packaged by Jacob Kaplan-Moss. + +Usage +===== + +XXX + diff --git a/bootstrap.py b/bootstrap.py new file mode 100755 index 0000000..4609955 --- /dev/null +++ b/bootstrap.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +############################################################################## +# +# Copyright (c) 2006 Zope Corporation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Bootstrap a buildout-based project + +Simply run this script in a directory containing a buildout.cfg. +The script accepts buildout command-line options, so you can +use the -c option to specify an alternate configuration file. + +$Id$ +""" + +import os, shutil, sys, tempfile, urllib2 + +tmpeggs = tempfile.mkdtemp() + +is_jython = sys.platform.startswith('java') + +try: +    import pkg_resources +except ImportError: +    ez = {} +    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py' +                         ).read() in ez +    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0) + +    import pkg_resources + +if sys.platform == 'win32': +    def quote(c): +        if ' ' in c: +            return '"%s"' % c # work around spawn lamosity on windows +        else: +            return c +else: +    def quote (c): +        return c + +cmd = 'from setuptools.command.easy_install import main; main()' +ws  = pkg_resources.working_set + +if is_jython: +    import subprocess +     +    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',  +           quote(tmpeggs), 'zc.buildout'],  +           env=dict(os.environ, +               PYTHONPATH= +               ws.find(pkg_resources.Requirement.parse('setuptools')).location +               ), +           ).wait() == 0 + +else: +    assert os.spawnle( +        os.P_WAIT, sys.executable, quote (sys.executable), +        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout', +        dict(os.environ, +            PYTHONPATH= +            ws.find(pkg_resources.Requirement.parse('setuptools')).location +            ), +        ) == 0 + +ws.add_entry(tmpeggs) +ws.require('zc.buildout') +import zc.buildout.buildout +zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap']) +shutil.rmtree(tmpeggs) diff --git a/buildout.cfg b/buildout.cfg new file mode 100644 index 0000000..bd57fe1 --- /dev/null +++ b/buildout.cfg @@ -0,0 +1,13 @@ +[buildout] +parts = django +develop = . +eggs = django-shorturls + +[django] +recipe = djangorecipe +version = 1.0.2 +projectegg = shorturls +project = shorturls +settings = testsettings +test = shorturls +eggs = ${buildout:eggs}
\ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..98f27ec --- /dev/null +++ b/setup.py @@ -0,0 +1,31 @@ +import os +from setuptools import setup, find_packages + +def read(fname): +    return open(os.path.join(os.path.dirname(__file__), fname)).read() + +setup( +    name = "django-shorturls", +    version = "1.0", +    url = 'http://github.com/jacobian/django-shorturls', +    license = 'BSD', +    description = "A short URL (rev=cannonical) handler for Django apps.", +    long_description = read('README'), + +    author = 'Simon Willison, Jacob Kaplan-Moss', +    author_email = 'jacob@jacobian.org', + +    packages = find_packages('src'), +    package_dir = {'': 'src'}, +     +    install_requires = ['setuptools'], + +    classifiers = [ +        'Development Status :: 4 - Beta', +        'Intended Audience :: Developers', +        'License :: OSI Approved :: BSD License', +        'Operating System :: OS Independent', +        'Programming Language :: Python', +        'Topic :: Internet', +    ] +)
\ No newline at end of file diff --git a/src/shorturls/__init__.py b/src/shorturls/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/shorturls/__init__.py diff --git a/src/shorturls/models.py b/src/shorturls/models.py new file mode 100644 index 0000000..17ab7c1 --- /dev/null +++ b/src/shorturls/models.py @@ -0,0 +1 @@ +# This file intentionally left blank.
\ No newline at end of file diff --git a/src/shorturls/tests/__init__.py b/src/shorturls/tests/__init__.py new file mode 100644 index 0000000..d983d15 --- /dev/null +++ b/src/shorturls/tests/__init__.py @@ -0,0 +1 @@ +from test_views import *
\ No newline at end of file diff --git a/src/shorturls/tests/models.py b/src/shorturls/tests/models.py new file mode 100644 index 0000000..f521e56 --- /dev/null +++ b/src/shorturls/tests/models.py @@ -0,0 +1,3 @@ +""" +A handful of test modules to test out resolving redirects. +"""
\ No newline at end of file diff --git a/src/shorturls/tests/test_views.py b/src/shorturls/tests/test_views.py new file mode 100644 index 0000000..8fa11a4 --- /dev/null +++ b/src/shorturls/tests/test_views.py @@ -0,0 +1,5 @@ +from django.test import TestCase + +class RedirectViewTestCase(TestCase): +    def test_this_is_working(self): +        self.assertEquals(1, 1)
\ No newline at end of file diff --git a/src/shorturls/testsettings.py b/src/shorturls/testsettings.py new file mode 100644 index 0000000..5ce99da --- /dev/null +++ b/src/shorturls/testsettings.py @@ -0,0 +1,3 @@ +DATABASE_ENGINE = 'sqlite3' +DATABASE_NAME = '/tmp/shorturls.db' +INSTALLED_APPS = ['shorturls']
\ No newline at end of file | 
