[Checkins] SVN: hurry.jquerytools/ initial import

Christian Klinger cklinger at novareto.de
Wed Mar 10 03:57:57 EST 2010


Log message for revision 109883:
  initial import

Changed:
  A   hurry.jquerytools/branches/
  A   hurry.jquerytools/tags/
  A   hurry.jquerytools/trunk/
  A   hurry.jquerytools/trunk/CHANGES.txt
  A   hurry.jquerytools/trunk/CREDITS.txt
  A   hurry.jquerytools/trunk/MANIFEST.in
  A   hurry.jquerytools/trunk/README.txt
  A   hurry.jquerytools/trunk/bootstrap.py
  A   hurry.jquerytools/trunk/buildout.cfg
  A   hurry.jquerytools/trunk/setup.py
  A   hurry.jquerytools/trunk/src/
  A   hurry.jquerytools/trunk/src/hurry/
  A   hurry.jquerytools/trunk/src/hurry/__init__.py
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/__init__.py
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/configure.zcml
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/jquerytools.txt
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/prepare.py
  A   hurry.jquerytools/trunk/src/hurry/jquerytools/tests.py

-=-
Added: hurry.jquerytools/trunk/CHANGES.txt
===================================================================
--- hurry.jquerytools/trunk/CHANGES.txt	                        (rev 0)
+++ hurry.jquerytools/trunk/CHANGES.txt	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,7 @@
+CHANGES
+*******
+
+0.1 (2010-03-10)
+================
+
+* Initial public release, using jquerytools-1.1.2

Added: hurry.jquerytools/trunk/CREDITS.txt
===================================================================
--- hurry.jquerytools/trunk/CREDITS.txt	                        (rev 0)
+++ hurry.jquerytools/trunk/CREDITS.txt	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,4 @@
+Credit due where credit is due
+******************************
+
+Inspiration by hurry.jquery from Martijn Faasen. 

Added: hurry.jquerytools/trunk/MANIFEST.in
===================================================================
--- hurry.jquerytools/trunk/MANIFEST.in	                        (rev 0)
+++ hurry.jquerytools/trunk/MANIFEST.in	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1 @@
+recursive-include src/hurry/jquerytools/jquerytools-build *

Added: hurry.jquerytools/trunk/README.txt
===================================================================
--- hurry.jquerytools/trunk/README.txt	                        (rev 0)
+++ hurry.jquerytools/trunk/README.txt	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,53 @@
+=================
+hurry.jquerytools
+=================
+
+Introduction
+============
+
+This library packages Slimbox_ for `hurry.resource`_. It relies on
+hurry.jquery for the dependency.
+
+.. _jquerytools: http://flowplayer.org/tools/index.html 
+.. _`hurry.resource`: http://pypi.python.org/pypi/hurry.resource
+
+Please take note that for now only the minified version of jquerytools is used.
+This is because i don't found a proper download location for the different
+versions of download.
+
+How to use?
+===========
+
+You can import Slimbox from ``hurry.jquerytools`` and ``.need`` it where you want
+these resources to be included on a page::
+
+  from hurry.jquerytools import jquerytools
+
+  .. in your page or widget rendering code, somewhere ..
+
+  jquerytools.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.jquerytools before release
+==========================================
+
+This section is only relevant to release managers of ``hurry.jquerytools``.
+
+When releasing ``hurry.jquerytools``, 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/jquerytoolsprepare``. This
+will download the Slimbox library and place it in the egg. (The version number
+is currently hardcoded in the hurry.jquerytools.prepare module).
+
+.. _`release instructions`: http://grok.zope.org/documentation/how-to/releasing-software

Added: hurry.jquerytools/trunk/bootstrap.py
===================================================================
--- hurry.jquerytools/trunk/bootstrap.py	                        (rev 0)
+++ hurry.jquerytools/trunk/bootstrap.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -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.jquerytools/trunk/buildout.cfg
===================================================================
--- hurry.jquerytools/trunk/buildout.cfg	                        (rev 0)
+++ hurry.jquerytools/trunk/buildout.cfg	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,18 @@
+[buildout]
+develop = .
+parts = scripts test
+versions = versions
+
+[versions]
+zest.releaser = 3.0
+
+[scripts]
+recipe = zc.recipe.egg
+eggs = 
+    hurry.jquerytools
+    zest.releaser
+
+[test]
+recipe = zc.recipe.testrunner
+defaults = ['--tests-pattern', '^f?tests$', '-v']
+eggs = hurry.jquerytools

