Merge "Allow setup.py bdist to complete happily."

This commit is contained in:
Jenkins 2012-05-22 19:04:14 +00:00 committed by Gerrit Code Review
commit 4210177f93
5 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import glob
from optparse import make_option from optparse import make_option
import os import os
@ -34,7 +35,7 @@ class Command(TemplateCommand):
options["template"] = self.template options["template"] = self.template
# We have html templates as well, so make sure those are included. # We have html templates as well, so make sure those are included.
options["extensions"].extend(["html", "js", "css"]) options["extensions"].extend(["tmpl", "html", "js", "css"])
# Check that the app_name cannot be imported. # Check that the app_name cannot be imported.
try: try:
@ -47,3 +48,12 @@ class Command(TemplateCommand):
"name. Please try another name." % dash_name) "name. Please try another name." % dash_name)
super(Command, self).handle('dash', dash_name, **options) super(Command, self).handle('dash', dash_name, **options)
target = options.pop("target", None)
if not target:
target = os.path.join(os.curdir, dash_name)
# Rename our python template files.
file_names = glob.glob(os.path.join(target, "*.py.tmpl"))
for filename in file_names:
os.rename(filename, filename[:-5])

View File

@ -1,3 +1,4 @@
import glob
from optparse import make_option from optparse import make_option
import os import os
@ -74,7 +75,7 @@ class Command(TemplateCommand):
options["template"] = self.template options["template"] = self.template
# We have html templates as well, so make sure those are included. # We have html templates as well, so make sure those are included.
options["extensions"].extend(["html"]) options["extensions"].extend(["tmpl", "html"])
# Check that the app_name cannot be imported. # Check that the app_name cannot be imported.
try: try:
@ -87,3 +88,11 @@ class Command(TemplateCommand):
"name. Please try another name." % panel_name) "name. Please try another name." % panel_name)
super(Command, self).handle('panel', panel_name, target, **options) super(Command, self).handle('panel', panel_name, target, **options)
if not target:
target = os.path.join(os.curdir, panel_name)
# Rename our python template files.
file_names = glob.glob(os.path.join(target, "*.py.tmpl"))
for filename in file_names:
os.rename(filename, filename[:-5])