Skip to content

Commit

Permalink
Added backportsclone test package to test bug #6.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Feb 21, 2019
1 parent 1d559ef commit 6780b5c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/z3c/autoinclude/dependency.txt
Expand Up @@ -22,6 +22,7 @@ for the requirements of that distribution::
>>> pprint(sorted(reqs, key=lambda r:r.project_name))
[Requirement.parse('BCPackage'),
Requirement.parse('TestDirective'),
Requirement.parse('backportsclone'),
Requirement.parse('z3c.autoinclude')]

We can turn this requirement into a distribution::
Expand Down
1 change: 1 addition & 0 deletions src/z3c/autoinclude/tests/APackage/setup.py
Expand Up @@ -22,6 +22,7 @@
'BCPackage',
'z3c.autoinclude',
'TestDirective',
'backportsclone',
],
entry_points="""
# -*- Entry points: -*-
Expand Down
63 changes: 63 additions & 0 deletions src/z3c/autoinclude/tests/backportsclone/setup.py
@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(name='backportsclone',
version='1.0',
description='Namespace for backported Python features',
long_description=u"""\
Copy of the empty backports package.
See https://pypi.org/project/backports/
and code: https://bitbucket.org/brandon/backports
I (Maurits van Rees) am seeing problems in z3c.autoinclude with this.
See https://github.com/zopefoundation/z3c.autoinclude/issues/6
So I copied it to backportsclone so I can test with it.
To continue a part of the original readme:
Building your own backports module
----------------------------------
Placing a module of your own inside of the ``backports`` namespace
requires only a few simple steps. First, set your project up like::
project/
project/setup.py
project/backports/
project/backports/__init__.py <--- SPECIAL - see below!
project/backports/yourpkg/
project/backports/yourpkg/__init__.py
project/backports/yourpkg/foo.py
project/backports/yourpkg/bar.py
This places your own package inside of the ``backports`` namespace,
so your package and its modules can be imported like this::
import backports.yourpkg
import backports.yourpkg.foo
The one **absolutely essential rule** is that the ``__init__.py`` inside
of the ``backports`` directory itself **must** have the following code
as its content::
# A Python "namespace package" http://www.python.org/dev/peps/pep-0382/
# This always goes inside of a namespace package's __init__.py
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
If you fail to include this code, then the namespace package might fail
to see all of the packages beneath it, and ``import`` statements might
return errors.
A live example of a package that implements all of this can be
downloaded from the Python Package Index:
http://pypi.python.org/pypi/backports.ssl_match_hostname/3.2a3
""",
author='Brandon Craig Rhodes and Maurits van Rees',
author_email='info@example.org',
url='http://bitbucket.org/brandon/backports',
# packages=['backportsclone'],
)
4 changes: 3 additions & 1 deletion src/z3c/autoinclude/tests/tests.py
Expand Up @@ -16,7 +16,9 @@
test_packages = ['APackage', 'BCPackage', 'XYZPackage',
'SiblingPackage', 'BasePackage', 'FooPackage',
'base2', 'base2_plug', 'TestDirective',
'enolp.ppa.foo', 'enolp.ppa.bar']
'enolp.ppa.foo', 'enolp.ppa.bar',
'backportsclone',
]


from zc.buildout.easy_install import install
Expand Down

0 comments on commit 6780b5c

Please sign in to comment.