From 77a6c7111979735794c960821ce42a32d035e1fb Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Thu, 15 Oct 2015 01:44:33 -0700 Subject: [PATCH] Moved templates inside of the package to enable setuptools distribution via package_data. --- MANIFEST.in | 2 +- rtv/oauth.py | 2 +- {templates => rtv/templates}/index.html | 0 {templates => rtv/templates}/rtv.1.template | 0 scripts/build_manpage.py | 4 ++-- setup.py | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename {templates => rtv/templates}/index.html (100%) rename {templates => rtv/templates}/rtv.1.template (100%) diff --git a/MANIFEST.in b/MANIFEST.in index c06d665..482bbe9 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,4 +4,4 @@ include CONTRIBUTORS.rst include README.rst include LICENSE include rtv.1 -include templates/index.html +include rtv/templates/index.html diff --git a/rtv/oauth.py b/rtv/oauth.py index 62aee86..4be1b2c 100644 --- a/rtv/oauth.py +++ b/rtv/oauth.py @@ -44,7 +44,7 @@ class OAuthTool(object): # Initialize Tornado webapp routes = [('/', AuthHandler)] - self.callback_app = web.Application(routes, template_path='templates') + self.callback_app = web.Application(routes, template_path='rtv/templates') self.reddit.set_oauth_app_info(config.oauth_client_id, config.oauth_client_secret, diff --git a/templates/index.html b/rtv/templates/index.html similarity index 100% rename from templates/index.html rename to rtv/templates/index.html diff --git a/templates/rtv.1.template b/rtv/templates/rtv.1.template similarity index 100% rename from templates/rtv.1.template rename to rtv/templates/rtv.1.template diff --git a/scripts/build_manpage.py b/scripts/build_manpage.py index 4ac0c33..a0884f4 100644 --- a/scripts/build_manpage.py +++ b/scripts/build_manpage.py @@ -54,8 +54,8 @@ def main(): data['copyright'] = rtv.__copyright__ # Escape dashes is all of the sections data = {k:v.replace('-', r'\-') for k,v in data.items()} - print('Reading from %s/templates/rtv.1.template' % ROOT) - with open(os.path.join(ROOT, 'templates/rtv.1.template')) as fp: + print('Reading from %s/rtv/templates/rtv.1.template' % ROOT) + with open(os.path.join(ROOT, 'rtv/templates/rtv.1.template')) as fp: template = fp.read() print('Populating template') out = template.format(**data) diff --git a/setup.py b/setup.py index 2fbeee4..f3bc867 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setuptools.setup( license='MIT', keywords='reddit terminal praw curses', packages=['rtv'], - include_package_data=True, + package_data={'rtv': ['templates/index.html']}, data_files=[("share/man/man1", ["rtv.1"])], install_requires=requirements, entry_points={'console_scripts': ['rtv=rtv.__main__:main']},