[PATCH seda] [pkg] Distribute documentation

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Apr 11 15:12:00 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1491912847 -7200
#      Tue Apr 11 14:14:07 2017 +0200
# Node ID 5c03635c81953329f56e30b25d762dd7bab2bbca
# Parent  a36decbdc2cc6070aa58ca712cc5a3abe87dd34e
[pkg] Distribute documentation

so it's accessible through pkg_resources. I didn't find a proper way to declare
non-package data file from the setuptools documentation, the only way I found
was to make 'doc' subdirectory appears as a sub-package.

diff --git a/cubicweb_seda/site_cubicweb.py b/cubicweb_seda/site_cubicweb.py
--- a/cubicweb_seda/site_cubicweb.py
+++ b/cubicweb_seda/site_cubicweb.py
@@ -14,43 +14,13 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 
 from logilab.common.decorators import monkeypatch
 
-# hack to avoid crash when cube is installed in a directory specified by CW_CUBES_PATH, because
-# `RegistrableInstance` attempt to compute its __module__, but in that case the file isn't in the
-# python path. This should go away once cubes become regular packages.
-
-import traceback
-
-from logilab.common import registry
-
-from cubicweb import rtags
 from cubicweb.entity import Entity
 
 
- at monkeypatch(registry.RegistrableInstance, methodname='__new__')
- at staticmethod
-def __new__(cls, *args, **kwargs):
-    """Add a __module__ attribute telling the module where the instance was
-    created, for automatic registration.
-    """
-    module = kwargs.pop('__module__', None)
-    self = super(registry.RegistrableInstance, cls).__new__(cls)
-    if module is None:
-        filepath = traceback.extract_stack(limit=2)[0][0]
-        module = registry._modname_from_path(filepath)
-    self.__module__ = module
-    return self
-
-
- at monkeypatch(rtags.RelationTags)
-def __init__(self, __module__=None):
-    super(rtags.RelationTags, self).__init__()
-    self._tagdefs = {}
-
-
 Entity.cw_skip_copy_for.append(('container', 'subject'))
 Entity.cw_skip_copy_for.append(('container', 'object'))
 Entity.cw_skip_copy_for.append(('clone_of', 'subject'))
 Entity.cw_skip_copy_for.append(('clone_of', 'object'))
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -66,11 +66,12 @@ setup(
     long_description=long_description,
     author=author,
     author_email=author_email,
     url=web,
     classifiers=classifiers,
-    packages=find_packages(exclude=['test']),
+    packages=find_packages(exclude=['test']) + ['cubicweb_seda.doc'],
+    package_dir={'cubicweb_seda.doc': 'doc'},
     install_requires=install_requires,
     include_package_data=True,
     entry_points={
         'cubicweb.cubes': [
             'seda=cubicweb_seda',


More information about the saem-devel mailing list