~ubuntu-branches/ubuntu/saucy/click/saucy-proposed

« back to all changes in this revision

Viewing changes to click/commands/list.py

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2013-07-30 15:14:16 UTC
  • Revision ID: package-import@ubuntu.com-20130730151416-ajoe6kqrb59kkamo
Tags: 0.2.10
* Force click's stdout encoding to UTF-8 regardless of the locale.
* Don't encode non-ASCII characters in JSON dumps.
* Treat manifests as UTF-8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from __future__ import print_function
19
19
 
 
20
import io
20
21
import json
21
22
from optparse import OptionParser
22
23
import os
66
67
            try:
67
68
                manifest_path = os.path.join(
68
69
                    path, ".click", "info", "%s.manifest" % package)
69
 
                with open(manifest_path) as manifest:
 
70
                with io.open(manifest_path, encoding="UTF-8") as manifest:
70
71
                    json_output.append(json.load(manifest))
71
72
            except Exception:
72
73
                pass
74
75
            print("%s\t%s" % (package, version))
75
76
    if options.manifest:
76
77
        print(json.dumps(
77
 
            json_output, sort_keys=True, indent=4, separators=(",", ": ")))
 
78
            json_output, ensure_ascii=False, sort_keys=True, indent=4,
 
79
            separators=(",", ": ")))