Skip to content

Commit

Permalink
command line depender needs to encode UTF-8 content first.
Browse files Browse the repository at this point in the history
  • Loading branch information
andyao1 authored and anutron committed Jun 5, 2011
1 parent 147de1f commit 9ba3f53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -182,6 +182,9 @@ The Command Line Option
-----------------------
The depender can also generate concatenated JavaScript files on the command line:

$ git submodule update --init
$ virtualenv env
$ env/bin/python django/setup.py develop
$ env/bin/python django/src/depender/cli.py django/mootools/settings.py -R Core > mootools-core.js
$ env/bin/python django/src/depender/cli.py django/mootools/settings.py -R More -E Core > mootools-more.js

Expand Down
14 changes: 9 additions & 5 deletions django/src/depender/cli.py
Expand Up @@ -68,21 +68,25 @@ def get_arr(val):

deps = dpdr.get_transitive_dependencies(required, excluded)
files = dpdr.get_files(deps, excluded)
output = "//No files included for build"
outputs = []

if len(files) > 0:
#TODO: add copyrights
output = u""
output = ""
output += "\n//This library: %s" % (" ".join(sys.argv),)
output += "\n//Contents: "
output += ", ".join([ i.package.key + ":" + i.shortname for i in files ])
output += "\n\n"
outputs.append(output)

for f in files:
output += "// Begin: " + f.shortname + "\n"
output += f.content + u"\n\n"
outputs.append("// Begin: " + f.shortname + "\n")
outputs.append(f.content.encode('utf-8'))
outputs.append("\n\n")
else:
outputs.append("//No files included for build")

print output
print "".join(outputs)

def main():
usage = "usage: %prog settings.py [options]"
Expand Down

0 comments on commit 9ba3f53

Please sign in to comment.