[diffoscope] 01/01: Split out trydiffoscope client from main diffoscope repository so that it can be easily released on PyPI.

Chris Lamb chris at chris-lamb.co.uk
Fri Dec 9 11:43:19 CET 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 97bddd18a79b09f6511604fb4e6d78f1ba0d0ec7
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Dec 9 11:42:03 2016 +0100

    Split out trydiffoscope client from main diffoscope repository so that it can be easily released on PyPI.
---
 bin/trydiffoscope             | 144 ------------------------------------------
 debian/control                |  18 ------
 debian/rules                  |   1 -
 debian/trydiffoscope.1.rst    |  59 -----------------
 debian/trydiffoscope.install  |   1 -
 debian/trydiffoscope.manpages |   1 -
 program.prof                  | Bin 0 -> 170691 bytes
 7 files changed, 224 deletions(-)

diff --git a/bin/trydiffoscope b/bin/trydiffoscope
deleted file mode 100755
index f3d6f55..0000000
--- a/bin/trydiffoscope
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/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 io
-import os
-import sys
-import time
-import argparse
-import requests
-import webbrowser
-
-class TryDiffoscope(object):
-    def __init__(self, args):
-        self.args = args
-        self.session = requests.Session()
-
-    def main(self):
-        response = self.session.post(self.args.endpoint, files={
-            'file_a': open(self.args.file[0], 'rb'),
-            'file_b': open(self.args.file[1], 'rb'),
-        })
-
-        response.raise_for_status()
-        poll_uri = response.json()['result']['uri']
-
-        while True:
-            response = self.session.get(poll_uri)
-            response.raise_for_status()
-            comparison = response.json()['result']
-
-            # Bail out early if --url or --webbrowser specified
-            if self.args.url or self.args.webbrowser:
-                print(comparison['uri'])
-
-                if self.args.webbrowser:
-                    webbrowser.open(comparison['uri'])
-
-                return 0
-
-            if comparison['state'] not in ('queued', 'running'):
-                break
-
-            time.sleep(1)
-
-        if comparison['state'] not in ('identical', 'different'):
-            print("E: Received state '{}' from server. See {}".format(
-                comparison['state'],
-                comparison['uri'],
-            ), file=sys.stderr)
-            return 2
-
-        if comparison['state'] == 'identical':
-            return 0
-
-        # Report/save output
-        to_save = {x for x in ('html', 'text') if getattr(self.args, x)}
-
-        for x in to_save:
-            response = self.session.get(comparison['formats'][x])
-            response.raise_for_status()
-
-            with open(getattr(self.args, x), 'w') as f:
-                print(response.text, file=f)
-
-        if not to_save:
-            response = self.session.get(comparison['formats']['text'])
-            response.raise_for_status()
-            print(response.content.decode('utf-8'))
-
-        return 1
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser()
-
-    parser.add_argument(
-        'file',
-        help="files to compare",
-        nargs=2,
-        default=[],
-    )
-
-    parser.add_argument(
-        '--endpoint',
-        help="specify trydiffoscope API endpoint",
-        default='https://try.diffoscope.org/api/v3/comparison',
-    )
-
-    parser.add_argument(
-        '--text',
-        help="write plain text output to given file",
-        default=None,
-    )
-
-    parser.add_argument(
-        '--html',
-        help="write HTML report to given file",
-        default=None,
-    )
-
-    parser.add_argument(
-        '-u',
-        '--url',
-        help="print URL instead of managing results locally",
-        action='store_true',
-    )
-
-    parser.add_argument(
-        '-w',
-        '--webbrowser',
-        help="open webbrowser to URL instead of managing results "
-            "locally (implies -u)",
-        action='store_true',
-    )
-
-    args = parser.parse_args()
-
-    for x in args.file:
-        if not os.path.exists(x):
-            parser.error("{}: does not exist".format(x))
-
-    if sys.stdout.encoding != 'UTF-8':
-        sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='UTF-8')
-
-    try:
-        sys.exit(TryDiffoscope(args).main())
-    except KeyboardInterrupt:
-        sys.exit(1)
diff --git a/debian/control b/debian/control
index 6c9bac4..0158934 100644
--- a/debian/control
+++ b/debian/control
@@ -78,21 +78,3 @@ 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:
- python3-requests,
- ${misc:Depends},
- ${python3:Depends},
-Description: in-depth comparison of files, archives, etc. (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/rules b/debian/rules
index 90e5761..47ce3b7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,7 +29,6 @@ export PYBUILD_AFTER_INSTALL=rm -rvf '{destdir}/{install_dir}/htmlcov' '{destdir
 	dh $@ --with python3 --with bash-completion --buildsystem=pybuild
 
 override_dh_python3:
-	dh_python3 -p trydiffoscope
 	dh_python3 -p diffoscope \
 		--recommends=python-debian \
 		--recommends=rpm-python \
diff --git a/debian/trydiffoscope.1.rst b/debian/trydiffoscope.1.rst
deleted file mode 100644
index 2072203..0000000
--- a/debian/trydiffoscope.1.rst
+++ /dev/null
@@ -1,59 +0,0 @@
-==============
- trydiffoscope
-==============
-
------------------------------------------------------------------------------------
-in-depth comparison of files, archives, and directories (try.diffoscope.org client)
------------------------------------------------------------------------------------
-
-:Author: Chris Lamb <lamby at debian.org>
-:Copyright: GPL-3+
-:Manual section: 1
-:Manual group: Debian
-
-SYNOPSIS
-========
-
-  trydiffoscope [-h] [--endpoint ENDPOINT] [--text TEXT] [--html HTML] [--url] [--webbrowser] file file
-
-DESCRIPTION
-===========
-
-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.
-
-It can be scripted through error codes, and a report can be produced
-with the detected differences. The report can be text or HTML.
-When no type of report has been selected, diffoscope defaults
-to write a text report on the standard output.
-
-diffoscope is developed as part of the “reproducible builds” Debian
-project and was formerly known as “debbindiff”.
-
-trydiffoscope is a command-line API to the trydiffoscope web service.
-
-OPTIONS
-=======
-
--h, --help           show this help message and exit
---endpoint ENDPOINT  specify trydiffoscope API endpoint
---text TEXT          write plain text output to given file
---html HTML          write HTML report to given file
--u, --url            print URL instead of managing results locally
--w, --webbrowser     open webbrowser to URL instead of managing results
-                     locally (implies -u)
-
-EXIT STATUS
-===========
-
-Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
-
-SEE ALSO
-========
-
-* `<https://diffoscope.org/>`
-* `<https://try.diffoscope.org/>`
-* `<https://wiki.debian.org/ReproducibleBuilds>`
diff --git a/debian/trydiffoscope.install b/debian/trydiffoscope.install
deleted file mode 100644
index 1bdce11..0000000
--- a/debian/trydiffoscope.install
+++ /dev/null
@@ -1 +0,0 @@
-bin/trydiffoscope /usr/bin
diff --git a/debian/trydiffoscope.manpages b/debian/trydiffoscope.manpages
deleted file mode 100644
index daebc14..0000000
--- a/debian/trydiffoscope.manpages
+++ /dev/null
@@ -1 +0,0 @@
-debian/trydiffoscope.1
diff --git a/program.prof b/program.prof
new file mode 100644
index 0000000..f7490e9
Binary files /dev/null and b/program.prof differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list