[Checkins] SVN: hurry.slimbox/trunk/ Initial commit. Everything works. The prepare script downloads, the tests pass. Life is good.
Souheil CHELFOUH
souheil at chelfouh.com
Sun Dec 27 11:43:51 EST 2009
Log message for revision 107176:
Initial commit. Everything works. The prepare script downloads, the tests pass. Life is good.
Changed:
A hurry.slimbox/trunk/
A hurry.slimbox/trunk/.installed.cfg
A hurry.slimbox/trunk/CHANGES.txt
A hurry.slimbox/trunk/CREDITS.txt
A hurry.slimbox/trunk/MANIFEST.in
A hurry.slimbox/trunk/README.txt
A hurry.slimbox/trunk/bootstrap.py
A hurry.slimbox/trunk/buildout.cfg
A hurry.slimbox/trunk/setup.py
A hurry.slimbox/trunk/src/
A hurry.slimbox/trunk/src/hurry/
A hurry.slimbox/trunk/src/hurry/__init__.py
A hurry.slimbox/trunk/src/hurry/slimbox/
A hurry.slimbox/trunk/src/hurry/slimbox/__init__.py
A hurry.slimbox/trunk/src/hurry/slimbox/_lib.py
A hurry.slimbox/trunk/src/hurry/slimbox/configure.zcml
A hurry.slimbox/trunk/src/hurry/slimbox/prepare.py
A hurry.slimbox/trunk/src/hurry/slimbox/slimbox.txt
A hurry.slimbox/trunk/src/hurry/slimbox/tests.py
-=-
Added: hurry.slimbox/trunk/.installed.cfg
===================================================================
--- hurry.slimbox/trunk/.installed.cfg (rev 0)
+++ hurry.slimbox/trunk/.installed.cfg 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,49 @@
+[buildout]
+installed_develop_eggs = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs/hurry.slimbox.egg-link
+parts = scripts test
+
+[scripts]
+__buildout_installed__ = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/slimboxprepare
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/fullrelease
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/postrelease
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/lasttagdiff
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/prerelease
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/release
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/longtest
+__buildout_signature__ = zc.recipe.egg-1.2.2-py2.6.egg setuptools-0.6c11-py2.6.egg zc.buildout-1.4.3-py2.6.egg
+_b = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin
+_d = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs
+_e = /home/trollfot/.buildout/eggs
+bin-directory = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin
+develop-eggs-directory = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs
+eggs = %(__buildout_space_n__)shurry.slimbox
+ zest.releaser
+eggs-directory = /home/trollfot/.buildout/eggs
+executable = /usr/bin/python
+recipe = zc.recipe.egg
+
+[test]
+__buildout_installed__ = /home/trollfot/work/sandbox/hurry.slimbox/trunk/parts/test
+ /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/test
+__buildout_signature__ = zc.recipe.testrunner-1.2.0-py2.6.egg zc.recipe.egg-1.2.2-py2.6.egg setuptools-0.6c11-py2.6.egg zope.testing-3.8.6-py2.6.egg zc.buildout-1.4.3-py2.6.egg zope.interface-LfcLj9GwWV2rtIQ8Uv5dcQ== zope.exceptions-3.5.2-py2.6.egg
+_b = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin
+_d = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs
+_e = /home/trollfot/.buildout/eggs
+bin-directory = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+develop-eggs-directory = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs
+eggs = hurry.slimbox
+eggs-directory = /home/trollfot/.buildout/eggs
+executable = /usr/bin/python
+location = /home/trollfot/work/sandbox/hurry.slimbox/trunk/parts/test
+recipe = zc.recipe.testrunner
+script = /home/trollfot/work/sandbox/hurry.slimbox/trunk/bin/test
+
+[buildout]
+installed_develop_eggs = /home/trollfot/work/sandbox/hurry.slimbox/trunk/develop-eggs/hurry.slimbox.egg-link
+
+[buildout]
+parts = test scripts
+
+[buildout]
+parts = scripts test
Added: hurry.slimbox/trunk/CHANGES.txt
===================================================================
--- hurry.slimbox/trunk/CHANGES.txt (rev 0)
+++ hurry.slimbox/trunk/CHANGES.txt 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,7 @@
+CHANGES
+*******
+
+0.1 (2009-12-27)
+================
+
+* Initial public release, using Slimbox 2.03.
Added: hurry.slimbox/trunk/CREDITS.txt
===================================================================
--- hurry.slimbox/trunk/CREDITS.txt (rev 0)
+++ hurry.slimbox/trunk/CREDITS.txt 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,7 @@
+Credit due where credit is due
+******************************
+
+Much of this package is inspired by the hurry.jquery package that in
+turn could not exist without the very cool hurry.resource
+package. Both mainly written by (the non-less cool) Martijn
+Faasen. Thanks!
Added: hurry.slimbox/trunk/MANIFEST.in
===================================================================
--- hurry.slimbox/trunk/MANIFEST.in (rev 0)
+++ hurry.slimbox/trunk/MANIFEST.in 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,2 @@
+recursive-include src/hurry/slimbox/slimbox-download *
+include src/hurry/slimbox/_lib.py
Added: hurry.slimbox/trunk/README.txt
===================================================================
--- hurry.slimbox/trunk/README.txt (rev 0)
+++ hurry.slimbox/trunk/README.txt 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,50 @@
+=============
+hurry.slimbox
+=============
+
+Introduction
+============
+
+This library packages Slimbox_ for `hurry.resource`_. It relies on
+hurry.jquery for the dependency.
+
+.. _Slimbox: http://www.digitalia.be/software/slimbox2
+.. _`hurry.resource`: http://pypi.python.org/pypi/hurry.resource
+
+
+How to use?
+===========
+
+You can import Slimbox from ``hurry.slimbox`` and ``.need`` it where you want
+these resources to be included on a page::
+
+ from hurry.slimbox import slimbox
+
+ .. in your page or widget rendering code, somewhere ..
+
+ slimbox.need()
+
+This requires integration between your web framework and ``hurry.resource``,
+and making sure that the original resources are published to some URL.
+
+The package has already been integrated for Grok_ and Zope 3. If you depend
+on the `hurry.zoperesource`_ package in your ``setup.py``, the above example
+should work out of the box. Make sure to depend on the `hurry.zoperesource`_
+package in your ``setup.py``.
+
+.. _`hurry.zoperesource`: http://pypi.python.org/pypi/hurry.zoperesource
+
+.. _Grok: http://grok.zope.org
+
+Preparing hurry.slimbox before release
+=====================================
+
+This section is only relevant to release managers of ``hurry.slimbox``.
+
+When releasing ``hurry.slimbox``, an extra step should be taken. Follow the
+regular package `release instructions`_, but before egg generation (``python
+setup.py register sdist upload``) first execute ``bin/slimboxprepare``. This
+will download the Slimbox library and place it in the egg. (The version number
+is currently hardcoded in the hurry.slimbox.prepare module).
+
+.. _`release instructions`: http://grok.zope.org/documentation/how-to/releasing-software
Added: hurry.slimbox/trunk/bootstrap.py
===================================================================
--- hurry.slimbox/trunk/bootstrap.py (rev 0)
+++ hurry.slimbox/trunk/bootstrap.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,84 @@
+##############################################################################
+#
+# 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: bootstrap.py 102545 2009-08-06 14:49:47Z chrisw $
+"""
+
+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 len(sys.argv) > 2 and sys.argv[1] == '--version':
+ VERSION = '==%s' % sys.argv[2]
+ args = sys.argv[3:] + ['bootstrap']
+else:
+ VERSION = ''
+ args = sys.argv[1:] + ['bootstrap']
+
+if is_jython:
+ import subprocess
+
+ assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+ quote(tmpeggs), 'zc.buildout' + VERSION],
+ 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' + VERSION,
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout' + VERSION)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)
Added: hurry.slimbox/trunk/buildout.cfg
===================================================================
--- hurry.slimbox/trunk/buildout.cfg (rev 0)
+++ hurry.slimbox/trunk/buildout.cfg 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,18 @@
+[buildout]
+develop = .
+parts = scripts test
+versions = versions
+
+[versions]
+zest.releaser = 3.0
+
+[scripts]
+recipe = zc.recipe.egg
+eggs =
+ hurry.slimbox
+ zest.releaser
+
+[test]
+recipe = zc.recipe.testrunner
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+eggs = hurry.slimbox
Added: hurry.slimbox/trunk/setup.py
===================================================================
--- hurry.slimbox/trunk/setup.py (rev 0)
+++ hurry.slimbox/trunk/setup.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,53 @@
+from setuptools import setup, find_packages
+import os
+
+SLIMBOX_VERSION = '2.03'
+version = '0.1'
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description = (
+ read('README.txt')
+ + '\n' +
+ read('CHANGES.txt')
+ + '\n' +
+ 'Download\n'
+ '********\n')
+
+setup(
+ name='hurry.slimbox',
+ version=version,
+ description="hurry.resource style resources for Slimbox.",
+ long_description=long_description,
+ classifiers=[],
+ keywords='',
+ author='Souheil Chelfouh',
+ author_email='trollfot at gmail.com',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ namespace_packages=['hurry'],
+ package_dir={'': 'src'},
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ 'hurry.jquery',
+ 'hurry.resource > 0.2',
+ ],
+ entry_points={
+ 'console_scripts': [
+ 'slimboxprepare = hurry.slimbox.prepare:main',
+ ],
+ 'zest.releaser.prereleaser.middle': [
+ 'prepare = hurry.slimbox.prepare:entrypoint',
+ ],
+ # ALSO grab slimbox in the separate tag checkout...
+ 'zest.releaser.releaser.middle': [
+ 'prepare = hurry.slimbox.prepare:entrypoint',
+ ],
+ },
+ extras_require={
+ 'zopesupport': ['hurry.zoperesource'],
+ },
+ )
Added: hurry.slimbox/trunk/src/hurry/__init__.py
===================================================================
--- hurry.slimbox/trunk/src/hurry/__init__.py (rev 0)
+++ hurry.slimbox/trunk/src/hurry/__init__.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,7 @@
+# this is a namespace package
+try:
+ import pkg_resources
+ pkg_resources.declare_namespace(__name__)
+except ImportError:
+ import pkgutil
+ __path__ = pkgutil.extend_path(__path__, __name__)
Added: hurry.slimbox/trunk/src/hurry/slimbox/__init__.py
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/__init__.py (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/__init__.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,5 @@
+#package
+try:
+ from hurry.slimbox._lib import slimbox_js, slimbox
+except ImportError:
+ pass
Added: hurry.slimbox/trunk/src/hurry/slimbox/_lib.py
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/_lib.py (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/_lib.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,12 @@
+from hurry.resource import Library, ResourceInclusion, GroupInclusion
+from hurry.jquery import jquery
+
+SlimboxLibrary = Library('SlimboxLibrary')
+
+slimbox_css = ResourceInclusion(
+ SlimboxLibrary, 'slimbox-2.03/css/slimbox2.css')
+
+slimbox_js = ResourceInclusion(
+ SlimboxLibrary, 'slimbox-2.03/js/slimbox2.js', depends=[jquery])
+
+slimbox = GroupInclusion([slimbox_css, slimbox_js])
Added: hurry.slimbox/trunk/src/hurry/slimbox/configure.zcml
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/configure.zcml (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/configure.zcml 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,9 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser">
+
+ <browser:resourceDirectory
+ name="SlimboxLibrary"
+ directory="slimbox-download" />
+
+</configure>
Added: hurry.slimbox/trunk/src/hurry/slimbox/prepare.py
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/prepare.py (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/prepare.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,73 @@
+import os
+import shutil
+import urllib2
+import urlparse
+import zipfile
+
+BASEURL = "http://slimbox.googlecode.com/files/"
+VERSION = '2.03'
+FULL = 'slimbox-%s.zip' % VERSION
+
+CODE = """from hurry.resource import Library, ResourceInclusion, GroupInclusion
+from hurry.jquery import jquery
+
+SlimboxLibrary = Library('SlimboxLibrary')
+
+slimbox_css = ResourceInclusion(
+ SlimboxLibrary, 'slimbox-%(version)s/css/slimbox2.css')
+
+slimbox_js = ResourceInclusion(
+ SlimboxLibrary, 'slimbox-%(version)s/js/slimbox2.js', depends=[jquery])
+
+slimbox = GroupInclusion([slimbox_css, slimbox_js])
+"""
+
+
+def unzip_file_into_dir(file, dir):
+ zfobj = zipfile.ZipFile(file)
+ for name in zfobj.namelist():
+ if name.endswith('/'):
+ os.mkdir(os.path.join(dir, name))
+ else:
+ outfile = open(os.path.join(dir, name), 'wb')
+ outfile.write(zfobj.read(name))
+ outfile.close()
+
+
+def prepare_slimbox():
+ package_dir = os.path.dirname(__file__)
+ slimbox_dest_path = os.path.join(package_dir, 'slimbox-download')
+
+ # remove previous slimbox library build
+ print 'recursivly removing "%s"' % slimbox_dest_path
+ shutil.rmtree(slimbox_dest_path, ignore_errors=True)
+ print 'create new "%s"' % slimbox_dest_path
+ os.mkdir(slimbox_dest_path)
+
+ for filename in [FULL]:
+ url = urlparse.urljoin(BASEURL, FULL)
+ print 'downloading "%s"' % url
+ f = urllib2.urlopen(url)
+ file_data = f.read()
+ f.close()
+ dest_filename = os.path.join(slimbox_dest_path, filename)
+ dest = open(dest_filename, 'wb')
+ print 'writing data to "%s"' % dest_filename
+ dest.write(file_data)
+ dest.close()
+
+ unzip_file_into_dir(dest_filename, slimbox_dest_path)
+ os.remove(dest_filename)
+
+ py_path = os.path.join(package_dir, '_lib.py')
+ module = open(py_path, 'w')
+ module.write(CODE % {'version': VERSION})
+ module.close()
+
+def main():
+ prepare_slimbox()
+
+
+def entrypoint(data):
+ """Entry point for zest.releaser's prerelease script"""
+ prepare_slimbox()
Added: hurry.slimbox/trunk/src/hurry/slimbox/slimbox.txt
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/slimbox.txt (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/slimbox.txt 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,31 @@
+"""
+hurry.slimbox basic tests
+========================
+
+Here are some basic tests for hurry.slimbox.
+
+Let's set up a way to render URLs; typically the framework has already
+done this::
+
+ >>> def get_library_url(library):
+ ... return 'http://localhost/static/%s' % (library.name)
+ >>> from hurry.resource import Library
+ >>> from hurry.resource.interfaces import ILibraryUrl
+ >>> from zope import component
+ >>> # register the ILibraryUrl adaptation for the tests.
+ >>> component.provideAdapter(
+ ... factory=get_library_url, adapts=(Library,), provides=ILibraryUrl)
+
+Render the inclusion::
+
+ >>> from hurry.resource import NeededInclusions
+ >>> from hurry.slimbox import slimbox
+ >>> needed = NeededInclusions()
+ >>> needed.need(slimbox)
+ >>> print needed.render()
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/SlimboxLibrary/slimbox-2.03/css/slimbox2.css" />
+ <script type="text/javascript" src="http://localhost/static/jquery/jquery-1.3.2.js"></script>
+ <script type="text/javascript"
+ src="http://localhost/static/SlimboxLibrary/slimbox-2.03/js/slimbox2.js"></script>
+
+"""
Added: hurry.slimbox/trunk/src/hurry/slimbox/tests.py
===================================================================
--- hurry.slimbox/trunk/src/hurry/slimbox/tests.py (rev 0)
+++ hurry.slimbox/trunk/src/hurry/slimbox/tests.py 2009-12-27 16:43:50 UTC (rev 107176)
@@ -0,0 +1,9 @@
+import unittest, doctest
+
+def test_suite():
+ globs = {}
+ optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+ suite = unittest.TestSuite()
+ suite.addTest(doctest.DocFileSuite(
+ 'slimbox.txt', globs=globs, optionflags=optionflags))
+ return suite
More information about the checkins
mailing list