[Python-modules-commits] [wifi-python] 04/07: Remove unneeded patches

Ethan Ward ethanward-guest at moszumanska.debian.org
Thu Aug 24 00:00:02 UTC 2017


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

ethanward-guest pushed a commit to branch master
in repository wifi-python.

commit d07adaf4314e10599a000988c115996922073200
Author: Ethan Ward <ethan.ward at mycroft.ai>
Date:   Tue Aug 22 21:29:36 2017 -0500

    Remove unneeded patches
---
 .../0001-Remove-broken-tests-and-binary.patch      |  23 --
 ...ry-to-be-python3-and-have-less-generic-na.patch | 433 ---------------------
 debian/patches/series                              |   2 -
 3 files changed, 458 deletions(-)

diff --git a/debian/patches/0001-Remove-broken-tests-and-binary.patch b/debian/patches/0001-Remove-broken-tests-and-binary.patch
deleted file mode 100644
index d1e8ae3..0000000
--- a/debian/patches/0001-Remove-broken-tests-and-binary.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Ethan Ward <ethan.ward at mycroft.ai>
-Date: Fri, 4 Aug 2017 17:02:56 -0500
-Subject: Remove broken tests and binary
-
----
- setup.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/setup.py b/setup.py
-index 9add77d..3c21184 100644
---- a/setup.py
-+++ b/setup.py
-@@ -41,8 +41,8 @@ setup(
-     description=__doc__,
-     long_description='\n\n'.join([read('README.rst'), read('CHANGES.rst')]),
-     packages=['wifi'],
--    scripts=['bin/wifi'],
--    test_suite='tests',
-+    #scripts=['bin/wifi'],
-+    #test_suite='tests',
-     platforms=["Debian"],
-     license='BSD',
-     install_requires=install_requires,
diff --git a/debian/patches/0002-Update-binary-to-be-python3-and-have-less-generic-na.patch b/debian/patches/0002-Update-binary-to-be-python3-and-have-less-generic-na.patch
deleted file mode 100644
index 47a879f..0000000
--- a/debian/patches/0002-Update-binary-to-be-python3-and-have-less-generic-na.patch
+++ /dev/null
@@ -1,433 +0,0 @@
-From: Ethan Ward <ethan.ward at mycroft.ai>
-Date: Fri, 11 Aug 2017 16:01:55 -0500
-Subject: Update binary to be python3 and have less generic name
-
----
- bin/wifi        | 205 --------------------------------------------------------
- bin/wifi-helper | 205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 205 insertions(+), 205 deletions(-)
- delete mode 100755 bin/wifi
- create mode 100755 bin/wifi-helper
-
-diff --git a/bin/wifi b/bin/wifi
-deleted file mode 100755
-index 140d437..0000000
---- a/bin/wifi
-+++ /dev/null
-@@ -1,205 +0,0 @@
--#!/usr/bin/python
--from __future__ import print_function
--import argparse
--import sys
--import os
--
--from wifi import Cell, Scheme
--from wifi.utils import print_table, match as fuzzy_match
--from wifi.exceptions import ConnectionError, InterfaceError
--
--try:  # Python 2.x
--    input = raw_input
--except NameError:
--    pass
--
--
--def fuzzy_find_cell(interface, query):
--    match_partial = lambda cell: fuzzy_match(query, cell.ssid)
--
--    matches = Cell.where(interface, match_partial)
--
--    num_unique_matches = len(set(cell.ssid for cell in matches))
--    assert num_unique_matches > 0, "Couldn't find a network that matches '{}'".format(query)
--    assert num_unique_matches < 2, "Found more than one network that matches '{}'".format(query)
--
--    # Several cells of the same SSID
--    if len(matches) > 1:
--        matches.sort(key=lambda cell: cell.signal)
--
--    return matches[0]
--
--
--def find_cell(interface, query):
--    cell = Cell.where(interface, lambda cell: cell.ssid.lower() == query.lower())
--
--    try:
--        cell = cell[0]
--    except IndexError:
--        cell = fuzzy_find_cell(interface, query)
--    return cell
--
--
--def get_scheme_params(interface, scheme, ssid=None):
--    cell = find_cell(interface, ssid or scheme)
--    passkey = None if not cell.encrypted else input('passkey> ')
--
--    return interface, scheme, cell, passkey
--
--
--def scan_command(args):
--    print_table([[cell.signal, cell.ssid, 'protected' if cell.encrypted else 'unprotected'] for cell in Cell.all(args.interface)])
--
--
--def list_command(args):
--    for scheme in Scheme.for_file(args.file).all():
--        print(scheme.name)
--
--
--def show_command(args):
--    scheme = Scheme.for_file(args.file).for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
--    print(scheme)
--
--
--def add_command(args):
--    scheme_class = Scheme.for_file(args.file)
--    assert not scheme_class.find(args.interface, args.scheme), "That scheme has already been used"
--
--    scheme = scheme_class.for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
--    scheme.save()
--
--
--def connect_command(args):
--    scheme_class = Scheme.for_file(args.file)
--    if args.adhoc:
--        # ensure that we have the adhoc utility scheme
--        try:
--            adhoc_scheme = scheme_class(args.interface, 'adhoc')
--            adhoc_scheme.save()
--        except AssertionError:
--            pass
--        except IOError:
--            assert False, "Can't write on {0!r}, do you have required privileges?".format(args.file)
--
--        scheme = scheme_class.for_cell(*get_scheme_params(args.interface, 'adhoc', args.scheme))
--    else:
--        scheme = scheme_class.find(args.interface, args.scheme)
--        assert scheme, "Couldn't find a scheme named {0!r}, did you mean to use -a?".format(args.scheme)
--
--    try:
--        scheme.activate()
--    except ConnectionError:
--        assert False, "Failed to connect to %s." % scheme.name
--
--
--def autoconnect_command(args):
--    ssids = [cell.ssid for cell in Cell.all(args.interface)]
--
--    for scheme in Scheme.all():
--        # TODO: make it easier to get the SSID off of a scheme.
--        ssid = scheme.options.get('wpa-ssid', scheme.options.get('wireless-essid'))
--        if ssid in ssids:
--            sys.stderr.write('Connecting to "%s".\n' % ssid)
--            try:
--                scheme.activate()
--            except ConnectionError:
--                assert False, "Failed to connect to %s." % scheme.name
--            break
--    else:
--        assert False, "Couldn't find any schemes that are currently available."
--
--
--def arg_parser():
--    parser = argparse.ArgumentParser()
--    parser.add_argument('-i',
--                        '--interface',
--                        default='wlan0',
--                        help="Specifies which interface to use (wlan0, eth0, etc.)")
--    parser.add_argument('-f',
--                        '--file',
--                        default='/etc/network/interfaces',
--                        help="Specifies which file for scheme storage.")
--    
--    subparsers = parser.add_subparsers(title='commands')
--    
--    parser_scan = subparsers.add_parser('scan', help="Shows a list of available networks.")
--    parser_scan.set_defaults(func=scan_command)
--    
--    parser_list = subparsers.add_parser('list', help="Shows a list of networks already configured.")
--    parser_list.set_defaults(func=list_command)
--    
--    scheme_help = ("A memorable nickname for a wireless network."
--                   "  If SSID is not provided, the network will be guessed using SCHEME.")
--    ssid_help = ("The SSID for the network to which you wish to connect."
--                 "  This is fuzzy matched, so you don't have to be precise.")
--    
--    parser_show = subparsers.add_parser('config',
--                                        help="Prints the configuration to connect to a new network.")
--    parser_show.add_argument('scheme', help=scheme_help, metavar='SCHEME')
--    parser_show.add_argument('ssid', nargs='?', help=ssid_help, metavar='SSID')
--    parser_show.set_defaults(func=show_command)
--    
--    parser_add = subparsers.add_parser('add',
--                                       help="Adds the configuration to connect to a new network.")
--    parser_add.add_argument('scheme', help=scheme_help, metavar='SCHEME')
--    parser_add.add_argument('ssid', nargs='?', help=ssid_help, metavar='SSID')
--    parser_add.set_defaults(func=add_command)
--    
--    parser_connect = subparsers.add_parser('connect',
--                                           help="Connects to the network corresponding to SCHEME")
--    parser_connect.add_argument('scheme',
--                                help="The nickname of the network to which you wish to connect.",
--                                metavar='SCHEME')
--    parser_connect.add_argument('-a',
--                                '--ad-hoc',
--                                dest='adhoc',
--                                action="store_true",
--                                help="Connect to a network without storing it in the config file")
--    parser_connect.set_defaults(func=connect_command)
--    
--    
--    # TODO: how to specify the correct interfaces file to work off of.
--    parser_connect.get_options = lambda: [scheme.name for scheme in Scheme.all()]
--
--    parser_autoconnect = subparsers.add_parser(
--        'autoconnect',
--        help="Searches for saved schemes that are currently"
--             " available and connects to the first one it finds."
--    )
--    parser_autoconnect.set_defaults(func=autoconnect_command)
--
--    return parser, subparsers
--
--
--def autocomplete(position, wordlist, subparsers):
--    if position == 1:
--        ret = subparsers.choices.keys()
--    else:
--        try:
--            prev = wordlist[position - 1]
--            ret = subparsers.choices[prev].get_options()
--        except (IndexError, KeyError, AttributeError):
--            ret = []
--
--    print(' '.join(ret))
--
--
--if __name__ == "__main__":
--    parser, subparsers = arg_parser()
--
--    if len(sys.argv) == 1:
--        argv = ['scan']
--    else:
--        argv = sys.argv[1:]
--
--    args = parser.parse_args(argv)
--
--    try:
--        if 'WIFI_AUTOCOMPLETE' in os.environ:
--            autocomplete(int(os.environ['COMP_CWORD']),
--                         os.environ['COMP_WORDS'].split(), subparsers)
--        else:
--            args.func(args)
--    except (AssertionError, InterfaceError) as e:
--        sys.stderr.write("Error: ")
--        sys.exit(e)
-diff --git a/bin/wifi-helper b/bin/wifi-helper
-new file mode 100755
-index 0000000..c540f13
---- /dev/null
-+++ b/bin/wifi-helper
-@@ -0,0 +1,205 @@
-+#!/usr/bin/python3
-+from __future__ import print_function
-+import argparse
-+import sys
-+import os
-+
-+from wifi import Cell, Scheme
-+from wifi.utils import print_table, match as fuzzy_match
-+from wifi.exceptions import ConnectionError, InterfaceError
-+
-+try:  # Python 2.x
-+    input = raw_input
-+except NameError:
-+    pass
-+
-+
-+def fuzzy_find_cell(interface, query):
-+    match_partial = lambda cell: fuzzy_match(query, cell.ssid)
-+
-+    matches = Cell.where(interface, match_partial)
-+
-+    num_unique_matches = len(set(cell.ssid for cell in matches))
-+    assert num_unique_matches > 0, "Couldn't find a network that matches '{}'".format(query)
-+    assert num_unique_matches < 2, "Found more than one network that matches '{}'".format(query)
-+
-+    # Several cells of the same SSID
-+    if len(matches) > 1:
-+        matches.sort(key=lambda cell: cell.signal)
-+
-+    return matches[0]
-+
-+
-+def find_cell(interface, query):
-+    cell = Cell.where(interface, lambda cell: cell.ssid.lower() == query.lower())
-+
-+    try:
-+        cell = cell[0]
-+    except IndexError:
-+        cell = fuzzy_find_cell(interface, query)
-+    return cell
-+
-+
-+def get_scheme_params(interface, scheme, ssid=None):
-+    cell = find_cell(interface, ssid or scheme)
-+    passkey = None if not cell.encrypted else input('passkey> ')
-+
-+    return interface, scheme, cell, passkey
-+
-+
-+def scan_command(args):
-+    print_table([[cell.signal, cell.ssid, 'protected' if cell.encrypted else 'unprotected'] for cell in Cell.all(args.interface)])
-+
-+
-+def list_command(args):
-+    for scheme in Scheme.for_file(args.file).all():
-+        print(scheme.name)
-+
-+
-+def show_command(args):
-+    scheme = Scheme.for_file(args.file).for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
-+    print(scheme)
-+
-+
-+def add_command(args):
-+    scheme_class = Scheme.for_file(args.file)
-+    assert not scheme_class.find(args.interface, args.scheme), "That scheme has already been used"
-+
-+    scheme = scheme_class.for_cell(*get_scheme_params(args.interface, args.scheme, args.ssid))
-+    scheme.save()
-+
-+
-+def connect_command(args):
-+    scheme_class = Scheme.for_file(args.file)
-+    if args.adhoc:
-+        # ensure that we have the adhoc utility scheme
-+        try:
-+            adhoc_scheme = scheme_class(args.interface, 'adhoc')
-+            adhoc_scheme.save()
-+        except AssertionError:
-+            pass
-+        except IOError:
-+            assert False, "Can't write on {0!r}, do you have required privileges?".format(args.file)
-+
-+        scheme = scheme_class.for_cell(*get_scheme_params(args.interface, 'adhoc', args.scheme))
-+    else:
-+        scheme = scheme_class.find(args.interface, args.scheme)
-+        assert scheme, "Couldn't find a scheme named {0!r}, did you mean to use -a?".format(args.scheme)
-+
-+    try:
-+        scheme.activate()
-+    except ConnectionError:
-+        assert False, "Failed to connect to %s." % scheme.name
-+
-+
-+def autoconnect_command(args):
-+    ssids = [cell.ssid for cell in Cell.all(args.interface)]
-+
-+    for scheme in Scheme.all():
-+        # TODO: make it easier to get the SSID off of a scheme.
-+        ssid = scheme.options.get('wpa-ssid', scheme.options.get('wireless-essid'))
-+        if ssid in ssids:
-+            sys.stderr.write('Connecting to "%s".\n' % ssid)
-+            try:
-+                scheme.activate()
-+            except ConnectionError:
-+                assert False, "Failed to connect to %s." % scheme.name
-+            break
-+    else:
-+        assert False, "Couldn't find any schemes that are currently available."
-+
-+
-+def arg_parser():
-+    parser = argparse.ArgumentParser()
-+    parser.add_argument('-i',
-+                        '--interface',
-+                        default='wlan0',
-+                        help="Specifies which interface to use (wlan0, eth0, etc.)")
-+    parser.add_argument('-f',
-+                        '--file',
-+                        default='/etc/network/interfaces',
-+                        help="Specifies which file for scheme storage.")
-+    
-+    subparsers = parser.add_subparsers(title='commands')
-+    
-+    parser_scan = subparsers.add_parser('scan', help="Shows a list of available networks.")
-+    parser_scan.set_defaults(func=scan_command)
-+    
-+    parser_list = subparsers.add_parser('list', help="Shows a list of networks already configured.")
-+    parser_list.set_defaults(func=list_command)
-+    
-+    scheme_help = ("A memorable nickname for a wireless network."
-+                   "  If SSID is not provided, the network will be guessed using SCHEME.")
-+    ssid_help = ("The SSID for the network to which you wish to connect."
-+                 "  This is fuzzy matched, so you don't have to be precise.")
-+    
-+    parser_show = subparsers.add_parser('config',
-+                                        help="Prints the configuration to connect to a new network.")
-+    parser_show.add_argument('scheme', help=scheme_help, metavar='SCHEME')
-+    parser_show.add_argument('ssid', nargs='?', help=ssid_help, metavar='SSID')
-+    parser_show.set_defaults(func=show_command)
-+    
-+    parser_add = subparsers.add_parser('add',
-+                                       help="Adds the configuration to connect to a new network.")
-+    parser_add.add_argument('scheme', help=scheme_help, metavar='SCHEME')
-+    parser_add.add_argument('ssid', nargs='?', help=ssid_help, metavar='SSID')
-+    parser_add.set_defaults(func=add_command)
-+    
-+    parser_connect = subparsers.add_parser('connect',
-+                                           help="Connects to the network corresponding to SCHEME")
-+    parser_connect.add_argument('scheme',
-+                                help="The nickname of the network to which you wish to connect.",
-+                                metavar='SCHEME')
-+    parser_connect.add_argument('-a',
-+                                '--ad-hoc',
-+                                dest='adhoc',
-+                                action="store_true",
-+                                help="Connect to a network without storing it in the config file")
-+    parser_connect.set_defaults(func=connect_command)
-+    
-+    
-+    # TODO: how to specify the correct interfaces file to work off of.
-+    parser_connect.get_options = lambda: [scheme.name for scheme in Scheme.all()]
-+
-+    parser_autoconnect = subparsers.add_parser(
-+        'autoconnect',
-+        help="Searches for saved schemes that are currently"
-+             " available and connects to the first one it finds."
-+    )
-+    parser_autoconnect.set_defaults(func=autoconnect_command)
-+
-+    return parser, subparsers
-+
-+
-+def autocomplete(position, wordlist, subparsers):
-+    if position == 1:
-+        ret = subparsers.choices.keys()
-+    else:
-+        try:
-+            prev = wordlist[position - 1]
-+            ret = subparsers.choices[prev].get_options()
-+        except (IndexError, KeyError, AttributeError):
-+            ret = []
-+
-+    print(' '.join(ret))
-+
-+
-+if __name__ == "__main__":
-+    parser, subparsers = arg_parser()
-+
-+    if len(sys.argv) == 1:
-+        argv = ['scan']
-+    else:
-+        argv = sys.argv[1:]
-+
-+    args = parser.parse_args(argv)
-+
-+    try:
-+        if 'WIFI_AUTOCOMPLETE' in os.environ:
-+            autocomplete(int(os.environ['COMP_CWORD']),
-+                         os.environ['COMP_WORDS'].split(), subparsers)
-+        else:
-+            args.func(args)
-+    except (AssertionError, InterfaceError) as e:
-+        sys.stderr.write("Error: ")
-+        sys.exit(e)
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index d7e9502..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,2 +0,0 @@
-0001-Remove-broken-tests-and-binary.patch
-0002-Update-binary-to-be-python3-and-have-less-generic-na.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/wifi-python.git



More information about the Python-modules-commits mailing list