From a7ef7838e9c43e1ff9a89518725f18ac356bf817 Mon Sep 17 00:00:00 2001 From: Ryan J Ollos Date: Wed, 4 Apr 2018 13:58:04 -0700 Subject: [PATCH 1/3] Make this a proper namespace package --- setup.py | 5 +++-- tracext/__init__.py | 1 + tracext/{github.py => github/__init__.py} | 0 3 files changed, 4 insertions(+), 2 deletions(-) rename tracext/{github.py => github/__init__.py} (100%) diff --git a/setup.py b/setup.py index e5f510f..4000196 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ # This software is licensed as described in the file LICENSE, which # you should have received as part of this distribution. -from setuptools import setup +from setuptools import setup, find_packages setup( name='trac-github', @@ -14,7 +14,8 @@ url='https://github.com/trac-hacks/trac-github', description='Trac - GitHub integration', download_url='https://pypi.python.org/pypi/trac-github', - packages=['tracext'], + packages=find_packages(), + namespace_packages=['tracext'], platforms='all', license='BSD', extras_require={'oauth': ['requests_oauthlib >= 0.5']}, diff --git a/tracext/__init__.py b/tracext/__init__.py index e69de29..de40ea7 100644 --- a/tracext/__init__.py +++ b/tracext/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/tracext/github.py b/tracext/github/__init__.py similarity index 100% rename from tracext/github.py rename to tracext/github/__init__.py From 6f4f97d61754dd0a2e785b8a75a0e0e6e30b5cd9 Mon Sep 17 00:00:00 2001 From: Ryan J Ollos Date: Wed, 4 Apr 2018 14:37:08 -0700 Subject: [PATCH 2/3] GitHubMixin doesn't need to inherit from Component All of the classes utilizing the mixin inherit from Component, and we don't need to support enabling/ disabling GitHubMixin. --- tracext/github/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracext/github/__init__.py b/tracext/github/__init__.py index 6fc9a58..b8a46a6 100644 --- a/tracext/github/__init__.py +++ b/tracext/github/__init__.py @@ -210,7 +210,7 @@ def _oauth_session(self, req, state=None): -class GitHubMixin(Component): +class GitHubMixin(object): webhook_secret = Option('github', 'webhook_secret', '', doc="""GitHub webhook secret token. From a30d756e0ebf498d2aa76891169ca54ac941175e Mon Sep 17 00:00:00 2001 From: Ryan J Ollos Date: Sun, 8 Apr 2018 15:01:42 -0700 Subject: [PATCH 3/3] Fix test failure due to section already present The section already present is due to an `Option` defined on a class that doesn't inherit from Component: https://trac.edgewall.org/ticket/12457 --- runtests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtests.py b/runtests.py index 2851455..6342a7d 100755 --- a/runtests.py +++ b/runtests.py @@ -124,7 +124,8 @@ def createTracEnvironment(cls, **kwargs): conf.set('git', 'cached_repository', 'true') conf.set('git', 'persistent_cache', 'true') - conf.add_section('github') + if not conf.has_section('github'): + conf.add_section('github') client_id = '01234567890123456789' if 'client_id' in kwargs: client_id = kwargs['client_id']