[diffoscope] 01/01: Add try.diffoscope.org command-line client to save installation of dependencies
Chris Lamb
chris at chris-lamb.co.uk
Mon Aug 1 23:21:04 CEST 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository diffoscope.
commit ce5888ba2821fbe82a1152febf1d2df73e680039
Author: Chris Lamb <lamby at debian.org>
Date: Mon Aug 1 17:15:41 2016 -0400
Add try.diffoscope.org command-line client to save installation of dependencies
Signed-off-by: Chris Lamb <lamby at debian.org>
---
bin/trydiffoscope | 67 ++++++++++++++++++++++++++++++++++++++++++++
debian/control | 18 ++++++++++++
debian/trydiffoscope.install | 1 +
3 files changed, 86 insertions(+)
diff --git a/bin/trydiffoscope b/bin/trydiffoscope
new file mode 100755
index 0000000..a92fed3
--- /dev/null
+++ b/bin/trydiffoscope
@@ -0,0 +1,67 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2016 Chris Lamb <lamby at debian.org>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import sys
+import argparse
+import requests
+
+class TryDiffoscope(object):
+ def __init__(self, args):
+ self.args = args
+
+ def main(self):
+ response = requests.post(self.args.url, files={
+ 'file_a': open(self.args.file[0]),
+ 'file_b': open(self.args.file[1]),
+ })
+
+ response.raise_for_status()
+
+ print(response.json()['url'])
+
+ return 0
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument(
+ 'file',
+ help="Files to compare",
+ nargs=2,
+ default=[],
+ )
+
+ parser.add_argument(
+ '--url',
+ help="Use this trydiffoscope endpoint (for development)",
+ default='https://try.diffoscope.org/api/v1/compare',
+ )
+
+ args = parser.parse_args()
+
+ for x in args.file:
+ if not os.path.exists(x):
+ parser.error("{}: does not exist".format(x))
+
+ try:
+ sys.exit(TryDiffoscope(args).main())
+ except KeyboardInterrupt:
+ sys.exit(1)
diff --git a/debian/control b/debian/control
index b24fbef..8d981f2 100644
--- a/debian/control
+++ b/debian/control
@@ -50,3 +50,21 @@ Description: in-depth comparison of files, archives, and directories
.
diffoscope is developed as part of the “reproducible builds” Debian
project.
+
+Package: trydiffoscope
+Architecture: all
+Depends:
+ ${misc:Depends},
+ python3-requests,
+ ${python3:Depends},
+Description: in-depth comparison of files, archives, and directories (try.diffoscope.org client)
+ diffoscope will try to get to the bottom of what makes files or directories
+ different. It will recursively unpack archives of many kinds and transform
+ various binary formats into more human readable form to compare them. It can
+ compare two tarballs, ISO images, or PDF just as easily. The differences can
+ be shown in a text or HTML report.
+ .
+ diffoscope is developed as part of the “reproducible builds” Debian
+ project.
+ .
+ This package contains the https://try.diffoscope.org/ command-line client.
diff --git a/debian/trydiffoscope.install b/debian/trydiffoscope.install
new file mode 100644
index 0000000..1bdce11
--- /dev/null
+++ b/debian/trydiffoscope.install
@@ -0,0 +1 @@
+bin/trydiffoscope /usr/bin
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list