[FIX] Packaging, Scaffolding: template files extension

Add .template as extension of the template files because RPM packaging
produces an error when trying to compile the python template files,
which contains Jinja instructions.

Include *.template files in MANIFEST.in to package them.
This commit is contained in:
Aaron Bohy 2015-03-02 12:04:32 +01:00
parent fc481c5e3a
commit 9ebfa11b8c
15 changed files with 6 additions and 4 deletions

View File

@ -17,6 +17,7 @@ recursive-include openerp *.rng
recursive-include openerp *.rst
recursive-include openerp *.sass
recursive-include openerp *.sql
recursive-include openerp *.template
recursive-include openerp *.txt
recursive-include openerp *.ttf
recursive-include openerp *.woff
@ -25,4 +26,3 @@ recursive-include openerp *.xml
recursive-include openerp *.yml
recursive-exclude * *.py[co]
recursive-exclude * *.hg*
graft openerp/cli/templates

View File

@ -112,16 +112,18 @@ class template(object):
"""
# overwrite with local
for path, content in self.files():
_, ext = os.path.splitext(path)
local = os.path.relpath(path, self.path)
# strip .template extension
root, ext = os.path.splitext(local)
if ext == '.template':
local = root
dest = os.path.join(directory, modname, local)
destdir = os.path.dirname(dest)
if not os.path.exists(destdir):
os.makedirs(destdir)
with open(dest, 'wb') as f:
if ext not in ('.py', '.xml', '.csv', '.js', '.rst', '.html'):
if ext not in ('.py', '.xml', '.csv', '.js', '.rst', '.html', '.template'):
f.write(content)
else:
env.from_string(content)\