Skip to content

Commit

Permalink
[FIX] Packaging, Scaffolding: template files extension
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aab-odoo committed Mar 2, 2015
1 parent fc481c5 commit 9ebfa11
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,4 +26,3 @@ recursive-include openerp *.xml
recursive-include openerp *.yml
recursive-exclude * *.py[co]
recursive-exclude * *.hg*
graft openerp/cli/templates
8 changes: 5 additions & 3 deletions openerp/cli/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,18 @@ def render_to(self, modname, directory, params=None):
"""
# 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)\
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9ebfa11

Please sign in to comment.