[Checkins] SVN: grokcore.component/trunk/ Moved to GitHub.
Stephen Richter
cvs-admin at zope.org
Fri Mar 1 13:37:42 UTC 2013
Log message for revision 129941:
Moved to GitHub.
Changed:
D grokcore.component/trunk/CHANGES.txt
D grokcore.component/trunk/COPYRIGHT.txt
D grokcore.component/trunk/CREDITS.txt
D grokcore.component/trunk/INSTALL.txt
D grokcore.component/trunk/LICENSE.txt
A grokcore.component/trunk/MOVED_TO_GITHUB
D grokcore.component/trunk/README.txt
D grokcore.component/trunk/TODO.txt
D grokcore.component/trunk/bootstrap.py
D grokcore.component/trunk/buildout.cfg
D grokcore.component/trunk/setup.py
D grokcore.component/trunk/src/
-=-
Deleted: grokcore.component/trunk/CHANGES.txt
===================================================================
--- grokcore.component/trunk/CHANGES.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/CHANGES.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,216 +0,0 @@
-Changes
-=======
-
-2.6 (unreleased)
-----------------
-
-- Nothing changed yet.
-
-
-2.5 (2012-05-01)
-----------------
-
-- Introduce provideUtility, providerAdapter, provideSubscriptionAdapter,
- provideHandler and provideInterface in grokcore.component. These by default
- delegate the registration of components to the global site manager like
- was done before, but provide the possibility for custom registries for the
- grokked components.
-
-- Fix the `global_adapter` to properly use information annotated by
- ``grok.adapter``, and using the IContext object if it was not
- specified. (Fix Launchpad issue #960097).
-
-- Add a ``key`` option to ``sort_components`` that behave like ``key``
- options available on standard Python sort methods.
-
-2.4 (2011-04-27)
-----------------
-
-- Fix the `global_adapter` directive implementation to accept an explicit
- "empty" name for nameless adapter registrations (as it used to be that
- providing an empty name in the registration would actually result in
- registering a named adapter in case the factory has a `grok.name`).
-
-2.3 (2011-02-14)
-----------------
-
-- Implement the generic (Multi)Subscriptions components.
-
-2.2 (2010-11-03)
-----------------
-
-- The default values computation for the context directive and the provides
- directive is now defined in the directives themselves. This means that where
- the values for these directives is being retrieved, the "default_context"
- function does not need to be passed along anymore for general cases.
-
- Analogous to this, when getting values for the provides directive the
- "default_provides" function does not need to be passed along in the general
- case.
-
-2.1 (2010-11-01)
-----------------
-
-* Made package comply to zope.org repository policy.
-
-* Moved directives 'order' from grokcore.viewlet and 'path' from
- grokcore.view to this very package.
-
-* Tiny dependency adjustment: moved zope.event to test dependencies.
-
-* Port from 1.x branch exclude parameter to the Grok ZCML directive.
-
-* Port from 1.x branch the ignore of testing.py modules.
-
-2.0 (2009-09-16)
-----------------
-
-* Use a newer version of Martian that has better support for
- inheritance. This is demonstrated in ``tests/inherit``.
-
-* The ``ContextGrokker`` and the ``scan.py`` module have gone away
- thanks the newer Martian.
-
-* Directive implementations (in their factory method) should *not*
- bind directives. Directive binding cannot take place at import time,
- but only at grok time. Binding directives during import time (when
- directives are executed) can lead to change problems. (we noticed
- this during our refactoring to use the new Martian).
-
-* Use 1.0b1 versions.cfg in Grok's release info instead of a local
- copy; a local copy for all grokcore packages is just too hard to
- maintain.
-
-1.7 (2009-06-01)
-----------------
-
-* Add missing provider, global_adapter, implementsOnly, classProvides() to
- the module interface so that they are included in __all__
-
-1.6 (2009-04-10)
-----------------
-
-* Add convenience imports for implementsOnly() and classProvides() class
- declarations form zope.interface.
-
-* Add support for registering global adapters at module level::
-
- grok.global_adapter(factory, (IAdapted1, IAdapted2,), IProvided, name=u"name")
-
- Only 'factory' is required. If only a single interface is adapted, the
- second argument may be a single interface instead of a tuple. If the
- component has declared adapted/provided interfaces, the second and third
- arguments may be omitted.
-
-* Add support for an @provider decorator to let a function directly provide
- an interface::
-
- @grok.provider(IFoo, IBar)
- def some_function():
- ...
-
- This is equivalent to doing alsoProvides(some_function, IFoo, IBar).
-
-* Add support for named adapters with the @adapter decorator::
-
- @grok.adapter(IAdaptedOne, IAdaptedTwo, name=u"foo")
- def some_function(one, two):
- ...
-
-1.5.1 (2008-07-28)
-------------------
-
-* The ``IGrokcoreComponentAPI`` interface was missing declarations for
- the ``title`` and ``description`` directives.
-
-1.5 (2008-07-22)
-----------------
-
-* Fix https://bugs.launchpad.net/grok/+bug/242353: grokcore.component
- contains old-style test setup. There is no `register_all_tests`
- method in grokcore.component.testing anymore. Use z3c.testsetup
- instead.
-
-* Allow functions that have been marked with @grok.subscribe also be
- registered with ``zope.component.provideHandler()`` manually. This
- is useful for unit tests where you may not want to grok a whole
- module.
-
-* Document grokcore.component's public API in an interface,
- ``IGrokcoreComponentAPI``. When you now do::
-
- from grokcore.component import *
-
- only the items documented in that interface will be imported into
- your local namespace.
-
-1.4 (2008-06-11)
-----------------
-
-* Ported class grokkers to make use of further improvements in Martian.
- This requires Martian 0.10.
-
-1.3 (2008-05-14)
-----------------
-
-* Ported class grokkers to make use of the new declarative way of
- retrieving directive information from a class. This requires
- Martian 0.9.6.
-
-1.2.1 (2008-05-04)
-------------------
-
-* Upgrade to Martian 0.9.5, which has a slight change in the signature of
- ``scan_for_classes``.
-
-* Remove an unnecessary import ``methods_from_class`` from
- ``grokcore.component.scan``.
-
-1.2 (2008-05-04)
-----------------
-
-* Ported directives to Martian's new directive implementation. As a
- result, nearly all helper functions that were available from
- ``grokcore.component.util`` have been removed. The functionality is
- mostly available from the directives themselves now.
-
-* The ``baseclass`` directive has been moved to Martian.
-
-* The ``order`` directive and its helper functions have been moved
- back to Grok, as it was of no general use, but very specific to
- viewlets.
-
-1.1 (2008-05-03)
-----------------
-
-* ``determine_module_component`` now looks for classes that implement
- a certain interface (such as ``IContext``), instead of taking a list
- of classes. If looking for ``IContext``, it still will find
- ``Context`` subclasses, as these were also made to implement
- ``IContext``.
-
-* Move the ``public_methods_from_class`` helper function back to Grok,
- it isn't used at all in ``grokcore.component``.
-
-1.0.1 (2008-05-02)
-------------------
-
-* The grokkers for adapters and global utilities did not use the
- correct value for the *provided* interface in the configuration
- action discriminator. Because of this, uninformative and
- potentially wrong conflict errors would occur, as well as no
- conflict where a conflict should have occurred.
-
-* The grokker for the ``global_utility()`` directive did immediate
- registrations instead of generating configuration actions.
- Therefore it did not provoke ``ConflictErrors`` for conflicting
- registrations.
-
-* Improved documentation
-
-1.0 (2008-05-01)
-----------------
-
-* Created ``grokcore.component`` in March 2008 by factoring basic
- component base classes and their directives and grokkers out of
- Grok.
Deleted: grokcore.component/trunk/COPYRIGHT.txt
===================================================================
--- grokcore.component/trunk/COPYRIGHT.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/COPYRIGHT.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1 +0,0 @@
-Zope Foundation and Contributors
\ No newline at end of file
Deleted: grokcore.component/trunk/CREDITS.txt
===================================================================
--- grokcore.component/trunk/CREDITS.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/CREDITS.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,6 +0,0 @@
-CREDITS
-=======
-
-This package was extracted from the Grok web framework.
-
-For credits, see the CREDITS file in the main ``grok`` project itself.
Deleted: grokcore.component/trunk/INSTALL.txt
===================================================================
--- grokcore.component/trunk/INSTALL.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/INSTALL.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,19 +0,0 @@
-Preparing for grok development
-------------------------------
-
-Install setuptools on your system, or use a setuptools-based
-environment like a "virtualenv" or a "buildout", and then install
-"grokcore.component". Doing it from the command line looks like::
-
- $ sudo easy_install -U grokcore.component
-
-Then you can try importing it from your Python code.
-
-Running the tests
------------------
-
-To run the "grokcore.component" tests, you need to download the source
-code from version control and run the following command which the
-buildout will create::
-
- $ bin/test
Deleted: grokcore.component/trunk/LICENSE.txt
===================================================================
--- grokcore.component/trunk/LICENSE.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/LICENSE.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,44 +0,0 @@
-Zope Public License (ZPL) Version 2.1
-
-A copyright notice accompanies this license document that identifies the
-copyright holders.
-
-This license has been certified as open source. It has also been designated as
-GPL compatible by the Free Software Foundation (FSF).
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions in source code must retain the accompanying copyright
-notice, this list of conditions, and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the accompanying copyright
-notice, this list of conditions, and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-3. Names of the copyright holders must not be used to endorse or promote
-products derived from this software without prior written permission from the
-copyright holders.
-
-4. The right to distribute this software or to use it for any purpose does not
-give you the right to use Servicemarks (sm) or Trademarks (tm) of the
-copyright
-holders. Use of them is covered by separate agreement with the copyright
-holders.
-
-5. If any files are modified, you must cause the modified files to carry
-prominent notices stating that you changed the files and the date of any
-change.
-
-Disclaimer
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
-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 HOLDERS 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.
Added: grokcore.component/trunk/MOVED_TO_GITHUB
===================================================================
--- grokcore.component/trunk/MOVED_TO_GITHUB (rev 0)
+++ grokcore.component/trunk/MOVED_TO_GITHUB 2013-03-01 13:37:41 UTC (rev 129941)
@@ -0,0 +1 @@
+See https://github.com/zopefoundation/grokcore.component
\ No newline at end of file
Deleted: grokcore.component/trunk/README.txt
===================================================================
--- grokcore.component/trunk/README.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/README.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,225 +0,0 @@
-This package provides base classes of basic component types for the
-Zope Component Architecture, as well as means for configuring and
-registering them directly in Python (without ZCML).
-
-.. contents::
-
-How to set up ``grokcore.component``
-====================================
-
-In the following we assume you're writing or extending an application
-that does bootstrap configuration using ZCML. There's always a single
-ZCML file that is executed when the application is started, which then
-includes everything else. Let's assume this file is called
-``site.zcml`` (that's what it's called in Zope), so that file is what
-we'll be editing.
-
-In order to register the components that you wrote using the base
-classes and directives available from ``grokcore.component``, we'll
-use the ``<grok:grok />`` ZCML directive. But before we can use it,
-we need to make sure it's available to the ZCML machinery. We do this
-by including the meta configuration from ``grokcore.component``::
-
- <include package="grokcore.component" file="meta.zcml" />
-
-Put this line somewhere to the top of ``site.zcml``, next to other
-meta configuration includes. Now, further down the line, we can tell
-the machinery in ``grokcore.component`` to register all components in
-your package (let's say it's called ``helloworld``)::
-
- <grok:grok package="helloworld" />
-
-To sum up, your ``site.zcml`` file should look like something like this::
-
- <configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:grok="http://namespaces.zope.org/grok">
-
- <!-- do the meta configuration to make the ZCML directives available -->
- <include package="zope.foobar" file="meta.zcml" />
- <include package="zope.frobnaz" file="meta.zcml" />
- <include package="grokcore.component" file="meta.zcml" />
-
- <!-- now load the configuration of packages that we depend on -->
- <include package="zope.barfoo" />
- <include package="zope.somethingorother" />
-
- <!-- finally load my components which are based on grokcore.component -->
- <grok:grok package="helloworld" />
-
- </configure>
-
-Examples
-========
-
-Adapter
--------
-
-Here's a simple adapter that may be useful in Zope. It extracts the
-languages that a user prefers from the request::
-
- import grokcore.component
- from zope.publisher.interfaces.browser import IBrowserRequest
- from zope.i18n.interfaces import IUserPreferredLanguages
-
- class CookieLanguage(grokcore.component.Adapter):
- """Extract the preferred language from a cookie"""
- grokcore.component.context(IBrowserRequest)
- grokcore.component.implements(IUserPreferredLanguages)
-
- # No need to implement __init__, it's already provided by the base class.
-
- def getPreferredLanguages(self):
- # This an adapter for the request, so self.context is the request.
- request = self.context
-
- # Extract the preferred language from a cookie:
- lang = request.cookies.get('language', 'en')
-
- # According to IUserPreferredLanguages, we must return a list.
- return [lang]
-
-Multi-adapter
--------------
-
-Here's a multi-adapter that functions as a content provider as known
-from the ``zope.contentprovider`` library. Content providers are
-components that return snippets of HTML. They're multi-adapters for
-the content object (model), the request and the view that they're
-supposed to be a part of::
-
- import grokcore.component
- from zope.publisher.interfaces.browser import IBrowserRequest
- from zope.publisher.interfaces.browser import IBrowserPage
- from zope.contentprovider.interfaces import IContentProvider
-
- class HelloWorldProvider(grokcore.component.MultiAdapter):
- """Display Hello World!"""
- grokcore.component.adapts(Interface, IBrowserRequest, IBrowserPage)
- grokcore.component.implements(IContentProvider)
-
- def __init__(self, context, request, view):
- pass
-
- def update(self):
- pass
-
- def render(self):
- return u'<p>Hello World!</p>'
-
-
-Global utility
---------------
-
-Here's a simple named utility, again from the Zope world. It's a
-translation domain. In other words, it contains translations of user
-messages and is invoked when the i18n machinery needs to translate
-something::
-
- import grokcore.component
- from zope.i18n.interfaces import ITranslationDomain
-
- class HelloWorldTranslationDomain(grokcore.component.GlobalUtility):
- grokcore.component.implements(ITranslationDomain)
- grokcore.component.name('helloworld')
-
- domain = u'helloworld'
-
- def translate(self, msgid, mapping=None, context=None,
- target_language=None, default=None):
- if target_language is None:
- preferred = IUserPreferredLanguages(context)
- target_language = preferred.getPreferredLanguages()[0]
-
- translations = {'de': u'Hallo Welt',
- 'nl': u'Hallo Wereld'}
- return translations.get(target_language, u'Hello World')
-
-Of course, it's silly to implement your own translation domain utility
-if there are already implementations available in ``zope.i18n`` (one
-that reads translations from a GNU gettext message catalog and a
-simple implementation for tests). Let's try to reuse that
-implementation and register an instance::
-
- import grokcore.component
- from zope.i18n.interfaces import ITranslationDomain
- from zope.i18n.simpletranslationdomain import SimpleTranslationDomain
-
- messages = {('de', u'Hello World'): u'Hallo Welt',
- ('nl', u'Hello World'): u'Hallo Wereld'}
- helloworld_domain = SimpleTranslationDomain(u'helloworld', messages)
-
- grokcore.component.global_utility(helloworld_domain,
- provides=ITranslationDomain,
- name='helloworld',
- direct=True)
-
-Global adapter
---------------
-
-Sometimes, you may have an object that should be registered as an adapter
-factory. It may have come from some other framework that configured that
-adapter for you, say, or you may have a class that you instantiate many
-times to get different variations on a particular adapter factory. In these
-cases, subclassing grokcore.component.Adapter or MultiAdapter is not
-possible. Instead, you can use the global_adapter() directive. Here is an
-example drawing on the ``z3c.form`` library, which provides an adapter factory
-factory for named widget attributes::
-
- import zope.interface
- import zope.schema
- import grokcore.component
- import z3c.form.widget import ComputedWidgetAttribute
-
- class ISchema(Interface):
- """This schema will be used to power a z3c.form form"""
-
- field = zope.schema.TextLine(title=u"Sample field")
-
- ...
-
- label_override = z3c.form.widget.StaticWidgetAttribute(
- u"Override label", field=ISchema['field'])
-
- grokcore.component.global_adapter(label_override, name=u"label")
-
-In the example above, the provided and adapted interfaces are deduced from the
-object returned by the ``StaticWidgetAttribute`` factory. The full syntax
-for global_adapter is::
-
- global_adapter(factory, (IAdapted1, IAdapted2,), IProvided, name=u"name")
-
-The factory must be a callable (the adapter factory). Adapted interfaces are
-given as a tuple. You may use a single interface instead of a one-element
-tuple for single adapters. The provided interface is given as shown. The name
-defaults to u"" (an unnamed adapter).
-
-Handling events
----------------
-
-Here we see an event handler much like it occurs within Zope itself. It
-subscribes to the modified event for all annotatable objects (in other words,
-objects that can have metadata associated with them). When invoked, it updates
-the Dublin Core 'Modified' property accordingly::
-
- import datetime
- import grokcore.component
- from zope.annotation.interfaces import IAnnotatable
- from zope.lifecycleevent.interfaces import IObjectModifiedEvent
- from zope.dublincore.interfaces import IZopeDublinCore
-
- @grokcore.component.subscribe(IAnnotatable, IObjectModifiedEvent)
- def updateDublinCoreAfterModification(obj, event):
- """Updated the Dublin Core 'Modified' property when a modified
- event is sent for an object."""
- IZopeDublinCore(obj).modified = datetime.datetime.utcnow()
-
-Subscriptions
--------------
-
-Subscriptions look similar to Adapter, however, unlike regular adapters,
-subscription adapters are used when we want all of the adapters that adapt an
-object to a particular adapter.
-
-Analogous to MultiAdapter, there is a MultiSubscription component that "adapts"
-multiple objects.
Deleted: grokcore.component/trunk/TODO.txt
===================================================================
--- grokcore.component/trunk/TODO.txt 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/TODO.txt 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,6 +0,0 @@
-====
-TODO
-====
-
- - The testing infrastructure needs to be broken out into "grokcore.testing".
- - The interfaces need to be broken out into "grokcore.interfaces".
Deleted: grokcore.component/trunk/bootstrap.py
===================================================================
--- grokcore.component/trunk/bootstrap.py 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/bootstrap.py 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,258 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Foundation 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.
-"""
-
-import os, shutil, sys, tempfile, textwrap, urllib, urllib2, subprocess
-from optparse import OptionParser
-
-if sys.platform == 'win32':
- def quote(c):
- if ' ' in c:
- return '"%s"' % c # work around spawn lamosity on windows
- else:
- return c
-else:
- quote = str
-
-# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
-stdout, stderr = subprocess.Popen(
- [sys.executable, '-Sc',
- 'try:\n'
- ' import ConfigParser\n'
- 'except ImportError:\n'
- ' print 1\n'
- 'else:\n'
- ' print 0\n'],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
-has_broken_dash_S = bool(int(stdout.strip()))
-
-# In order to be more robust in the face of system Pythons, we want to
-# run without site-packages loaded. This is somewhat tricky, in
-# particular because Python 2.6's distutils imports site, so starting
-# with the -S flag is not sufficient. However, we'll start with that:
-if not has_broken_dash_S and 'site' in sys.modules:
- # We will restart with python -S.
- args = sys.argv[:]
- args[0:0] = [sys.executable, '-S']
- args = map(quote, args)
- os.execv(sys.executable, args)
-# Now we are running with -S. We'll get the clean sys.path, import site
-# because distutils will do it later, and then reset the path and clean
-# out any namespace packages from site-packages that might have been
-# loaded by .pth files.
-clean_path = sys.path[:]
-import site
-sys.path[:] = clean_path
-for k, v in sys.modules.items():
- if (hasattr(v, '__path__') and
- len(v.__path__)==1 and
- not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))):
- # This is a namespace package. Remove it.
- sys.modules.pop(k)
-
-is_jython = sys.platform.startswith('java')
-
-setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
-distribute_source = 'http://python-distribute.org/distribute_setup.py'
-
-# parsing arguments
-def normalize_to_url(option, opt_str, value, parser):
- if value:
- if '://' not in value: # It doesn't smell like a URL.
- value = 'file://%s' % (
- urllib.pathname2url(
- os.path.abspath(os.path.expanduser(value))),)
- if opt_str == '--download-base' and not value.endswith('/'):
- # Download base needs a trailing slash to make the world happy.
- value += '/'
- else:
- value = None
- name = opt_str[2:].replace('-', '_')
- setattr(parser.values, name, value)
-
-usage = '''\
-[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
-
-Bootstraps a buildout-based project.
-
-Simply run this script in a directory containing a buildout.cfg, using the
-Python that you want bin/buildout to use.
-
-Note that by using --setup-source and --download-base to point to
-local resources, you can keep this script from going over the network.
-'''
-
-parser = OptionParser(usage=usage)
-parser.add_option("-v", "--version", dest="version",
- help="use a specific zc.buildout version")
-parser.add_option("-d", "--distribute",
- action="store_true", dest="use_distribute", default=False,
- help="Use Distribute rather than Setuptools.")
-parser.add_option("--setup-source", action="callback", dest="setup_source",
- callback=normalize_to_url, nargs=1, type="string",
- help=("Specify a URL or file location for the setup file. "
- "If you use Setuptools, this will default to " +
- setuptools_source + "; if you use Distribute, this "
- "will default to " + distribute_source +"."))
-parser.add_option("--download-base", action="callback", dest="download_base",
- callback=normalize_to_url, nargs=1, type="string",
- help=("Specify a URL or directory for downloading "
- "zc.buildout and either Setuptools or Distribute. "
- "Defaults to PyPI."))
-parser.add_option("--eggs",
- help=("Specify a directory for storing eggs. Defaults to "
- "a temporary directory that is deleted when the "
- "bootstrap script completes."))
-parser.add_option("-t", "--accept-buildout-test-releases",
- dest='accept_buildout_test_releases',
- action="store_true", default=False,
- help=("Normally, if you do not specify a --version, the "
- "bootstrap script and buildout gets the newest "
- "*final* versions of zc.buildout and its recipes and "
- "extensions for you. If you use this flag, "
- "bootstrap and buildout will get the newest releases "
- "even if they are alphas or betas."))
-parser.add_option("-c", None, action="store", dest="config_file",
- help=("Specify the path to the buildout configuration "
- "file to be used."))
-
-options, args = parser.parse_args()
-
-# if -c was provided, we push it back into args for buildout's main function
-if options.config_file is not None:
- args += ['-c', options.config_file]
-
-if options.eggs:
- eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
-else:
- eggs_dir = tempfile.mkdtemp()
-
-if options.setup_source is None:
- if options.use_distribute:
- options.setup_source = distribute_source
- else:
- options.setup_source = setuptools_source
-
-if options.accept_buildout_test_releases:
- args.append('buildout:accept-buildout-test-releases=true')
-args.append('bootstrap')
-
-try:
- import pkg_resources
- import setuptools # A flag. Sometimes pkg_resources is installed alone.
- if not hasattr(pkg_resources, '_distribute'):
- raise ImportError
-except ImportError:
- ez_code = urllib2.urlopen(
- options.setup_source).read().replace('\r\n', '\n')
- ez = {}
- exec ez_code in ez
- setup_args = dict(to_dir=eggs_dir, download_delay=0)
- if options.download_base:
- setup_args['download_base'] = options.download_base
- if options.use_distribute:
- setup_args['no_fake'] = True
- ez['use_setuptools'](**setup_args)
- reload(sys.modules['pkg_resources'])
- import pkg_resources
- # This does not (always?) update the default working set. We will
- # do it.
- for path in sys.path:
- if path not in pkg_resources.working_set.entries:
- pkg_resources.working_set.add_entry(path)
-
-cmd = [quote(sys.executable),
- '-c',
- quote('from setuptools.command.easy_install import main; main()'),
- '-mqNxd',
- quote(eggs_dir)]
-
-if not has_broken_dash_S:
- cmd.insert(1, '-S')
-
-find_links = options.download_base
-if not find_links:
- find_links = os.environ.get('bootstrap-testing-find-links')
-if find_links:
- cmd.extend(['-f', quote(find_links)])
-
-if options.use_distribute:
- setup_requirement = 'distribute'
-else:
- setup_requirement = 'setuptools'
-ws = pkg_resources.working_set
-setup_requirement_path = ws.find(
- pkg_resources.Requirement.parse(setup_requirement)).location
-env = dict(
- os.environ,
- PYTHONPATH=setup_requirement_path)
-
-requirement = 'zc.buildout'
-version = options.version
-if version is None and not options.accept_buildout_test_releases:
- # Figure out the most recent final version of zc.buildout.
- import setuptools.package_index
- _final_parts = '*final-', '*final'
- def _final_version(parsed_version):
- for part in parsed_version:
- if (part[:1] == '*') and (part not in _final_parts):
- return False
- return True
- index = setuptools.package_index.PackageIndex(
- search_path=[setup_requirement_path])
- if find_links:
- index.add_find_links((find_links,))
- req = pkg_resources.Requirement.parse(requirement)
- if index.obtain(req) is not None:
- best = []
- bestv = None
- for dist in index[req.project_name]:
- distv = dist.parsed_version
- if _final_version(distv):
- if bestv is None or distv > bestv:
- best = [dist]
- bestv = distv
- elif distv == bestv:
- best.append(dist)
- if best:
- best.sort()
- version = best[-1].version
-if version:
- requirement = '=='.join((requirement, version))
-cmd.append(requirement)
-
-if is_jython:
- import subprocess
- exitcode = subprocess.Popen(cmd, env=env).wait()
-else: # Windows prefers this, apparently; otherwise we would prefer subprocess
- exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
-if exitcode != 0:
- sys.stdout.flush()
- sys.stderr.flush()
- print ("An error occurred when trying to install zc.buildout. "
- "Look above this message for any errors that "
- "were output by easy_install.")
- sys.exit(exitcode)
-
-ws.add_entry(eggs_dir)
-ws.require(requirement)
-import zc.buildout.buildout
-zc.buildout.buildout.main(args)
-if not options.eggs: # clean up temporary egg directory
- shutil.rmtree(eggs_dir)
Deleted: grokcore.component/trunk/buildout.cfg
===================================================================
--- grokcore.component/trunk/buildout.cfg 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/buildout.cfg 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,20 +0,0 @@
-[buildout]
-develop = .
-parts = interpreter test
-extends = http://svn.zope.org/repos/main/groktoolkit/trunk/grok.cfg
-versions = versions
-extensions = buildout.dumppickedversions
-
-[versions]
-grokcore.component =
-
-[interpreter]
-recipe = zc.recipe.egg
-eggs = grokcore.component
-interpreter = python
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = grokcore.component
- grokcore.component[test]
-defaults = ['--tests-pattern', '^f?tests$', '-v', '--auto-color']
Deleted: grokcore.component/trunk/setup.py
===================================================================
--- grokcore.component/trunk/setup.py 2013-03-01 01:22:37 UTC (rev 129940)
+++ grokcore.component/trunk/setup.py 2013-03-01 13:37:41 UTC (rev 129941)
@@ -1,48 +0,0 @@
-from setuptools import setup, find_packages
-import os
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-long_description = (
- read('README.txt')
- + '\n' +
- read('CHANGES.txt')
- )
-
-tests_require = [
- 'zope.event',
- ]
-
-setup(
- name='grokcore.component',
- version='2.6.dev0',
- author='Grok Team',
- author_email='grok-dev at zope.org',
- url='http://grok.zope.org',
- download_url='http://pypi.python.org/pypi/grokcore.component',
- description='Grok-like configuration for basic components '
- '(adapters, utilities, subscribers)',
- long_description=long_description,
- license='ZPL',
- classifiers=['Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- ],
-
- packages=find_packages('src'),
- package_dir={'': 'src'},
- namespace_packages=['grokcore'],
- include_package_data=True,
- zip_safe=False,
- install_requires=['setuptools',
- 'martian >= 0.14',
- 'zope.component',
- 'zope.configuration',
- 'zope.interface',
- # Note: zope.testing is NOT just a test dependency here.
- 'zope.testing',
- ],
- tests_require=tests_require,
- extras_require={'test': tests_require},
-)
More information about the checkins
mailing list