Moved templates inside of the package to enable setuptools distribution via package_data.

This commit is contained in:
Michael Lazar
2015-10-15 01:44:33 -07:00
parent aa2f810069
commit 77a6c71119
6 changed files with 5 additions and 5 deletions

View File

@@ -4,4 +4,4 @@ include CONTRIBUTORS.rst
include README.rst include README.rst
include LICENSE include LICENSE
include rtv.1 include rtv.1
include templates/index.html include rtv/templates/index.html

View File

@@ -44,7 +44,7 @@ class OAuthTool(object):
# Initialize Tornado webapp # Initialize Tornado webapp
routes = [('/', AuthHandler)] 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, self.reddit.set_oauth_app_info(config.oauth_client_id,
config.oauth_client_secret, config.oauth_client_secret,

View File

@@ -54,8 +54,8 @@ def main():
data['copyright'] = rtv.__copyright__ data['copyright'] = rtv.__copyright__
# Escape dashes is all of the sections # Escape dashes is all of the sections
data = {k:v.replace('-', r'\-') for k,v in data.items()} data = {k:v.replace('-', r'\-') for k,v in data.items()}
print('Reading from %s/templates/rtv.1.template' % ROOT) print('Reading from %s/rtv/templates/rtv.1.template' % ROOT)
with open(os.path.join(ROOT, 'templates/rtv.1.template')) as fp: with open(os.path.join(ROOT, 'rtv/templates/rtv.1.template')) as fp:
template = fp.read() template = fp.read()
print('Populating template') print('Populating template')
out = template.format(**data) out = template.format(**data)

View File

@@ -20,7 +20,7 @@ setuptools.setup(
license='MIT', license='MIT',
keywords='reddit terminal praw curses', keywords='reddit terminal praw curses',
packages=['rtv'], packages=['rtv'],
include_package_data=True, package_data={'rtv': ['templates/index.html']},
data_files=[("share/man/man1", ["rtv.1"])], data_files=[("share/man/man1", ["rtv.1"])],
install_requires=requirements, install_requires=requirements,
entry_points={'console_scripts': ['rtv=rtv.__main__:main']}, entry_points={'console_scripts': ['rtv=rtv.__main__:main']},