z3c.autoinclude-0.3.5/.gitignore0000644000000000000000000000013112214252576014650 0ustar 00000000000000bin build develop-eggs dist lib include man parts __pycache__ .* *.dll *.pyc *.pyo *.so z3c.autoinclude-0.3.5/.travis.yml0000644000000000000000000000022412214252576014774 0ustar 00000000000000language: python python: - 2.7 install: - python bootstrap.py - bin/buildout script: - bin/test -v1 notifications: email: false z3c.autoinclude-0.3.5/bootstrap.py0000644000000000000000000002443512214252576015264 0ustar 00000000000000############################################################################## # # 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, 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 # imported because of its side effects sys.path[:] = clean_path for k, v in sys.modules.items(): if k in ('setuptools', 'pkg_resources') or ( 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 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.insert(0, 'buildout:accept-buildout-test-releases=true') 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 if sys.version_info[:2] == (2, 4): setup_args['version'] = '0.6.32' ez['use_setuptools'](**setup_args) if 'pkg_resources' in sys.modules: 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 not find_links and options.accept_buildout_test_releases: find_links = 'http://downloads.buildout.org/' 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 distv >= pkg_resources.parse_version('2dev'): continue 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 += '=='+version else: requirement += '<2dev' 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 # If there isn't already a command in the args, add bootstrap if not [a for a in args if '=' not in a]: args.append('bootstrap') # if -c was provided, we push it back into args for buildout's main function if options.config_file is not None: args[0:0] = ['-c', options.config_file] zc.buildout.buildout.main(args) if not options.eggs: # clean up temporary egg directory shutil.rmtree(eggs_dir) z3c.autoinclude-0.3.5/buildout.cfg0000644000000000000000000000027612214252576015202 0ustar 00000000000000[buildout] develop = . parts = devpython test [devpython] recipe = zc.recipe.egg interpreter = devpython eggs = z3c.autoinclude [test] recipe = zc.recipe.testrunner eggs = z3c.autoinclude z3c.autoinclude-0.3.5/CHANGES.rst0000644000000000000000000000633612214252576014477 0ustar 00000000000000Changes ======= 0.3.5 (2013-09-12) ------------------ * If a module cannot be resolved, but raises ``ImportError``, log a warn and continue. This fixes an issue where the determining the includable packages would fail due to a problem with the importation of one or potentially more modules. An example is the ``gobject`` module which provides a Python binding to ``GObject``. In a recent API deprecation, one is no longer allowed to both import ``gi`` and ``gobject``. 0.3.4 (2011-03-11) ------------------ * Remove unnecessary distribution lookup in the PluginFinder. 0.3.3 (2010-05-06) ------------------ * Ignore case in tests in order to pass tests on Windows. * Clearly specify license as ZPL (not public domain, as it was claiming before). 0.3.2 (2009-12-19) ------------------ * Let `subpackageDottedNames` always return a sorted list of package names as `os.listdir` doesn't on some platforms. 0.3.1 (2009-05-04) ------------------ * z3c.autoinclude no longer (spuriously) depends on PasteScript. 0.3 (2009-03-03) ---------------- * Allow virtual namespace packages like 'plone' to be specified for the package. I think this may need more thought for the dependency case. * Allow ZCML ``includePlugins`` directive to specify a particular ZCML file to try to load from plugins, so that loading of meta, configure and overrides can be split across three ZCML files if desired. You can specify a file like: . * Provide a separate ``includePluginsOverrides`` directive to be used when loading overrides, and no longer look for 'overrides.zcml' files by default with ``includePlugins``. * Removed the deprecated ``autoinclude`` and ``autoincludeOverrides`` directives. * Allow autoinclusion to be disabled by setting `os.environ['Z3C_AUTOINCLUDE_PLUGINS_DISABLED']` and `os.environ['Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED']`, potentially useful for test runners or debugging sessions. See http://lists.plone.org/pipermail/framework-team/2009-February/002689.html for discussion. 0.2.2 (2008-04-22) ------------------ * Gracefully catch KeyErrors in ``namespaceForDottedName``; get_metadata_lines will sometimes throw this for certain distribution types, apparently. In particular, some systems' version of Python itself will be wrapped in a distribution which throws this error, resulting in system-dependent unresumable breakage of z3c.autoinclude prior to this fix. 0.2.1 (2008-04-21) ------------------ * Fixed bug which prevented proper inclusion of packages when the base package's namespace has been extended by other installed packages. * Rewrote ``distributionForPackage`` function. * Added additional tests for ``includePlugins`` and utility functions. * Fixed bug which made z3c.autoinclude look for ZCML in namespaces of nested namespace packages (eg, if there happened to -- improperly -- be an x/y/configure.zcml in a x.y.z package with an x.y namespace, it would have been included; this is incorrect.) 0.2 (2008-04-18) ---------------- * Added new directive ``includePlugins``. * Renamed ``autoinclude`` directive to ``includeDependencies``. * Deprecated ``autoinclude`` directive. 0.1 (2008-02-25) ---------------- * Initial public release. z3c.autoinclude-0.3.5/COPYRIGHT.rst0000644000000000000000000000004012214252576014761 0ustar 00000000000000Zope Foundation and Contributorsz3c.autoinclude-0.3.5/LICENSE.rst0000644000000000000000000000402612214252576014503 0ustar 00000000000000Zope 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. z3c.autoinclude-0.3.5/MANIFEST.in0000644000000000000000000000033512214252576014424 0ustar 00000000000000include *.rst include *.txt recursive-include src * global-exclude *.pyc global-exclude *.pyo prune src/z3c/autoinclude/tests/*/build prune src/z3c/autoinclude/tests/*/dist prune src/z3c/autoinclude/tests/*/*.egg-info z3c.autoinclude-0.3.5/PKG-INFO0000644000000000000000000002175312214252610013757 0ustar 00000000000000Metadata-Version: 1.1 Name: z3c.autoinclude Version: 0.3.5 Summary: Automatically include ZCML Home-page: http://pypi.python.org/pypi/z3c.autoinclude Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL Description: Overview ======== This package adds two new ZCML directives to automatically detect ZCML files to include: "includeDependencies" and "includePlugins". When you want to include a Zope-based package in your application, you have to repeat yourself in two places: you have to add the package itself (in a setup.py, buildout, etc) and you also have to include its ZCML with an directive or a package-includes slug. Because you have to repeat yourself, you can easily make an error where you add a new package but forget to include its ZCML. z3c.autoinclude lets you circumvent this error-prone process with automatic detection and inclusion of ZCML files. includeDependencies ------------------- The "includeDependencies" directive searches through the dependencies in your setup.py file (install_requires), and includes the ZCML files in those packages that it finds. Inclusion order matches the order in the setup.py file. You can pass a path for the package you want to include dependencies for, but typically you pass in the current package, as follows:: With this directive, you no longer have to add an explicit ```` for every new dependency of your project. Grok_ and grokproject_ use this functionality out of the box. The grokproject command will automatically add the ``includeDependencies`` directive in the ZCML of the project it generates. You can then stop worrying about manual ZCML inclusion in the vast majority of cases. includePlugins -------------- The "includePlugins" directive uses entry points to find installed packages that broadcast themselves as plugins to a particular base package. You can pass a path for the package you want to include plugins for, but typically you pass in the current package, as follows:: To broadcast a package as a plugin to a base package called "my_base", add the following lines to the plugin package's ``setup.py``:: entry_points=""" [z3c.autoinclude.plugin] target = my_base """ The Details =========== Setup ----- To make the z3c.autoinclude directives available for use in your application or framework, you need to include it (in your ``meta.zcml`` for instance), like this:: Grok already does this for you automatically. Disabling z3c.autoinclude ------------------------- It is often useful to disable z3c.autoinclude's functionality for debugging purposes or test runs. To disable autoinclusion, set the environment variables "Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED" and "Z3C_AUTOINCLUDE_PLUGINS_DISABLED". When autoinclusion is disabled, the autoinclusion directives will issue a warning to the log and do nothing. ZCML Filenames -------------- The includeDependencies directive automatically includes ``configure.zcml`` and ``meta.zcml`` files that live in the main package directories. For automatic inclusion of dependencies' overrides, there is an directive. In some cases, a package may use unusual names or locations for its ZCML files. In that case you will need to modify your package's ``configure.zcml`` and ``meta.zcml`` yourself to include the ZCML using the manual ``include`` directive. The includePlugins directive automatically includes ``configure.zcml`` and ``meta.zcml`` files by default, and the includePluginsOverrides directive automatically includes ``overrides.zcml`` files by default. But, like "", these directives also have an optional "file" parameter, so you can automatically include all ``foo.zcml`` files in your package's plugins like this:: The includeDependencies directives will soon offer this option as well. .. _Grok: http://grok.zope.org .. _grokproject: http://pypi.python.org/pypi/grokproject Changes ======= 0.3.5 (2013-09-12) ------------------ * If a module cannot be resolved, but raises ``ImportError``, log a warn and continue. This fixes an issue where the determining the includable packages would fail due to a problem with the importation of one or potentially more modules. An example is the ``gobject`` module which provides a Python binding to ``GObject``. In a recent API deprecation, one is no longer allowed to both import ``gi`` and ``gobject``. 0.3.4 (2011-03-11) ------------------ * Remove unnecessary distribution lookup in the PluginFinder. 0.3.3 (2010-05-06) ------------------ * Ignore case in tests in order to pass tests on Windows. * Clearly specify license as ZPL (not public domain, as it was claiming before). 0.3.2 (2009-12-19) ------------------ * Let `subpackageDottedNames` always return a sorted list of package names as `os.listdir` doesn't on some platforms. 0.3.1 (2009-05-04) ------------------ * z3c.autoinclude no longer (spuriously) depends on PasteScript. 0.3 (2009-03-03) ---------------- * Allow virtual namespace packages like 'plone' to be specified for the package. I think this may need more thought for the dependency case. * Allow ZCML ``includePlugins`` directive to specify a particular ZCML file to try to load from plugins, so that loading of meta, configure and overrides can be split across three ZCML files if desired. You can specify a file like: . * Provide a separate ``includePluginsOverrides`` directive to be used when loading overrides, and no longer look for 'overrides.zcml' files by default with ``includePlugins``. * Removed the deprecated ``autoinclude`` and ``autoincludeOverrides`` directives. * Allow autoinclusion to be disabled by setting `os.environ['Z3C_AUTOINCLUDE_PLUGINS_DISABLED']` and `os.environ['Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED']`, potentially useful for test runners or debugging sessions. See http://lists.plone.org/pipermail/framework-team/2009-February/002689.html for discussion. 0.2.2 (2008-04-22) ------------------ * Gracefully catch KeyErrors in ``namespaceForDottedName``; get_metadata_lines will sometimes throw this for certain distribution types, apparently. In particular, some systems' version of Python itself will be wrapped in a distribution which throws this error, resulting in system-dependent unresumable breakage of z3c.autoinclude prior to this fix. 0.2.1 (2008-04-21) ------------------ * Fixed bug which prevented proper inclusion of packages when the base package's namespace has been extended by other installed packages. * Rewrote ``distributionForPackage`` function. * Added additional tests for ``includePlugins`` and utility functions. * Fixed bug which made z3c.autoinclude look for ZCML in namespaces of nested namespace packages (eg, if there happened to -- improperly -- be an x/y/configure.zcml in a x.y.z package with an x.y namespace, it would have been included; this is incorrect.) 0.2 (2008-04-18) ---------------- * Added new directive ``includePlugins``. * Renamed ``autoinclude`` directive to ``includeDependencies``. * Deprecated ``autoinclude`` directive. 0.1 (2008-02-25) ---------------- * Initial public release. Platform: UNKNOWN Classifier: Framework :: Zope3 Classifier: Programming Language :: Python z3c.autoinclude-0.3.5/README.rst0000644000000000000000000000746612214252576014371 0ustar 00000000000000Overview ======== This package adds two new ZCML directives to automatically detect ZCML files to include: "includeDependencies" and "includePlugins". When you want to include a Zope-based package in your application, you have to repeat yourself in two places: you have to add the package itself (in a setup.py, buildout, etc) and you also have to include its ZCML with an directive or a package-includes slug. Because you have to repeat yourself, you can easily make an error where you add a new package but forget to include its ZCML. z3c.autoinclude lets you circumvent this error-prone process with automatic detection and inclusion of ZCML files. includeDependencies ------------------- The "includeDependencies" directive searches through the dependencies in your setup.py file (install_requires), and includes the ZCML files in those packages that it finds. Inclusion order matches the order in the setup.py file. You can pass a path for the package you want to include dependencies for, but typically you pass in the current package, as follows:: With this directive, you no longer have to add an explicit ```` for every new dependency of your project. Grok_ and grokproject_ use this functionality out of the box. The grokproject command will automatically add the ``includeDependencies`` directive in the ZCML of the project it generates. You can then stop worrying about manual ZCML inclusion in the vast majority of cases. includePlugins -------------- The "includePlugins" directive uses entry points to find installed packages that broadcast themselves as plugins to a particular base package. You can pass a path for the package you want to include plugins for, but typically you pass in the current package, as follows:: To broadcast a package as a plugin to a base package called "my_base", add the following lines to the plugin package's ``setup.py``:: entry_points=""" [z3c.autoinclude.plugin] target = my_base """ The Details =========== Setup ----- To make the z3c.autoinclude directives available for use in your application or framework, you need to include it (in your ``meta.zcml`` for instance), like this:: Grok already does this for you automatically. Disabling z3c.autoinclude ------------------------- It is often useful to disable z3c.autoinclude's functionality for debugging purposes or test runs. To disable autoinclusion, set the environment variables "Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED" and "Z3C_AUTOINCLUDE_PLUGINS_DISABLED". When autoinclusion is disabled, the autoinclusion directives will issue a warning to the log and do nothing. ZCML Filenames -------------- The includeDependencies directive automatically includes ``configure.zcml`` and ``meta.zcml`` files that live in the main package directories. For automatic inclusion of dependencies' overrides, there is an directive. In some cases, a package may use unusual names or locations for its ZCML files. In that case you will need to modify your package's ``configure.zcml`` and ``meta.zcml`` yourself to include the ZCML using the manual ``include`` directive. The includePlugins directive automatically includes ``configure.zcml`` and ``meta.zcml`` files by default, and the includePluginsOverrides directive automatically includes ``overrides.zcml`` files by default. But, like "", these directives also have an optional "file" parameter, so you can automatically include all ``foo.zcml`` files in your package's plugins like this:: The includeDependencies directives will soon offer this option as well. .. _Grok: http://grok.zope.org .. _grokproject: http://pypi.python.org/pypi/grokproject z3c.autoinclude-0.3.5/setup.cfg0000644000000000000000000000007312214252610014473 0ustar 00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 z3c.autoinclude-0.3.5/setup.py0000644000000000000000000000206212214252576014377 0ustar 00000000000000from setuptools import setup, find_packages __version__ = '0.3.5' setup( name='z3c.autoinclude', version=__version__, description="Automatically include ZCML", long_description=(open('README.rst').read() + "\n" + open('CHANGES.rst').read()), classifiers=[ "Framework :: Zope3", "Programming Language :: Python", ], keywords='', author='Zope Foundation and Contributors', author_email='zope-dev@zope.org', url='http://pypi.python.org/pypi/z3c.autoinclude', license='ZPL', packages=find_packages('src'), package_dir={'': 'src'}, namespace_packages=['z3c'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'zope.dottedname', 'zope.interface', 'zope.configuration', 'zope.schema', 'zc.buildout', ], extras_require={'test': ['zc.buildout', 'zope.testing']}, entry_points=""" [console_scripts] autoinclude-test = z3c.autoinclude.tests.tests:interactive_testing_env """, ) z3c.autoinclude-0.3.5/TODO.rst0000644000000000000000000000157612214252576014175 0ustar 00000000000000in no particular order, some notes on things that I think ought to happen to this code: * Profiling. As far as I know, none has been done, and I expect that the code is *very* slow. Then, obviously, optimizations should be considered. * Documentation. It's still fairly poor; I think the whole damn thing is just so abstract that I can't figure out how to talk about it. * May as well figure out how to make a PasteScript template to auto-generate the entry point. * Better debugging tools/APIs: to see what will be autoincluded, turn on and off autoinclusion for individual packages, and freeze a ZCML file capturing autoinclusion information a la pip. One day I also want to add another directive to autoinclude subpackages' ZCML; this is a frequent annoyance for me (see https://svn.openplans.org/svn/opencore/trunk/opencore/configuration/configure.zcml for an illustrative example) z3c.autoinclude-0.3.5/src/z3c/__init__.py0000644000000000000000000000007012214252576016261 0ustar 00000000000000__import__('pkg_resources').declare_namespace(__name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/__init__.py0000644000000000000000000000005212214252576020575 0ustar 00000000000000# from dependency import package_includes z3c.autoinclude-0.3.5/src/z3c/autoinclude/api.py0000644000000000000000000000073612214252576017620 0ustar 00000000000000import os DEP_KEY = 'Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED' PLUGIN_KEY = 'Z3C_AUTOINCLUDE_PLUGINS_DISABLED' def dependencies_disabled(): return os.environ.has_key(DEP_KEY) def disable_dependencies(): os.environ[DEP_KEY] = 'True' def enable_dependencies(): del os.environ[DEP_KEY] def plugins_disabled(): return os.environ.has_key(PLUGIN_KEY) def disable_plugins(): os.environ[PLUGIN_KEY] = 'True' def enable_dependencies(): del os.environ[PLUGIN_KEY] z3c.autoinclude-0.3.5/src/z3c/autoinclude/dependency.py0000644000000000000000000000376012214252576021165 0ustar 00000000000000import os import logging from zope.dottedname.resolve import resolve from pkg_resources import resource_exists from pkg_resources import get_provider from pkg_resources import get_distribution from z3c.autoinclude.utils import DistributionManager from z3c.autoinclude.utils import ZCMLInfo class DependencyFinder(DistributionManager): def includableInfo(self, zcml_to_look_for): """Return the packages in the dependencies which are includable. zcml_to_look_for - a list of zcml filenames we are looking for Returns a dictionary with the include candidates as keys, and lists of dotted names of packages that contain the include candidates as values. """ result = ZCMLInfo(zcml_to_look_for) for req in self.context.requires(): dist_manager = DistributionManager(get_provider(req)) for dotted_name in dist_manager.dottedNames(): try: module = resolve(dotted_name) except ImportError, exc: logging.getLogger("z3c.autoinclude").warn( "resolve(%r) raised import error: %s" % (dotted_name, exc)) continue for candidate in zcml_to_look_for: candidate_path = os.path.join( os.path.dirname(module.__file__), candidate) if os.path.isfile(candidate_path): result[candidate].append(dotted_name) return result def package_includes(project_name, zcml_filenames=None): """ Convenience function for finding zcml to load from requirements for a given project. Takes a project name. DistributionNotFound errors will be raised for uninstalled projects. """ if zcml_filenames is None: zcml_filenames = ['meta.zcml', 'configure.zcml', 'overrides.zcml'] dist = get_distribution(project_name) include_finder = DependencyFinder(dist) return include_finder.includableInfo(zcml_filenames) z3c.autoinclude-0.3.5/src/z3c/autoinclude/dependency.txt0000644000000000000000000001304112214252576021345 0ustar 00000000000000Automatic inclusion of package dependencies =========================================== The z3c.autoinclude.dependency module uses an egg's install_requires information (in the project's setup.py) to find and implicitly load zcml from all dependencies of a project. We have created a test environment to simulate setuptools dependencies. ``APackage`` depends on ``BCPackage`` ``BCPackage`` depends on ``SiblingPackage`` Given the distribution for the project named ``APackage``, we can ask for the requirements of that distribution:: >>> import a >>> from z3c.autoinclude.utils import distributionForPackage >>> a_dist = distributionForPackage(a) >>> reqs = a_dist.requires() >>> pprint(sorted(reqs, key=lambda r:r.project_name)) [Requirement.parse('BCPackage'), Requirement.parse('TestDirective'), Requirement.parse('z3c.autoinclude')] We can turn this requirement into a distribution:: >>> from pkg_resources import get_provider >>> b_dist = get_provider(reqs[0]) We can adapt a distribution to a DependencyFinder:: >>> from z3c.autoinclude.dependency import DependencyFinder >>> a_include_finder = DependencyFinder(a_dist) >>> b_include_finder = DependencyFinder(b_dist) >>> import x.y.z >>> xyz_dist = distributionForPackage(x.y.z) >>> xyz_include_finder = DependencyFinder(xyz_dist) >>> import F.G >>> sibling_dist = distributionForPackage(F.G) >>> sibling_include_finder = DependencyFinder(sibling_dist) The include finder provides functionality to determine what namespace packages exist in the distribution. In the case of ``APackage``, there are no namespace packages:: >>> a_include_finder.namespaceDottedNames() [] ``BPackage`` does have a namespace package, ``b``:: >>> b_include_finder.namespaceDottedNames() ['b'] ``XYZPackage`` has a namespace package too, ``x.y`` (``x`` is also a namespace package):: >>> xyz_include_finder.namespaceDottedNames() ['x', 'x.y'] We can also get the dotted names of the actual packages that we want to inspect in a distribution. For a project without namespace packages, this will be the packages directly in the packages:: >>> a_include_finder.dottedNames() ['a'] For a project with namespace packages, it will be the packages that are in the namespace packages:: >>> b_include_finder.dottedNames() ['b.c'] For a nested namespace package, it should still be the innermost package:: >>> xyz_include_finder.dottedNames() ['x.y.z'] What we need to know in the end is which packages in the requirements of a distribution have files we want to include (``configure.zcml``, ``meta.zcml``). So, given a distribution, let's retrieve all packages that it depends on that have ``configure.zcml`` or ``meta.zcml``. Note that the individual lists within ``includableInfo`` preserve the package order defined in ``setup.py``:: >>> a_include_finder.includableInfo(['configure.zcml', 'meta.zcml']) {'configure.zcml': ['b.c'], 'meta.zcml': ['z3c.autoinclude', 'testdirective']} For a nested namespace package with two siblings ``SiblingPackage``, we should get the same expected results. The sibling package ``SiblingPackage`` does have a namespace package:: >>> sibling_include_finder.namespaceDottedNames() ['F'] For a namespace package with 2 sibling namespaces, we get both sibling packages:: >>> sibling_include_finder.dottedNames() ['F.G', 'F.H'] And we should be able to pick up the files we need to include from both dotted names:: >>> pprint(b_include_finder.includableInfo(['configure.zcml', ... 'meta.zcml'])) {'configure.zcml': ['F.H'], 'meta.zcml': ['testdirective', 'F.G', 'F.H']} ``APackage`` depends on ``BCPackage``, which depends on ``SiblingPackage``. ``APackage`` and ``BCPackage`` both contain the autoinclude directive, which will automatically include any meta.zcml and configure.zcml files (in that order) that their dependencies contain. These dependencies' zcml actually contain a test directive that will append a logging message to a global variable in testdirective.zcml. So let's trigger the loading of the configure.zcml in ``APackage`` and see whether its ``BCPackage`` dependency, and ``BCPackage``'s dependencies, were indeed loaded and in the correct order:: >>> from pkg_resources import resource_filename >>> from zope.configuration import xmlconfig >>> import a >>> dummy = xmlconfig.file(resource_filename('a', 'configure.zcml'), ... package=a) >>> from testdirective.zcml import test_log >>> pprint(test_log) [u'f.g meta has been loaded', u'f.h has been loaded', u'BCPackage has been loaded'] There is also a directive for including overrides, which calls ``autoIncludeOverridesDirective``; however, I have no idea how to test this. Finally, there is a convenience API for finding the files we need to include from the requirements of a given package:: >>> from z3c.autoinclude import package_includes >>> pprint(package_includes('BCPackage')) {'configure.zcml': ['F.H'], 'meta.zcml': ['testdirective', 'F.G', 'F.H'], 'overrides.zcml': []} As with ``includableInfo``, we can also supply a list of ZCML filenames to search for:: >>> pprint(package_includes('BCPackage', ['configure.zcml', 'silly.zcml'])) {'configure.zcml': ['F.H'], 'silly.zcml': []} Note that it will not catch DistributionNotFound errors:: >>> package_includes('NonexistentPackage') Traceback (most recent call last): ... DistributionNotFound: NonexistentPackage z3c.autoinclude-0.3.5/src/z3c/autoinclude/meta.zcml0000644000000000000000000000156012214252576020306 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/plugin.py0000644000000000000000000000256012214252576020342 0ustar 00000000000000import os from pkg_resources import iter_entry_points from pkg_resources import resource_filename from z3c.autoinclude.utils import DistributionManager from z3c.autoinclude.utils import ZCMLInfo class PluginFinder(object): def __init__(self, platform_dottedname): self.dottedname = platform_dottedname def includableInfo(self, zcml_to_look_for): includable_info = ZCMLInfo(zcml_to_look_for) for plugin_distribution in find_plugins(self.dottedname): include_finder = DistributionManager(plugin_distribution) for plugin_dottedname in include_finder.dottedNames(): groups = zcml_to_include(plugin_dottedname, zcml_to_look_for) for zcml_group in groups: includable_info[zcml_group].append(plugin_dottedname) return includable_info def find_plugins(dotted_name): for ep in iter_entry_points('z3c.autoinclude.plugin'): if ep.module_name == dotted_name: yield ep.dist def zcml_to_include(dotted_name, zcmlgroups=None): if zcmlgroups is None: zcmlgroups = ('meta.zcml', 'configure.zcml', 'overrides.zcml') includable_info = [] for zcmlgroup in zcmlgroups: filename = resource_filename(dotted_name, zcmlgroup) if os.path.isfile(filename): includable_info.append(zcmlgroup) return includable_info z3c.autoinclude-0.3.5/src/z3c/autoinclude/plugin.txt0000644000000000000000000000755012214252576020535 0ustar 00000000000000========================================= Automatic inclusion of extension packages ========================================= There is additional functionality for registering and autoincluding extension packages for a particular platform. In this test environment, ``BasePackage`` provides the ``basepackage`` module which we will treat as our platform. ``FooPackage`` wants to broadcast itself as a plugin for ``basepackage`` and thereby register its ZCML as a candidate for automatic inclusion. ``TestDirective`` also broadcasts itself as a plugin for ``basepackage``. Given a module name, we can ask for distributions which have been broadcast themselves as plugging into that module via entry points:: >>> from z3c.autoinclude.plugin import find_plugins >>> sorted(find_plugins('basepackage')) # doctest: +IGNORECASE [FooPackage 0.0 (...), TestDirective 0.0 (...)] Armed with a valid module name we can find the ZCML files within it which must be loaded:: >>> from z3c.autoinclude.plugin import zcml_to_include >>> zcml_to_include('foo') ['configure.zcml'] By default the function looks for the standard ZCML files ``meta.zcml``, ``configure.zcml``, and ``overrides.zcml`` but this behavior can be overridden:: >>> zcml_to_include('foo', ['meta.zcml']) [] Finally, we know how to get a list of all module dottednames within a distribution, through the DistributionManager adapter:: >>> import foo >>> from z3c.autoinclude.utils import distributionForPackage >>> foo_dist = distributionForPackage(foo) >>> from z3c.autoinclude.utils import DistributionManager >>> DistributionManager(foo_dist).dottedNames() ['foo'] So between these functions we can now get a dictionary of all extension modules which must be loaded for each ZCML group given a base platform. For consistency, we use the same API as with dependency autoinclusion. This time we adapt a base platform (represented by a string referring to an importable dotted module name) to a PluginFinder and call its `includableInfo` method:: >>> from z3c.autoinclude.plugin import PluginFinder >>> pprint(PluginFinder('basepackage').includableInfo(['configure.zcml', ... 'meta.zcml'])) {'configure.zcml': ['foo'], 'meta.zcml': ['testdirective']} ``FooPackage`` has a test-logging directive in its configure.zcml which is defined in meta.zcml in ``TestDirective``. ``FooPackage`` does not know anything about ``TestDirective`` and does not explicitly include its ZCML; so for the test-logging directive to succeed when the ZCML of ``FooPackage`` is loaded, the meta.zcml from ``TestDirective`` must be loaded first. Since ``TestDirective`` offers itself as a plugin for ``BasePackage`` and zcmlgroups are loaded in the conventional order with all meta.zcml first, none of this should explode when we load the ZCML from ``BasePackage`` and the test log should accurately reflect that the ``FooPackage`` ZCML has been loaded:: >>> import basepackage >>> from zope.configuration import xmlconfig >>> from pkg_resources import resource_filename >>> from testdirective.zcml import test_log >>> dummy = xmlconfig.file(resource_filename('basepackage', 'configure.zcml'), ... package=basepackage) >>> pprint(test_log) [u'foo has been loaded'] ``base2`` is a namespace package. ``base2.plug`` is a package that defines a plugin for base2; it extends ``base2``s namespace. >>> from testdirective.zcml import clear_test_log >>> clear_test_log() >>> import base2 >>> from pkg_resources import Requirement, resource_filename >>> req = Requirement.parse('base2') >>> import os >>> filename = resource_filename(req, os.path.join('base2', 'configure.zcml')) >>> dummy = xmlconfig.file(filename, package=base2) >>> pprint(test_log) [u'base2.plug has been loaded'] z3c.autoinclude-0.3.5/src/z3c/autoinclude/README.txt0000644000000000000000000000050012214252576020160 0ustar 00000000000000 ============================ Auto inclusion of zcml files ============================ The doctests are organized into three files: * ``dependency.txt``: for package dependency inclusion * ``plugin.txt``: for package plugin inclusion * ``utils.txt``: for general-purpose utility functions Read them, they're fun. z3c.autoinclude-0.3.5/src/z3c/autoinclude/utils.py0000644000000000000000000001467212214252576020213 0ustar 00000000000000import os from pkg_resources import find_distributions from pprint import pformat import sys class DistributionManager(object): def __init__(self, dist): self.context = dist def namespaceDottedNames(self): """Return dotted names of all namespace packages in distribution. """ return namespaceDottedNames(self.context) def dottedNames(self): """Return dotted names of all relevant packages in a distribution. Relevant packages are those packages that are directly under the namespace packages in the distribution, but not the namespace packages themselves. If no namespace packages exist, return those packages that are directly in the distribution. """ dist_path = self.context.location ns_dottednames = self.namespaceDottedNames() if not ns_dottednames: return subpackageDottedNames(dist_path) result = [] for ns_dottedname in ns_dottednames: path = os.path.join(dist_path, *ns_dottedname.split('.')) subpackages = subpackageDottedNames(path, ns_dottedname) for subpackage in subpackages: if subpackage not in ns_dottednames: result.append(subpackage) return result class ZCMLInfo(dict): def __init__(self, zcml_to_look_for): dict.__init__(self) for zcml_group in zcml_to_look_for: self[zcml_group] = [] def subpackageDottedNames(package_path, ns_dottedname=None): # we do not look for subpackages in zipped eggs if not isUnzippedEgg(package_path): return [] result = [] for subpackage_name in os.listdir(package_path): full_path = os.path.join(package_path, subpackage_name) if isPythonPackage(full_path): if ns_dottedname: result.append('%s.%s' % (ns_dottedname, subpackage_name)) else: result.append(subpackage_name) return sorted(result) def isPythonPackage(path): if not os.path.isdir(path): return False for init_variant in ['__init__.py', '__init__.pyc', '__init__.pyo']: if os.path.isfile(os.path.join(path, init_variant)): return True return False def distributionForPackage(package): package_dottedname = package.__name__ return distributionForDottedName(package_dottedname) def distributionForDottedName(package_dottedname): """ This function is ugly and probably slow. It needs to be heavily commented, it needs narrative doctests, and it needs some broad explanation. Then it needs to be profiled. """ valid_dists_for_package = [] for path in sys.path: dists = find_distributions(path, True) for dist in dists: if not isUnzippedEgg(dist.location): continue packages = find_packages(dist.location) ns_packages = namespaceDottedNames(dist) #if package_dottedname in ns_packages: #continue if package_dottedname not in packages: continue valid_dists_for_package.append((dist, ns_packages)) if len(valid_dists_for_package) == 0: raise LookupError("No distributions found for package `%s`; are you sure it is importable?" % package_dottedname) if len(valid_dists_for_package) > 1: non_namespaced_dists = filter(lambda x: len(x[1]) is 0, valid_dists_for_package) if len(non_namespaced_dists) == 0: # if we only have namespace packages at this point, 'foo.bar' and 'foo.baz', while looking for 'foo', # we can just select the first because the choice has no effect return valid_dists_for_package[0][0] valid_dists_for_package = non_namespaced_dists ### if we have packages 'foo', 'foo.bar', and 'foo.baz', the correct one is 'foo'. ### we really are in trouble if we get into a situation with more than one non-namespaced package at this point. error_msg = ''' Multiple distributions were found that claim to provide the `%s` package. This is most likely because one or more of them uses `%s` as a namespace package, but forgot to declare it in the `namespace_packages` section of its `setup.py`. Please make any necessary adjustments and reinstall the modified distribution(s). Distributions found: %s ''' assert len(non_namespaced_dists) == 1, error_msg % ( package_dottedname, package_dottedname, pformat(non_namespaced_dists)) return valid_dists_for_package[0][0] def namespaceDottedNames(dist): """ Return a list of dotted names of all namespace packages in a distribution. """ try: ns_dottednames = list(dist.get_metadata_lines('namespace_packages.txt')) except IOError: ns_dottednames = [] except KeyError: ns_dottednames = [] return ns_dottednames def isUnzippedEgg(path): """ Check whether a filesystem path points to an unzipped egg; z3c.autoinclude does not support zipped eggs or python libraries that are not packaged as eggs. This function can be called on e.g. entries in sys.path or the location of a distribution object. """ return os.path.isdir(path) ### cargo-culted from setuptools 0.6c9's __init__.py; # importing setuptools is unsafe, but i can't find any # way to get the information that find_packages provides # using pkg_resources and i can't figure out a way to # avoid needing it. from distutils.util import convert_path def find_packages(where='.', exclude=()): """Return a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '*' can be used as a wildcard in the names, such that 'foo.*' will exclude all subpackages of 'foo' (but not 'foo' itself). """ out = [] stack=[(convert_path(where), '')] while stack: where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) if ('.' not in name and os.path.isdir(fn) and os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) for pat in list(exclude)+['ez_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item,pat)] return out z3c.autoinclude-0.3.5/src/z3c/autoinclude/utils.txt0000644000000000000000000000315112214252576020370 0ustar 00000000000000================= Utility functions ================= distributionForPackage is a function that takes a module object and returns the setuptools distribution object that contains the module. It should find the correct distribution for a package whose namespace is extended by other packages in the environment:: >>> from z3c.autoinclude.utils import distributionForPackage >>> import base2 >>> distributionForPackage(base2) base2 0.0 (...base2-0.0...egg) It should also find the correct distribution for namespace packages, even if the namespace being extended is a module defined in another package in the environment:: >>> import base2.plug >>> distributionForPackage(base2.plug) base2-plug 0.0 (...base2_plug-0.0...egg) If you have a virtual package (a namespace package that exists only by having been extended by nested packages) it should find a package:: >>> import enolp >>> distributionForPackage(enolp) enolp.ppa.foo 0.1 (...enolp.ppa.foo-0.1...egg) While we're at it, it should also find the correct distribution for packages whose distribution name has no bearing on the name of the package contained within it:: >>> import basepackage >>> # Ignoring whitespace in order to make tests pass on Windows. >>> distributionForPackage(basepackage) # doctest: +IGNORECASE BasePackage 0.0 (...BasePackage-0.0...egg) >>> import foo >>> distributionForPackage(foo) # doctest: +IGNORECASE FooPackage 0.0 (...FooPackage-0.0...egg) >>> import F.G >>> distributionForPackage(F.G) # doctest: +IGNORECASE SiblingPackage 0.0 (...SiblingPackage-0.0...egg) z3c.autoinclude-0.3.5/src/z3c/autoinclude/zcml.py0000644000000000000000000000770412214252576020016 0ustar 00000000000000from zope.interface import Interface from zope.configuration.xmlconfig import include, includeOverrides from zope.configuration.fields import GlobalObject from zope.dottedname.resolve import resolve from zope.schema import BytesLine from z3c.autoinclude import api from z3c.autoinclude.dependency import DependencyFinder from z3c.autoinclude.utils import distributionForPackage from z3c.autoinclude.plugin import PluginFinder import logging log = logging.getLogger("z3c.autoinclude") def includeZCMLGroup(_context, info, filename, override=False): includable_zcml = info[filename] # ^^ a key error would mean that we are trying to include a group of ZCML # with a filename that wasn't ever searched for. that *should* be an error zcml_context = repr(_context.info) for dotted_name in includable_zcml: log.debug('including file %s from package %s at %s', filename, dotted_name, zcml_context) for dotted_name in includable_zcml: includable_package = resolve(dotted_name) if override: includeOverrides(_context, filename, includable_package) else: include(_context, filename, includable_package) class IIncludeDependenciesDirective(Interface): """Auto-include any ZCML in the dependencies of this package.""" package = GlobalObject( title=u"Package to auto-include for", description=u""" Auto-include all dependencies of this package. """, required=True, ) def includeDependenciesDirective(_context, package): if api.dependencies_disabled(): log.warn('z3c.autoinclude.dependency is disabled but is being invoked by %s' % _context.info) return dist = distributionForPackage(package) info = DependencyFinder(dist).includableInfo(['configure.zcml', 'meta.zcml']) includeZCMLGroup(_context, info, 'meta.zcml') includeZCMLGroup(_context, info, 'configure.zcml') def includeDependenciesOverridesDirective(_context, package): if api.dependencies_disabled(): log.warn('z3c.autoinclude.dependency is disabled but is being invoked by %s' % _context.info) return dist = distributionForPackage(package) info = DependencyFinder(dist).includableInfo(['overrides.zcml']) includeZCMLGroup(_context, info, 'overrides.zcml', override=True) class IIncludePluginsDirective(Interface): """Auto-include any ZCML in the dependencies of this package.""" package = GlobalObject( title=u"Package to auto-include for", description=u""" Auto-include all plugins to this package. """, required=True, ) file = BytesLine( title=u"ZCML filename to look for", description=u""" Name of a particular ZCML file to look for. If omitted, autoinclude will scan for standard filenames (e.g. meta.zcml, configure.zcml, overrides.zcml) """, required=False, ) def includePluginsDirective(_context, package, file=None): if api.plugins_disabled(): log.warn('z3c.autoinclude.plugin is disabled but is being invoked by %s' % _context.info) return dotted_name = package.__name__ if file is None: zcml_to_look_for = ['meta.zcml', 'configure.zcml'] else: zcml_to_look_for = [file] info = PluginFinder(dotted_name).includableInfo(zcml_to_look_for) for filename in zcml_to_look_for: includeZCMLGroup(_context, info, filename) def includePluginsOverridesDirective(_context, package, file=None): if api.plugins_disabled(): log.warn('z3c.autoinclude.plugin is disabled but is being invoked by %s' % _context.info) return dotted_name = package.__name__ if file is None: zcml_to_look_for = ['overrides.zcml'] else: zcml_to_look_for = [file] info = PluginFinder(dotted_name).includableInfo(zcml_to_look_for) for filename in zcml_to_look_for: includeZCMLGroup(_context, info, filename, override=True) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/__init__.py0000644000000000000000000000000212214252576021732 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/tests.py0000644000000000000000000000610712214252576021351 0ustar 00000000000000import os import doctest import unittest from zc.buildout import testing projects_dir = os.path.dirname(__file__) # this is the list of test packages that we'll temporarily install # for the duration of the tests; you MUST add your test package name # to this list if you want it to be available for import in doctests! test_packages = ['APackage', 'BCPackage', 'XYZPackage', 'SiblingPackage', 'BasePackage', 'FooPackage', 'base2', 'base2_plug', 'TestDirective', 'enolp.ppa.foo', 'enolp.ppa.bar'] from zc.buildout.easy_install import install from pkg_resources import working_set def install_projects(projects, target_dir): links = [] for project in projects: project_dir = os.path.join(projects_dir, project) dist_dir = os.path.join(project_dir, 'dist') if os.path.isdir(dist_dir): testing.rmdir(dist_dir) dummy = testing.system("%s setup %s bdist_egg" % ( os.path.join('bin', 'buildout'), project_dir)) links.append(dist_dir) new_working_set = install(projects, target_dir, links=links, working_set=working_set) # we must perform a magical incantation on each distribution for dist in new_working_set: dist.activate() return new_working_set def interactive_testing_env(): """ an interactive debugger with the testing environment set up for free """ import tempfile target_dir = tempfile.mkdtemp('.z3c.autoinclude.test-installs') install_projects(test_packages, target_dir) import code code.interact() def testSetUp(test): """ install test packages so that they can be imported and their egg info examined in test runs """ testing.buildoutSetUp(test) import tempfile target_dir = tempfile.mkdtemp('.z3c.autoinclude.test-installs') install_projects(test_packages, target_dir) def testTearDown(test): from testdirective.zcml import clear_test_log clear_test_log() testing.buildoutTearDown(test) IGNORECASE = doctest.register_optionflag('IGNORECASE') class IgnoreCaseChecker(doctest.OutputChecker): def check_output(self, want, got, optionflags): if optionflags & IGNORECASE: want, got = want.lower(), got.lower() #print repr(want), repr(got), optionflags, IGNORECASE return doctest.OutputChecker.check_output(self, want, got, optionflags) def test_suite(): from pprint import pprint suite = doctest.DocFileSuite('../utils.txt', '../dependency.txt', '../plugin.txt', setUp=testSetUp, tearDown=testTearDown, globs={'pprint':pprint}, checker=IgnoreCaseChecker(), optionflags=doctest.ELLIPSIS) return unittest.TestSuite((suite,)) if __name__ == '__main__': import zope.testing.testrunner zope.testing.testrunner.run([ '--test-path', '/home/egj/z3c.autoinclude/src', ]) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/APackage/setup.py0000644000000000000000000000127212214252576023001 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='APackage', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, install_requires=[ 'BCPackage', 'z3c.autoinclude', 'TestDirective', ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/APackage/a/__init__.py0000644000000000000000000000000212214252576023606 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/APackage/a/configure.zcml0000644000000000000000000000050712214252576024357 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2/setup.py0000644000000000000000000000122012214252576022332 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='base2', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, install_requires=[ 'z3c.autoinclude', ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2/base2/__init__.py0000644000000000000000000000001412214252576023725 0ustar 00000000000000# a package z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2/base2/configure.zcml0000644000000000000000000000023312214252576024467 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2_plug/setup.py0000644000000000000000000000130512214252576023365 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='base2_plug', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(), namespace_packages=['base2'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', ], entry_points=""" [z3c.autoinclude.plugin] target = base2 """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2_plug/base2/__init__.py0000644000000000000000000000036412214252576024764 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2_plug/base2/plug/__init__.py0000644000000000000000000000001412214252576025723 0ustar 00000000000000# a package z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/base2_plug/base2/plug/configure.zcml0000644000000000000000000000025412214252576026470 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BasePackage/setup.py0000644000000000000000000000122612214252576023472 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='BasePackage', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, install_requires=[ 'z3c.autoinclude', ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BasePackage/basepackage/__init__.py0000644000000000000000000000000012214252576026304 0ustar 00000000000000z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BasePackage/basepackage/configure.zcml0000644000000000000000000000023312214252576027053 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BCPackage/setup.py0000644000000000000000000000134212214252576023103 0ustar 00000000000000from setuptools import setup, find_packages version = '0.1' setup(name='BCPackage', version=version, description="", long_description="""\ """, # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[ ], keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(), namespace_packages=['b'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', 'SiblingPackage', # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BCPackage/b/__init__.py0000644000000000000000000000036412214252576023726 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BCPackage/b/c/__init__.py0000644000000000000000000000001712214252576024143 0ustar 00000000000000# #sanity test z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/BCPackage/b/c/configure.zcml0000644000000000000000000000063312214252576024706 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.bar/setup.py0000644000000000000000000000143212214252576024002 0ustar 00000000000000from setuptools import setup, find_packages version = '0.1' setup(name='enolp.ppa.bar', version=version, description="", long_description="""\ """, # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Framework :: Zope3", "Programming Language :: Python", ], keywords='', author='', author_email='', url='', license="''", packages=find_packages(exclude=['ez_setup']), namespace_packages=['enolp', 'enolp.ppa'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/__init__.py0000644000000000000000000000036412214252576025521 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/ppa/__init__.py0000644000000000000000000000036412214252576026301 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/ppa/bar/__init__.py0000644000000000000000000000000012214252576027030 0ustar 00000000000000z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.foo/setup.py0000644000000000000000000000143212214252576024021 0ustar 00000000000000from setuptools import setup, find_packages version = '0.1' setup(name='enolp.ppa.foo', version=version, description="", long_description="""\ """, # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Framework :: Zope3", "Programming Language :: Python", ], keywords='', author='', author_email='', url='', license="''", packages=find_packages(exclude=['ez_setup']), namespace_packages=['enolp', 'enolp.ppa'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/__init__.py0000644000000000000000000000036412214252576025540 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/ppa/__init__.py0000644000000000000000000000036412214252576026320 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/ppa/foo/__init__.py0000644000000000000000000000000012214252576027066 0ustar 00000000000000z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/FooPackage/setup.py0000644000000000000000000000131612214252576023343 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='FooPackage', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, install_requires=[ 'z3c.autoinclude', ], entry_points=""" # -*- Entry points: -*- [z3c.autoinclude.plugin] fleem = basepackage """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/FooPackage/foo/__init__.py0000644000000000000000000000000012214252576024512 0ustar 00000000000000z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/FooPackage/foo/configure.zcml0000644000000000000000000000015612214252576025265 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/setup.py0000644000000000000000000000150112214252576024203 0ustar 00000000000000from setuptools import setup, find_packages version = '0.0' setup(name='SiblingPackage', version=version, description="", long_description="""\ """, # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='GPL', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), namespace_packages=['F'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/__init__.py0000644000000000000000000000036412214252576024775 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/G/__init__.py0000644000000000000000000000000212214252576025150 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/G/meta.zcml0000644000000000000000000000025012214252576024661 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/H/__init__.py0000644000000000000000000000000212214252576025151 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/H/configure.zcml0000644000000000000000000000015512214252576025721 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SiblingPackage/F/H/meta.zcml0000644000000000000000000000010012214252576024654 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SRCPackage/setup.py0000644000000000000000000000134212214252576023246 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='SRCPackage', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages('src', exclude=['ez_setup', 'examples', 'tests']), package_dir={'': 'src'}, include_package_data=True, zip_safe=False, install_requires=[ 'BCPackage', 'z3c.autoinclude', 'TestDirective', ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SRCPackage/src/funsrc/__init__.py0000644000000000000000000000000212214252576025724 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/SRCPackage/src/funsrc/configure.zcml0000644000000000000000000000050712214252576026475 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/TestDirective/setup.py0000644000000000000000000000134612214252576024125 0ustar 00000000000000from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='TestDirective', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers keywords='', author='', author_email='', url='', license='', package_data = {'': ['*.zcml',]}, packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), include_package_data=True, zip_safe=False, install_requires=[ # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- [z3c.autoinclude.plugin] target = basepackage """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/TestDirective/testdirective/__init__.py0000644000000000000000000000000212214252576027366 0ustar 00000000000000# z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/TestDirective/testdirective/meta.zcml0000644000000000000000000000051412214252576027102 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/TestDirective/testdirective/zcml.py0000644000000000000000000000102512214252576026602 0ustar 00000000000000from zope.interface import Interface from zope.schema import TextLine test_log = [] def clear_test_log(): while test_log: test_log.pop() class ITestDirective(Interface): """Auto-include any ZCML in the dependencies of this package.""" test_string = TextLine( title=u"Test package string", description=u""" Append a value to a global variable to inspect later """, required=True, ) def testDirective(_context, test_string): test_log.append(test_string) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/XYZPackage/setup.py0000644000000000000000000000141512214252576023312 0ustar 00000000000000from setuptools import setup, find_packages version = '0.1' setup(name='XYZPackage', version=version, description="", long_description="""\ """, # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers classifiers=[ "Framework :: Zope3", "Programming Language :: Python", ], keywords='', author='', author_email='', url='', license="''", packages=find_packages(exclude=['ez_setup']), namespace_packages=['x', 'x.y'], include_package_data=True, zip_safe=False, install_requires=[ 'setuptools', 'TestDirective', # -*- Extra requirements: -*- ], entry_points=""" # -*- Entry points: -*- """, ) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/XYZPackage/x/__init__.py0000644000000000000000000000036412214252576024162 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/XYZPackage/x/y/__init__.py0000644000000000000000000000036412214252576024432 0ustar 00000000000000# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) z3c.autoinclude-0.3.5/src/z3c/autoinclude/tests/XYZPackage/x/y/z/__init__.py0000644000000000000000000000000012214252576024666 0ustar 00000000000000z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/dependency_links.txt0000644000000000000000000000000112214252602024214 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/entry_points.txt0000644000000000000000000000014612214252602023445 0ustar 00000000000000 [console_scripts] autoinclude-test = z3c.autoinclude.tests.tests:interactive_testing_env z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/namespace_packages.txt0000644000000000000000000000000412214252602024473 0ustar 00000000000000z3c z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/not-zip-safe0000644000000000000000000000000112214252576022406 0ustar 00000000000000 z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/PKG-INFO0000644000000000000000000002175312214252602021253 0ustar 00000000000000Metadata-Version: 1.1 Name: z3c.autoinclude Version: 0.3.5 Summary: Automatically include ZCML Home-page: http://pypi.python.org/pypi/z3c.autoinclude Author: Zope Foundation and Contributors Author-email: zope-dev@zope.org License: ZPL Description: Overview ======== This package adds two new ZCML directives to automatically detect ZCML files to include: "includeDependencies" and "includePlugins". When you want to include a Zope-based package in your application, you have to repeat yourself in two places: you have to add the package itself (in a setup.py, buildout, etc) and you also have to include its ZCML with an directive or a package-includes slug. Because you have to repeat yourself, you can easily make an error where you add a new package but forget to include its ZCML. z3c.autoinclude lets you circumvent this error-prone process with automatic detection and inclusion of ZCML files. includeDependencies ------------------- The "includeDependencies" directive searches through the dependencies in your setup.py file (install_requires), and includes the ZCML files in those packages that it finds. Inclusion order matches the order in the setup.py file. You can pass a path for the package you want to include dependencies for, but typically you pass in the current package, as follows:: With this directive, you no longer have to add an explicit ```` for every new dependency of your project. Grok_ and grokproject_ use this functionality out of the box. The grokproject command will automatically add the ``includeDependencies`` directive in the ZCML of the project it generates. You can then stop worrying about manual ZCML inclusion in the vast majority of cases. includePlugins -------------- The "includePlugins" directive uses entry points to find installed packages that broadcast themselves as plugins to a particular base package. You can pass a path for the package you want to include plugins for, but typically you pass in the current package, as follows:: To broadcast a package as a plugin to a base package called "my_base", add the following lines to the plugin package's ``setup.py``:: entry_points=""" [z3c.autoinclude.plugin] target = my_base """ The Details =========== Setup ----- To make the z3c.autoinclude directives available for use in your application or framework, you need to include it (in your ``meta.zcml`` for instance), like this:: Grok already does this for you automatically. Disabling z3c.autoinclude ------------------------- It is often useful to disable z3c.autoinclude's functionality for debugging purposes or test runs. To disable autoinclusion, set the environment variables "Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED" and "Z3C_AUTOINCLUDE_PLUGINS_DISABLED". When autoinclusion is disabled, the autoinclusion directives will issue a warning to the log and do nothing. ZCML Filenames -------------- The includeDependencies directive automatically includes ``configure.zcml`` and ``meta.zcml`` files that live in the main package directories. For automatic inclusion of dependencies' overrides, there is an directive. In some cases, a package may use unusual names or locations for its ZCML files. In that case you will need to modify your package's ``configure.zcml`` and ``meta.zcml`` yourself to include the ZCML using the manual ``include`` directive. The includePlugins directive automatically includes ``configure.zcml`` and ``meta.zcml`` files by default, and the includePluginsOverrides directive automatically includes ``overrides.zcml`` files by default. But, like "", these directives also have an optional "file" parameter, so you can automatically include all ``foo.zcml`` files in your package's plugins like this:: The includeDependencies directives will soon offer this option as well. .. _Grok: http://grok.zope.org .. _grokproject: http://pypi.python.org/pypi/grokproject Changes ======= 0.3.5 (2013-09-12) ------------------ * If a module cannot be resolved, but raises ``ImportError``, log a warn and continue. This fixes an issue where the determining the includable packages would fail due to a problem with the importation of one or potentially more modules. An example is the ``gobject`` module which provides a Python binding to ``GObject``. In a recent API deprecation, one is no longer allowed to both import ``gi`` and ``gobject``. 0.3.4 (2011-03-11) ------------------ * Remove unnecessary distribution lookup in the PluginFinder. 0.3.3 (2010-05-06) ------------------ * Ignore case in tests in order to pass tests on Windows. * Clearly specify license as ZPL (not public domain, as it was claiming before). 0.3.2 (2009-12-19) ------------------ * Let `subpackageDottedNames` always return a sorted list of package names as `os.listdir` doesn't on some platforms. 0.3.1 (2009-05-04) ------------------ * z3c.autoinclude no longer (spuriously) depends on PasteScript. 0.3 (2009-03-03) ---------------- * Allow virtual namespace packages like 'plone' to be specified for the package. I think this may need more thought for the dependency case. * Allow ZCML ``includePlugins`` directive to specify a particular ZCML file to try to load from plugins, so that loading of meta, configure and overrides can be split across three ZCML files if desired. You can specify a file like: . * Provide a separate ``includePluginsOverrides`` directive to be used when loading overrides, and no longer look for 'overrides.zcml' files by default with ``includePlugins``. * Removed the deprecated ``autoinclude`` and ``autoincludeOverrides`` directives. * Allow autoinclusion to be disabled by setting `os.environ['Z3C_AUTOINCLUDE_PLUGINS_DISABLED']` and `os.environ['Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED']`, potentially useful for test runners or debugging sessions. See http://lists.plone.org/pipermail/framework-team/2009-February/002689.html for discussion. 0.2.2 (2008-04-22) ------------------ * Gracefully catch KeyErrors in ``namespaceForDottedName``; get_metadata_lines will sometimes throw this for certain distribution types, apparently. In particular, some systems' version of Python itself will be wrapped in a distribution which throws this error, resulting in system-dependent unresumable breakage of z3c.autoinclude prior to this fix. 0.2.1 (2008-04-21) ------------------ * Fixed bug which prevented proper inclusion of packages when the base package's namespace has been extended by other installed packages. * Rewrote ``distributionForPackage`` function. * Added additional tests for ``includePlugins`` and utility functions. * Fixed bug which made z3c.autoinclude look for ZCML in namespaces of nested namespace packages (eg, if there happened to -- improperly -- be an x/y/configure.zcml in a x.y.z package with an x.y namespace, it would have been included; this is incorrect.) 0.2 (2008-04-18) ---------------- * Added new directive ``includePlugins``. * Renamed ``autoinclude`` directive to ``includeDependencies``. * Deprecated ``autoinclude`` directive. 0.1 (2008-02-25) ---------------- * Initial public release. Platform: UNKNOWN Classifier: Framework :: Zope3 Classifier: Programming Language :: Python z3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/requires.txt0000644000000000000000000000016512214252602022550 0ustar 00000000000000setuptools zope.dottedname zope.interface zope.configuration zope.schema zc.buildout [test] zc.buildout zope.testingz3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/SOURCES.txt0000644000000000000000000000654512214252602022044 0ustar 00000000000000.gitignore .travis.yml CHANGES.rst COPYRIGHT.rst LICENSE.rst MANIFEST.in README.rst TODO.rst bootstrap.py buildout.cfg setup.py src/z3c/__init__.py src/z3c.autoinclude.egg-info/PKG-INFO src/z3c.autoinclude.egg-info/SOURCES.txt src/z3c.autoinclude.egg-info/dependency_links.txt src/z3c.autoinclude.egg-info/entry_points.txt src/z3c.autoinclude.egg-info/namespace_packages.txt src/z3c.autoinclude.egg-info/not-zip-safe src/z3c.autoinclude.egg-info/requires.txt src/z3c.autoinclude.egg-info/top_level.txt src/z3c/autoinclude/README.txt src/z3c/autoinclude/__init__.py src/z3c/autoinclude/api.py src/z3c/autoinclude/dependency.py src/z3c/autoinclude/dependency.txt src/z3c/autoinclude/meta.zcml src/z3c/autoinclude/plugin.py src/z3c/autoinclude/plugin.txt src/z3c/autoinclude/utils.py src/z3c/autoinclude/utils.txt src/z3c/autoinclude/zcml.py src/z3c/autoinclude/tests/__init__.py src/z3c/autoinclude/tests/tests.py src/z3c/autoinclude/tests/APackage/setup.py src/z3c/autoinclude/tests/APackage/a/__init__.py src/z3c/autoinclude/tests/APackage/a/configure.zcml src/z3c/autoinclude/tests/BCPackage/setup.py src/z3c/autoinclude/tests/BCPackage/b/__init__.py src/z3c/autoinclude/tests/BCPackage/b/c/__init__.py src/z3c/autoinclude/tests/BCPackage/b/c/configure.zcml src/z3c/autoinclude/tests/BasePackage/setup.py src/z3c/autoinclude/tests/BasePackage/basepackage/__init__.py src/z3c/autoinclude/tests/BasePackage/basepackage/configure.zcml src/z3c/autoinclude/tests/FooPackage/setup.py src/z3c/autoinclude/tests/FooPackage/foo/__init__.py src/z3c/autoinclude/tests/FooPackage/foo/configure.zcml src/z3c/autoinclude/tests/SRCPackage/setup.py src/z3c/autoinclude/tests/SRCPackage/src/funsrc/__init__.py src/z3c/autoinclude/tests/SRCPackage/src/funsrc/configure.zcml src/z3c/autoinclude/tests/SiblingPackage/setup.py src/z3c/autoinclude/tests/SiblingPackage/F/__init__.py src/z3c/autoinclude/tests/SiblingPackage/F/G/__init__.py src/z3c/autoinclude/tests/SiblingPackage/F/G/meta.zcml src/z3c/autoinclude/tests/SiblingPackage/F/H/__init__.py src/z3c/autoinclude/tests/SiblingPackage/F/H/configure.zcml src/z3c/autoinclude/tests/SiblingPackage/F/H/meta.zcml src/z3c/autoinclude/tests/TestDirective/setup.py src/z3c/autoinclude/tests/TestDirective/testdirective/__init__.py src/z3c/autoinclude/tests/TestDirective/testdirective/meta.zcml src/z3c/autoinclude/tests/TestDirective/testdirective/zcml.py src/z3c/autoinclude/tests/XYZPackage/setup.py src/z3c/autoinclude/tests/XYZPackage/x/__init__.py src/z3c/autoinclude/tests/XYZPackage/x/y/__init__.py src/z3c/autoinclude/tests/XYZPackage/x/y/z/__init__.py src/z3c/autoinclude/tests/base2/setup.py src/z3c/autoinclude/tests/base2/base2/__init__.py src/z3c/autoinclude/tests/base2/base2/configure.zcml src/z3c/autoinclude/tests/base2_plug/setup.py src/z3c/autoinclude/tests/base2_plug/base2/__init__.py src/z3c/autoinclude/tests/base2_plug/base2/plug/__init__.py src/z3c/autoinclude/tests/base2_plug/base2/plug/configure.zcml src/z3c/autoinclude/tests/enolp.ppa.bar/setup.py src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/__init__.py src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/ppa/__init__.py src/z3c/autoinclude/tests/enolp.ppa.bar/enolp/ppa/bar/__init__.py src/z3c/autoinclude/tests/enolp.ppa.foo/setup.py src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/__init__.py src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/ppa/__init__.py src/z3c/autoinclude/tests/enolp.ppa.foo/enolp/ppa/foo/__init__.pyz3c.autoinclude-0.3.5/src/z3c.autoinclude.egg-info/top_level.txt0000644000000000000000000000000412214252602022672 0ustar 00000000000000z3c