Added: hurry.jquerytools/trunk/setup.py
===================================================================
--- hurry.jquerytools/trunk/setup.py	                        (rev 0)
+++ hurry.jquerytools/trunk/setup.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,50 @@
+from setuptools import setup, find_packages
+import os
+
+JQUERYTOOLS_VERSION = '1.1.2'
+version = '1.1.2'
+
+def read(*rnames):
+    return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+long_description = (
+    read('README.txt')
+    + '\n' +
+    read('CHANGES.txt'))
+
+setup(
+    name='hurry.jquerytools',
+    version=version,
+    description="hurry.resource style resources for jquerytools.",
+    long_description=long_description,
+    classifiers=[],
+    keywords='jQuery jquerytools Zope3 Popup',
+    author='Christian Klinger',
+    author_email='cklinger at novareto.de',
+    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.4.1',
+        ],
+    entry_points={
+        'console_scripts': [
+            'jquerytoolsprepare = hurry.jquerytools.prepare:main',
+            ],
+        'zest.releaser.prereleaser.middle': [
+            'prepare = hurry.jquerytools.prepare:entrypoint',
+            ],
+        # ALSO grab jquerytools in the separate tag checkout...
+        'zest.releaser.releaser.middle': [
+            'prepare = hurry.jquerytools.prepare:entrypoint',
+            ],
+        },
+    extras_require={
+        'zopesupport': ['hurry.zoperesource'],
+        },
+    )

Added: hurry.jquerytools/trunk/src/hurry/__init__.py
===================================================================
--- hurry.jquerytools/trunk/src/hurry/__init__.py	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/__init__.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -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.jquerytools/trunk/src/hurry/jquerytools/__init__.py
===================================================================
--- hurry.jquerytools/trunk/src/hurry/jquerytools/__init__.py	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/jquerytools/__init__.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,8 @@
+from hurry.resource import Library, ResourceInclusion, GroupInclusion
+from hurry.jquery import jquery
+
+JqueryToolsLibrary = Library('JqueryToolsLibrary')
+
+jquerytools = ResourceInclusion(
+    JqueryToolsLibrary, 'jquery.tools.min.js', depends=[jquery])
+

Added: hurry.jquerytools/trunk/src/hurry/jquerytools/configure.zcml
===================================================================
--- hurry.jquerytools/trunk/src/hurry/jquerytools/configure.zcml	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/jquerytools/configure.zcml	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,11 @@
+<configure
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:browser="http://namespaces.zope.org/browser">
+
+  <include package="hurry.jquery" />
+
+  <browser:resourceDirectory
+      name="JqueryToolsLibrary"
+      directory="jquerytools-build" />
+
+</configure>

Added: hurry.jquerytools/trunk/src/hurry/jquerytools/jquerytools.txt
===================================================================
--- hurry.jquerytools/trunk/src/hurry/jquerytools/jquerytools.txt	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/jquerytools/jquerytools.txt	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,29 @@
+"""
+hurry.jquerytools 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.jquerytools import jquerytools 
+  >>> needed = NeededInclusions()
+  >>> needed.need(jquerytools)
+  >>> print needed.render()
+  <script type="text/javascript" src="http://localhost/static/jquery/jquery-1.3.2.js"></script>
+  <script type="text/javascript" src="http://localhost/static/JqueryToolsLibrary/jquery.tools.min.js"></script>
+
+"""

Added: hurry.jquerytools/trunk/src/hurry/jquerytools/prepare.py
===================================================================
--- hurry.jquerytools/trunk/src/hurry/jquerytools/prepare.py	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/jquerytools/prepare.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,38 @@
+import os
+import shutil
+import urllib2
+import urlparse
+import zipfile
+
+VERSION = '1.1.2'
+BASEURL = "http://cdn.jquerytools.org/%s/tiny/jquery.tools.min.js" %VERSION
+FILENAME = "jquery.tools.min.js"
+
+def prepare_jquerytools():
+    jquerytools_dest_path = os.path.dirname(__file__)
+    library_path = os.path.join(jquerytools_dest_path, "jquery-build")
+
+    # remove previous slimbox library
+    print 'recursivly removing "%s"' % library_path
+    shutil.rmtree(library_path, ignore_errors=True)
+
+    url = BASEURL
+    print 'downloading "%s"' % url
+    f = urllib2.urlopen(url)
+    file_data = f.read()
+    f.close()
+    dest_filename = os.path.join(jquerytools_dest_path, FILENAME)
+    dest = open(dest_filename, 'wb')
+    print 'writing data to "%s"' % dest_filename
+    dest.write(file_data)
+    dest.close()
+    os.mkdir(library_path)
+    shutil.move(dest_filename, library_path)
+
+def main():
+    prepare_jquerytools()
+
+
+def entrypoint(data):
+    """Entry point for zest.releaser's prerelease script"""
+    prepare_jquerytools()

Added: hurry.jquerytools/trunk/src/hurry/jquerytools/tests.py
===================================================================
--- hurry.jquerytools/trunk/src/hurry/jquerytools/tests.py	                        (rev 0)
+++ hurry.jquerytools/trunk/src/hurry/jquerytools/tests.py	2010-03-10 08:57:57 UTC (rev 109883)
@@ -0,0 +1,9 @@
+import unittest, doctest
+
+def test_suite():
+    globs = {}
+    optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+    suite = unittest.TestSuite()
+    suite.addTest(doctest.DocFileSuite(
+        'jquerytools.txt', globs=globs, optionflags=optionflags))
+    return suite



More information about the checkins mailing list