[Python-modules-commits] [wifi-python] 02/02: Import Debian changes 0.3.8-1

Ethan Ward ethanward-guest at moszumanska.debian.org
Sat Aug 12 00:13:52 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 6098ebe3014e998095480fe41024a99374ff3b84
Author: Ethan Ward <ethan.ward at mycroft.ai>
Date:   Mon Jul 17 14:53:40 2017 -0500

    Import Debian changes 0.3.8-1
    
    wifi-python (0.3.8-1) UNRELEASED; urgency=medium
    
      * Initial Debian packaging (closes: #869109)
---
 debian/.git-dpm                                    |  11 +
 debian/changelog                                   |   5 +
 debian/compat                                      |   1 +
 debian/control                                     |  50 +++
 debian/copyright                                   |  53 +++
 debian/docs                                        |   1 +
 debian/patches/0001-Remove-broken-tests.patch      |  21 +
 .../patches/0002-Remove-binary-from-setup.py.patch |  21 +
 debian/patches/0003-Change-binary-to-python3.patch |  18 +
 debian/patches/0004-Change-name-of-binary.patch    | 433 +++++++++++++++++++++
 debian/patches/series                              |   4 +
 debian/rules                                       |   7 +
 debian/source/format                               |   1 +
 debian/source/options                              |   0
 debian/watch                                       |   3 +
 debian/wifi-helper.1                               |  77 ++++
 debian/wifi-python-wrapper.install                 |   1 +
 debian/wifi-python-wrapper.manpages                |   1 +
 18 files changed, 708 insertions(+)

diff --git a/debian/.git-dpm b/debian/.git-dpm
new file mode 100644
index 0000000..c254927
--- /dev/null
+++ b/debian/.git-dpm
@@ -0,0 +1,11 @@
+# see git-dpm(1) from git-dpm package
+5d9576ae0d751f55c76770921c9b08377c511c83
+5d9576ae0d751f55c76770921c9b08377c511c83
+5d9576ae0d751f55c76770921c9b08377c511c83
+5d9576ae0d751f55c76770921c9b08377c511c83
+wifi_0.3.8.orig.tar.gz
+d894a40f66f06c64a4d87119474c7515bb3a78ae
+11964
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..0152174
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+wifi-python (0.3.8-1) UNRELEASED; urgency=medium
+
+  * Initial Debian packaging (closes: #869109)
+
+ -- Ethan Ward <ethan.ward at mycroft.ai>  Mon, 17 Jul 2017 14:53:40 -0500
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+10
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..1006a83
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,50 @@
+Source: wifi-python
+Section: python
+Priority: optional
+Maintainer: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org>
+Uploaders: Ethan Ward <ethan.ward at mycroft.ai>
+Build-Depends: debhelper (>= 10),
+               dh-python,
+               python-all,
+               python-pbkdf2,
+               python-pytest-runner,
+               python-setuptools,
+               python-vcversioner,
+               python3-all,
+               python3-pbkdf2,
+               python3-pytest-runner,
+               python3-setuptools,
+               python3-vcversioner
+Standards-Version: 4.0.0
+Homepage: https://pypi.python.org/pypi/wifi
+Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/inflection.git
+Vcs-Browser: https://anonscm.debian.org/git/python-modules/packages/inflection.git
+
+Package: python-wifi
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends}
+XB-Python-Version: ${python:Versions}
+Description: Library wrappers around iwlist and /etc/network/interfaces. (Python 2)
+ Wifi provides a wrapper for iwlist and /etc/network/interfaces
+ that makes it easier to connect to WiFi networks.
+ .
+ This package contains the module for Python 2.
+
+Package: python3-wifi
+Architecture: all
+Depends: ${misc:Depends}, ${python3:Depends}
+Description: Library wrappers around iwlist and /etc/network/interfaces. (Python 3)
+ Wifi provides a wrapper for iwlist and /etc/network/interfaces
+ that makes it easier to connect to WiFi networks.
+ .
+ This package contains the module for Python 3.
+
+Package: wifi-python-wrapper
+Section: utils
+Architecture: all
+Depends: python3-wifi, ${misc:Depends}, ${python3:Depends}
+Description: Command line wrapper for iwlist and /etc/network/interfaces
+ A wrapper that makes it easier to connect to wifi networks
+ from the command line.
+ .
+ This package contains the application for Python 3.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..8b06193
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,53 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: wifi
+Source: https://pypi.python.org/pypi/wifi
+
+Files: *
+Copyright: (c) 2016, Rocky Meza, Gavin Wahl
+License: BSD-2-Clause
+
+Files: debian/*
+Copyright: (c) 2017, Ethan Ward <ethan.ward at mycroft.ai>
+License: MIT-style
+
+License: MIT-style
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+License: BSD-2-Clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ .
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ .
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..a1320b1
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README.rst
diff --git a/debian/patches/0001-Remove-broken-tests.patch b/debian/patches/0001-Remove-broken-tests.patch
new file mode 100644
index 0000000..c992222
--- /dev/null
+++ b/debian/patches/0001-Remove-broken-tests.patch
@@ -0,0 +1,21 @@
+From: Ethan Ward <ethan.ward at mycroft.ai>
+Date: Fri, 4 Aug 2017 17:02:56 -0500
+Subject: Remove broken tests
+
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 9add77d..ccb9a16 100644
+--- a/setup.py
++++ b/setup.py
+@@ -42,7 +42,7 @@ setup(
+     long_description='\n\n'.join([read('README.rst'), read('CHANGES.rst')]),
+     packages=['wifi'],
+     scripts=['bin/wifi'],
+-    test_suite='tests',
++    #test_suite='tests',
+     platforms=["Debian"],
+     license='BSD',
+     install_requires=install_requires,
diff --git a/debian/patches/0002-Remove-binary-from-setup.py.patch b/debian/patches/0002-Remove-binary-from-setup.py.patch
new file mode 100644
index 0000000..168f9a7
--- /dev/null
+++ b/debian/patches/0002-Remove-binary-from-setup.py.patch
@@ -0,0 +1,21 @@
+From: Ethan Ward <ethan.ward at mycroft.ai>
+Date: Fri, 11 Aug 2017 16:01:32 -0500
+Subject: Remove binary from setup.py
+
+---
+ setup.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index ccb9a16..3c21184 100644
+--- a/setup.py
++++ b/setup.py
+@@ -41,7 +41,7 @@ setup(
+     description=__doc__,
+     long_description='\n\n'.join([read('README.rst'), read('CHANGES.rst')]),
+     packages=['wifi'],
+-    scripts=['bin/wifi'],
++    #scripts=['bin/wifi'],
+     #test_suite='tests',
+     platforms=["Debian"],
+     license='BSD',
diff --git a/debian/patches/0003-Change-binary-to-python3.patch b/debian/patches/0003-Change-binary-to-python3.patch
new file mode 100644
index 0000000..d3f015c
--- /dev/null
+++ b/debian/patches/0003-Change-binary-to-python3.patch
@@ -0,0 +1,18 @@
+From: Ethan Ward <ethan.ward at mycroft.ai>
+Date: Fri, 11 Aug 2017 16:01:55 -0500
+Subject: Change binary to python3
+
+---
+ bin/wifi | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/bin/wifi b/bin/wifi
+index 140d437..c540f13 100755
+--- a/bin/wifi
++++ b/bin/wifi
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ from __future__ import print_function
+ import argparse
+ import sys
diff --git a/debian/patches/0004-Change-name-of-binary.patch b/debian/patches/0004-Change-name-of-binary.patch
new file mode 100644
index 0000000..376820b
--- /dev/null
+++ b/debian/patches/0004-Change-name-of-binary.patch
@@ -0,0 +1,433 @@
+From: Ethan Ward <ethan.ward at mycroft.ai>
+Date: Fri, 11 Aug 2017 17:25:08 -0500
+Subject: Change name of binary
+
+---
+ 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 c540f13..0000000
+--- a/bin/wifi
++++ /dev/null
+@@ -1,205 +0,0 @@
+-#!/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/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
new file mode 100644
index 0000000..0acb835
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,4 @@
+0001-Remove-broken-tests.patch
+0002-Remove-binary-from-setup.py.patch
+0003-Change-binary-to-python3.patch
+0004-Change-name-of-binary.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..3aef1ca
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+export PYBUILD_NAME=wifi
+
+%:
+	dh $@ --with python2,python3 --buildsystem=pybuild
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 0000000..e69de29
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..234d810
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,3 @@
+version=3
+opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
+https://pypi.debian.net/wifi/wifi-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
diff --git a/debian/wifi-helper.1 b/debian/wifi-helper.1
new file mode 100644
index 0000000..6564730
--- /dev/null
+++ b/debian/wifi-helper.1
@@ -0,0 +1,77 @@
+.TH man 1 "11 August 2017" "0.3.8" "wifi manpage"
+.SH NAME
+wifi \- a command line wrapper for iwlist and /etc/network/interfaces
+.SH SYNOPSIS
+wifi [-h | --help] [-i INTERFACE | --interface INTERFACE] [-f FILE | --file FILE]
+            command [command positional arguments]
+.SH DESCRIPTION
+Wifi provides a command line wrapper for iwlist and /etc/network/interfaces
+that makes it easier to connect the WiFi networks from the command line.
+.SH OPTIONS
+.TP
+.B [-h | --help]
+Prints a help message and exits.
+.TP
+.B [-i INTERFACE | --interface INTERFACE]
+Specifies which interface to use (wlan0, eth0, etc.)
+.TP
+.B [-f FILE | --file FILE]
+Specifies which file for scheme storage
+.SH COMMANDS
+.TP
+.B scan [-h]
+Shows a list of available networks
+
+optional arguments:
+  -h, --help    show a help message and exit
+.TP
+.B list [-h]
+Shows a list of networks already configured
+
+optional arguments:
+  -h, --help    show a help message and exit
+.TP
+.B config [-h] SCHEME [SSID]
+Prints the configuration to connect to a new network.
+
+positional arguments:
+  SCHEME      A memorable nickname for a wireless network. If SSID is not
+              provided, the network will be guessed using SCHEME.
+  SSID        The SSID for the network to which you wish to connect. This is
+              fuzzy matched, so you don't have to be precise.
+
+optional arguments:
+  -h, --help    show a help message and exit
+.TP
+.B add [-h] SCHEME [SSID]
+Prints the configuration to connect to a new network.
+
+positional arguments:
+  SCHEME      A memorable nickname for a wireless network. If SSID is not
+              provided, the network will be guessed using SCHEME.
+  SSID        The SSID for the network to which you wish to connect. This is
+              fuzzy matched, so you don't have to be precise.
+
+optional arguments:
+  -h, --help    show a help message and exit
+.TP
+.B connect [-h] [-a] SCHEME
+Connects to the network corresponding to SCHEME.
+
+positional arguments:
+  SCHEME        The nickname of the network to which you wish to connect.
+
+optional arguments:
+  -h, --help    show a help message and exit
+  -a, --ad-hoc  Connect to a network without storing it in the config file
+.TP
+.B autoconnect [-h]
+Searches for saved schemes that are currently available and connects to the first one it finds.
+
+optional arguments:
+  -h, --help  show this help message and exit
+.SH SEE ALSO
+.SH BUGS
+No known bugs.
+.SH AUTHOR
+Ethan Ward <ethan.ward at mycroft.ai>
diff --git a/debian/wifi-python-wrapper.install b/debian/wifi-python-wrapper.install
new file mode 100644
index 0000000..a4d4e93
--- /dev/null
+++ b/debian/wifi-python-wrapper.install
@@ -0,0 +1 @@
+bin/wifi-helper /usr/bin/
diff --git a/debian/wifi-python-wrapper.manpages b/debian/wifi-python-wrapper.manpages
new file mode 100644
index 0000000..9914699
--- /dev/null
+++ b/debian/wifi-python-wrapper.manpages
@@ -0,0 +1 @@
+debian/wifi-helper.1

-- 
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