Skip to content

Commit

Permalink
format code with black (pure default settings)
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Sep 19, 2019
1 parent 52c258c commit b2f28b1
Show file tree
Hide file tree
Showing 32 changed files with 479 additions and 401 deletions.
44 changes: 19 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
from setuptools import setup, find_packages

version = '0.3.10.dev0'
version = "0.3.10.dev0"
__version__ = version

TESTS_REQUIRE = [
"zc.buildout",
"zope.testing",
]
TESTS_REQUIRE = ["zc.buildout", "zope.testing"]

setup(
name='z3c.autoinclude',
name="z3c.autoinclude",
version=__version__,
description="Automatically include ZCML",
long_description=(open('README.rst').read() + "\n" +
open('CHANGES.rst').read()),
long_description=(open("README.rst").read() + "\n" + open("CHANGES.rst").read()),
classifiers=[
"Framework :: Zope :: 3",
"Programming Language :: Python",
Expand All @@ -25,28 +21,26 @@
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
keywords='',
author='Zope Foundation and Contributors',
author_email='zope-dev@zope.org',
url='https://pypi.org/project/z3c.autoinclude',
license='ZPL',
packages=find_packages('src'),
package_dir={'': 'src'},
namespace_packages=['z3c'],
keywords="",
author="Zope Foundation and Contributors",
author_email="zope-dev@zope.org",
url="https://pypi.org/project/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>=4.2.0',
'zc.buildout',
"setuptools",
"zope.dottedname",
"zope.interface",
"zope.configuration",
"zope.schema>=4.2.0",
"zc.buildout",
],
tests_require=TESTS_REQUIRE,
extras_require={
'test': TESTS_REQUIRE,
},
extras_require={"test": TESTS_REQUIRE},
entry_points="""
[console_scripts]
autoinclude-test = z3c.autoinclude.tests.tests:interactive_testing_env
Expand Down
2 changes: 2 additions & 0 deletions src/z3c/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# this is a namespace package
try:
import pkg_resources

pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil

__path__ = pkgutil.extend_path(__path__, __name__)
18 changes: 14 additions & 4 deletions src/z3c/autoinclude/api.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import os

DEP_KEY = 'Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED'
PLUGIN_KEY = 'Z3C_AUTOINCLUDE_PLUGINS_DISABLED'
DEP_KEY = "Z3C_AUTOINCLUDE_DEPENDENCIES_DISABLED"
PLUGIN_KEY = "Z3C_AUTOINCLUDE_PLUGINS_DISABLED"


def dependencies_disabled():
return DEP_KEY in os.environ


def disable_dependencies():
os.environ[DEP_KEY] = 'True'
os.environ[DEP_KEY] = "True"


def enable_dependencies():
del os.environ[DEP_KEY]


def plugins_disabled():
return PLUGIN_KEY in os.environ


def disable_plugins():
os.environ[PLUGIN_KEY] = 'True'
os.environ[PLUGIN_KEY] = "True"


def enable_plugins():
del os.environ[PLUGIN_KEY]
15 changes: 8 additions & 7 deletions src/z3c/autoinclude/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class DependencyFinder(DistributionManager):

def includableInfo(self, zcml_to_look_for):
"""Return the packages in the dependencies which are includable.
Expand All @@ -30,28 +29,30 @@ def includableInfo(self, zcml_to_look_for):
module = resolve(dotted_name)
except ImportError as exc:
logger.warning(
"resolve(%r) raised import error: %s" % (dotted_name, exc))
"resolve(%r) raised import error: %s" % (dotted_name, exc)
)
continue
module_file = getattr(module, '__file__', None)
module_file = getattr(module, "__file__", None)
if module_file is None:
logger.warning(
"%r has no __file__ attribute" % dotted_name)
logger.warning("%r has no __file__ attribute" % dotted_name)
continue
for candidate in zcml_to_look_for:
candidate_path = os.path.join(
os.path.dirname(module_file), candidate)
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']
zcml_filenames = ["meta.zcml", "configure.zcml", "overrides.zcml"]
dist = get_distribution(project_name)
include_finder = DependencyFinder(dist)
return include_finder.includableInfo(zcml_filenames)
7 changes: 4 additions & 3 deletions src/z3c/autoinclude/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ def includableInfo(self, zcml_to_look_for):


def find_plugins(dotted_name):
for ep in iter_entry_points('z3c.autoinclude.plugin'):
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')
zcmlgroups = ("meta.zcml", "configure.zcml", "overrides.zcml")

includable_info = []

for zcmlgroup in zcmlgroups:
Expand Down
41 changes: 19 additions & 22 deletions src/z3c/autoinclude/tests/APackage/setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
from setuptools import setup, find_packages
import sys, os

version = '0.0'
version = "0.0"

setup(name='APackage',
version=version,
description="",
long_description="""\
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="""
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: -*-
""",
)
)
3 changes: 2 additions & 1 deletion src/z3c/autoinclude/tests/BCPackage/b/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
2 changes: 1 addition & 1 deletion src/z3c/autoinclude/tests/BCPackage/b/c/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#
#sanity test
# sanity test
52 changes: 26 additions & 26 deletions src/z3c/autoinclude/tests/BCPackage/setup.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
from setuptools import setup, find_packages

version = '0.1'
version = "0.1"

setup(name='BCPackage',
version=version,
description="",
long_description="""\
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="""
# 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: -*-
""",
)
)
39 changes: 19 additions & 20 deletions src/z3c/autoinclude/tests/BasePackage/setup.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
from setuptools import setup, find_packages
import sys, os

version = '0.0'
version = "0.0"

setup(name='BasePackage',
version=version,
description="",
long_description="""\
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="""
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: -*-
""",
)
)
39 changes: 19 additions & 20 deletions src/z3c/autoinclude/tests/FooPackage/setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
from setuptools import setup, find_packages
import sys, os

version = '0.0'
version = "0.0"

setup(name='FooPackage',
version=version,
description="",
long_description="""\
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="""
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
""",
)
)
Loading

0 comments on commit b2f28b1

Please sign in to comment.