FIX packaging to include static files

This commit is contained in:
boyska 2019-11-15 19:20:56 +01:00
parent 5b0129e569
commit 0c254dabe2
4 changed files with 31 additions and 16 deletions

2
MANIFEST.in Normal file
View file

@ -0,0 +1,2 @@
include server/static/**/*
include server/pages/*.html

View file

@ -25,3 +25,15 @@ FFMPEG_PATH = 'ffmpeg'
TAG_EXTRA = {}
# LICENSE URI is special because date need to be added
TAG_LICENSE_URI = None
STATIC_FILES='static/'
STATIC_PAGES='pages/'
try:
from pkg_resources import resource_filename, resource_isdir
if resource_isdir('techrec', 'pages'):
STATIC_PAGES = resource_filename('techrec', 'pages')
STATIC_FILES = resource_filename('techrec', 'static')
else:
print "invece dice", resource_filename('techrec', 'static')
except ImportError:
logging.exception("Error loading resources from installed part")

View file

@ -283,19 +283,20 @@ class RecServer:
static_file(filepath,
root=get_config()['AUDIO_OUTPUT'],
download=True))
self._app.route('/static/<filepath:path>',
callback=lambda filepath: static_file(filepath,
root='static/'))
root=get_config()['STATIC_FILES']))
self._app.route('/', callback=lambda: redirect('/new.html'))
self._app.route('/new.html',
callback=partial(static_file, 'new.html',
root='pages/'))
root=get_config()['STATIC_PAGES']))
self._app.route('/old.html',
callback=partial(static_file, 'old.html',
root='pages/'))
root=get_config()['STATIC_PAGES']))
self._app.route('/archive.html',
callback=partial(static_file, 'archive.html',
root='pages/'))
root=get_config()['STATIC_PAGES']))
class DebugAPI(Bottle):

View file

@ -2,14 +2,9 @@
from setuptools import setup
requires = [
line.strip()
for line in open("server/requirements.txt").read().split("\n")
if line.strip()
]
setup(
name="techrec",
version="1.1",
version="1.1.1",
description="A Python2 web application "
"that assist radio speakers in recording their shows",
long_description=open("README.md").read(),
@ -18,10 +13,15 @@ setup(
author_email="piuttosto@logorroici.org",
packages=["techrec"],
package_dir={"techrec": "server"},
install_requires=requires,
entry_points={
"console_scripts": [
"techrec = techrec.cli:main",
]
},
install_requires=[
"Paste==1.7.5.1",
"SQLAlchemy==0.8.3",
"bottle==0.11.6",
"wsgiref==0.1.2",
],
classifiers=["Programming Language :: Python :: 2.7"],
entry_points={"console_scripts": ["techrec = techrec.cli:main"]},
zip_safe=False,
install_package_data=True,
package_data={"techrec": ["static/**/*", "pages/*.html"]},
)