From 8ecd9ec029ade308e8695ba19f8a75e5f6b49612 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 18:04:22 -0400 Subject: [PATCH 1/8] Don't build C extensions modules in main setup.py Give WirelessInformationDialog a parent. --- setup.py | 15 ++++++--------- wicd/netentry.py | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index e9eeeed..2971fec 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,6 @@ from distutils.core import setup, Command from distutils.extension import Extension import os import shutil -import sys import subprocess # Be sure to keep this updated! @@ -383,7 +382,6 @@ class uninstall(Command): def run(self): os.system("./uninstall.sh") - try: import wpath except ImportError: @@ -477,13 +475,13 @@ except Exception, e: python setup.py configure has not yet been run.''' -wpactrl_ext = Extension(name = 'wpactrl', - sources = ['depends/python-wpactrl/wpa_ctrl.c', - 'depends/python-wpactrl/wpactrl.c'], - extra_compile_args = ["-fno-strict-aliasing"]) +wpactrl_ext = Extension(name='wpactrl', + sources=['depends/python-wpactrl/wpa_ctrl.c', + 'depends/python-wpactrl/wpactrl.c'], + extra_compile_args=["-fno-strict-aliasing"]) -iwscan_ext = Extension(name = 'iwscan', libraries = ['iw'], - sources = ['depends/python-iwscan/pyiwscan.c']) +iwscan_ext = Extension(name='iwscan', libraries=['iw'], + sources=['depends/python-iwscan/pyiwscan.c']) setup(cmdclass={'configure' : configure, 'get_translations' : get_translations, 'uninstall' : uninstall, 'test' : test, 'clear_generated' : clear_generated}, @@ -506,6 +504,5 @@ connect at startup to any preferred network within range. 'wicd.wpath','wicd.prefs','wicd.netentry','wicd.dbusmanager', 'wicd.logfile','wicd.backend','wicd.configmanager', 'wicd.guiutil','wicd.translations'], - ext_modules=[iwscan_ext, wpactrl_ext], data_files=data ) diff --git a/wicd/netentry.py b/wicd/netentry.py index 6ccd36c..28722ab 100644 --- a/wicd/netentry.py +++ b/wicd/netentry.py @@ -309,7 +309,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog): information_button = gtk.Button(stock=gtk.STOCK_INFO) self.button_hbox.pack_start(information_button, False, False) - information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID)) + information_button.connect('clicked', lambda *a, **k: WirelessInformationDialog(networkID, self)) information_button.show() # Build the encryption menu @@ -879,8 +879,8 @@ class WirelessNetworkEntry(NetworkEntry): class WirelessInformationDialog(gtk.Dialog): - def __init__(self, networkID): - gtk.Dialog.__init__(self) + def __init__(self, networkID, parent): + gtk.Dialog.__init__(self,parent=parent) # Make the combo box. self.lbl_strength = gtk.Label() From 0aaba8c4390d092c5704b6c2a4a0c6dc9dfddb65 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 18:37:51 -0400 Subject: [PATCH 2/8] Make sure we check for wirelesstools in the ioctl backend. --- wicd/backends/be-ioctl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index ee7f95b..1a1c1e4 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -264,6 +264,7 @@ class WirelessInterface(Interface, BaseWirelessInterface): wpa_driver) Interface.__init__(self, iface, verbose) self.scan_iface = None + self.CheckWirelessTools() @neediface([]) def GetNetworks(self): From 0a007d0f449016676faf8f01081327f3c31ba5d2 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 18:53:30 -0400 Subject: [PATCH 3/8] Only check for wireless tools in the ioctl backend if wpactrl isn't available. Fix up error handling when there is no graphical sudo program installed. --- wicd/backends/be-ioctl.py | 4 ++-- wicd/gui.py | 4 +++- wicd/misc.py | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index 1a1c1e4..4314054 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -131,8 +131,8 @@ class Interface(BaseInterface): def CheckWirelessTools(self): """ Check for the existence needed wireless tools """ - # We don't need any external apps so just return - pass + if not WPACTRL_AVAIL: + BaseInterface.CheckWirelessTools(self) @neediface("") def GetIP(self, ifconfig=""): diff --git a/wicd/gui.py b/wicd/gui.py index 61b0b5b..2a2e174 100644 --- a/wicd/gui.py +++ b/wicd/gui.py @@ -57,7 +57,9 @@ def setup_dbus(force=True): except DBusException: if force: print "Can't connect to the daemon, trying to start it automatically..." - misc.PromptToStartDaemon() + if not misc.PromptToStartDaemon(): + print "Failed to find a graphical sudo program, cannot continue." + return False try: dbusmanager.connect_to_dbus() except DBusException: diff --git a/wicd/misc.py b/wicd/misc.py index 3b66f2f..202c9a4 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -155,6 +155,8 @@ def PromptToStartDaemon(): """ Prompt the user to start the daemon """ daemonloc = wpath.sbin + 'wicd' sudo_prog = choose_sudo_prog() + if not sudo_prog: + return False if "gksu" in sudo_prog or "ktsuss" in sudo_prog: msg = '--message' else: @@ -163,6 +165,7 @@ def PromptToStartDaemon(): 'Wicd needs to access your computer\'s network cards.', daemonloc] os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ) + return True def RunRegex(regex, string): """ runs a regex search on a string """ @@ -453,8 +456,7 @@ def choose_sudo_prog(prog_num=0): for path in paths: if os.path.exists(path): return path - - return None + return "" def find_path(cmd): """ Try to find a full path for a given file name. From 3a4ea9a0b5ad29934a9d845dfac3b78ef7e748bf Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 19:57:02 -0400 Subject: [PATCH 4/8] Make sure we fall back to wpa_cli if wpactrl isn't available when stopping wpa_supplicant. --- wicd/backends/be-ioctl.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wicd/backends/be-ioctl.py b/wicd/backends/be-ioctl.py index 4314054..ed7dc3f 100644 --- a/wicd/backends/be-ioctl.py +++ b/wicd/backends/be-ioctl.py @@ -426,6 +426,8 @@ class WirelessInterface(Interface, BaseWirelessInterface): @neediface(False) def StopWPA(self): """ Terminates wpa_supplicant using its ctrl interface. """ + if not WPACTRL_AVAIL: + return BaseWirelessInterface.StopWPA(self) wpa = self._connect_to_wpa_ctrl_iface() if not wpa: return From e12b29072dd825b2b0f4e1da35e4af8794147f41 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 22:41:34 -0400 Subject: [PATCH 5/8] Add missing print statement to ExecuteScripts() --- wicd/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wicd/misc.py b/wicd/misc.py index 202c9a4..b5600b2 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -192,7 +192,7 @@ def ExecuteScript(script, verbose=False): print "Executing %s" % script ret = call("%s > /dev/null 2>&1" % script, shell=True) if verbose: - "%s returned %s" % (script, ret) + print "%s returned %s" % (script, ret) def ReadFile(filename): """ read in a file and return it's contents as a string """ From 0a35f0989dbc2192d67924e09eda3707ebea2949 Mon Sep 17 00:00:00 2001 From: Dan O'Reilly Date: Sat, 11 Apr 2009 22:45:13 -0400 Subject: [PATCH 6/8] Fix duplicate GetOperationalMode() methods. Switch misc.get_gettext() to translations.get_gettext() in configscript.py --- wicd/configscript.py | 4 ++-- wicd/wicd-daemon.py | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/wicd/configscript.py b/wicd/configscript.py index bb6fa28..b574d04 100755 --- a/wicd/configscript.py +++ b/wicd/configscript.py @@ -33,10 +33,10 @@ import ConfigParser import gtk.glade from wicd import wpath -from wicd import misc +from wicd import translations from wicd import dbusmanager -_ = misc.get_gettext() +_ = translations.get_gettext() language = {} language['configure_scripts'] = _("Configure Scripts") diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index e4e26fc..513716b 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -1138,12 +1138,6 @@ class WirelessDaemon(dbus.service.Object): ip = self.wifi.GetIP(ifconfig) return ip - @dbus.service.method('org.wicd.daemon.wireless') - def GetOperationalMode(self, ifconfig=""): - """ Returns the IP associated with the wireless interface. """ - ip = self.wifi.GetOperationalMode(ifconfig) - return ip - @dbus.service.method('org.wicd.daemon.wireless') def CheckWirelessConnectingMessage(self): """ Returns the wireless interface's status message. """ From 0c7c4e86dd9fc83d5d882f30ea363daa894d4804 Mon Sep 17 00:00:00 2001 From: Adam Blackburn Date: Sun, 12 Apr 2009 14:48:52 +0800 Subject: [PATCH 7/8] vcsinfo.py is regenerated when setup.py is run --- setup.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 2971fec..1dde53a 100755 --- a/setup.py +++ b/setup.py @@ -30,11 +30,10 @@ REVISION_NUM = 'unknown' CURSES_REVNO = 'uimod' try: - if not os.path.exists('vcsinfo.py'): - try: - os.system('bzr version-info --python > vcsinfo.py') - except: - pass + try: + os.system('bzr version-info --python > vcsinfo.py') + except: + pass import vcsinfo REVISION_NUM = vcsinfo.version_info['revno'] except Exception, e: From 72c5507232c65943bfcacf9f7587a63006cf4a91 Mon Sep 17 00:00:00 2001 From: Andrew Psaltis Date: Sun, 12 Apr 2009 02:50:57 -0400 Subject: [PATCH 8/8] Added my name to setup.py. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1dde53a..d95153d 100755 --- a/setup.py +++ b/setup.py @@ -495,8 +495,8 @@ to easily add encryption methods used. It ships with some common encryption types, such as WPA and WEP. Wicdl will automatically connect at startup to any preferred network within range. """, - author="Adam Blackburn, Dan O'Reilly", - author_email="compwiz18@gmail.com, oreilldf@gmail.com", + author="Adam Blackburn, Dan O'Reilly, Andrew Psaltis", + author_email="compwiz18@gmail.com, oreilldf@gmail.com, ampsaltis@gmail.com", url="http://wicd.net", license="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html", py_modules=['wicd.networking','wicd.misc','wicd.gui','wicd.wnettools',