Browse files

Buildout bootstrap setup.

  • Loading branch information...
0 parents commit 4391a39ee4cde31ff9c9a56cd8d452b934136b4e @jacobian jacobian committed Apr 12, 2009
9 .gitignore
@@ -0,0 +1,9 @@
+*.pyc
+*.pyo
+.installed.cfg
+bin
+develop-eggs
+downloads
+eggs
+parts
+src/*.egg-info
27 LICENSE
@@ -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.
15 README
@@ -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
+
78 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)
13 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}
31 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',
+ ]
+)
0 src/shorturls/__init__.py
No changes.
1 src/shorturls/models.py
@@ -0,0 +1 @@
+# This file intentionally left blank.
1 src/shorturls/tests/__init__.py
@@ -0,0 +1 @@
+from test_views import *
3 src/shorturls/tests/models.py
@@ -0,0 +1,3 @@
+"""
+A handful of test modules to test out resolving redirects.
+"""
5 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)
3 src/shorturls/testsettings.py
@@ -0,0 +1,3 @@
+DATABASE_ENGINE = 'sqlite3'
+DATABASE_NAME = '/tmp/shorturls.db'
+INSTALLED_APPS = ['shorturls']

0 comments on commit 4391a39

Please sign in to comment.