aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-11-21 15:54:09 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-11-21 17:16:22 +0100
commit197ea8be5a2fb5e55083113a3225d6fa12371e24 (patch)
tree91fefdc545018790834c616333f2c82fa1ec573a
parent793f46ddd47b8b78123fcfa68b62d377380bd366 (diff)
downloadjson_diff-197ea8be5a2fb5e55083113a3225d6fa12371e24.tar.gz
Two small nits in __main__ part.0.9.1
-rw-r--r--.gitignore2
-rw-r--r--MANIFEST.in1
-rw-r--r--README.txt7
-rwxr-xr-xjson_diff.py6
-rw-r--r--setup.py29
5 files changed, 42 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index f3d74a9..4f0f98f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
*.pyc
*~
+dist/
+MANIFEST
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..4c67ad3
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+recursive-include test *.html *.json
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..6b60584
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,7 @@
+Compares two JSON files (http://json.org) and generates a new JSON file
+with the result. Allows exclusion of some keys from the comparison, or
+in other way to include only some keys.
+
+The development repository is at https://gitorious.org/json_diff/mainline
+
+Released under MIT/X11 license.
diff --git a/json_diff.py b/json_diff.py
index 978b0de..8cda9fd 100755
--- a/json_diff.py
+++ b/json_diff.py
@@ -317,12 +317,12 @@ if __name__ == "__main__":
if len(args) != 2:
parser.error("Script requires two positional arguments, names for old and new JSON file.")
- diff = Comparator(file(args[0]), file(args[1]), options.include, options.exclude)
+ diff = Comparator(open(args[0]), open(args[1]), options.include, options.exclude)
if options.HTMLoutput:
diff_res = diff.compare_dicts()
# logging.debug("diff_res:\n%s", json.dumps(diff_res, indent=True))
print(HTMLFormatter(diff_res))
else:
- outs = json.dumps(diff.compare_dicts(), indent=4, ensure_ascii=False).encode("utf-8")
+ outs = json.dumps(diff.compare_dicts(), indent=4, ensure_ascii=False)
outs = "\n".join([line for line in outs.split("\n")])
- print(outs)
+ print(outs.encode("utf-8"))
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..7f3e86c
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from distutils.core import setup
+
+setup(
+ name = 'json_diff',
+ version = '0.9.1',
+ description = 'Generates diff between two JSON files',
+ author = 'Matěj Cepl',
+ author_email = 'mcepl@redhat.com',
+ url = 'https://gitorious.org/json_diff/mainline',
+ download_url = "http://mcepl.fedorapeople.org/scripts/json_diff-0.9.1.tar.gz",
+ py_modules = ['json_diff', 'test_json_diff', 'test_strings'],
+ package_data = ['test/*'],
+ long_description = """Compares two JSON files (http://json.org) and
+generates a new JSON file with the result. Allows exclusion of some
+keys from the comparison, or in other way to include only some keys.""",
+ keywords = ['json', 'diff'],
+ classifiers = [
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Development Status :: 4 - Beta",
+ "Environment :: Console",
+ "Intended Audience :: Information Technology",
+ "License :: OSI Approved :: MIT License",
+ "Operating System :: OS Independent",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ "Topic :: Text Processing :: General",
+ ]
+)