diff --git a/in/wicd=wpath.py.in b/in/wicd=wpath.py.in index 2d27b0e..8f82101 100755 --- a/in/wicd=wpath.py.in +++ b/in/wicd=wpath.py.in @@ -27,9 +27,9 @@ lib = '%LIB%' share = '%SHARE%' etc = '%ETC%' scripts = '%SCRIPTS%' -disconnectscripts = '%DISCONNECTSCRIPTS%' -preconnectscripts = '%PRECONNECTSCRIPTS%' -postconnectscripts = '%POSTCONNECTSCRIPTS%' +disconnectscripts = '%SCRIPTS%disconnect' +preconnectscripts = '%SCRIPTS%preconnect' +postconnectscripts = '%SCRIPTS%postconnect' images = '%IMAGES%' encryption = '%ENCRYPTION%' bin = '%BIN%' diff --git a/setup.py b/setup.py index 68af3ab..b8bf723 100755 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ except Exception, e: print 'failed to find revision number:' print e + class configure(Command): description = "configure the paths that Wicd will be installed to" @@ -52,9 +53,6 @@ class configure(Command): ('share=', None, 'set the share directory'), ('etc=', None, 'set the etc directory'), ('scripts=', None, 'set the global scripts directory'), - ('disconnectscripts=', None, 'set the global disconnect scripts directory'), - ('preconnectscripts=', None, 'set the global preconnect scripts directory'), - ('postconnectscripts=', None, 'set the global postconnect scripts directory'), ('images=', None, 'set the image directory'), ('encryption=', None, 'set the encryption template directory'), ('bin=', None, 'set the bin directory'), @@ -95,15 +93,11 @@ class configure(Command): ('no-install-ncurses', None, 'do not install the ncurses client') ] - def initialize_options(self): self.lib = '/usr/lib/wicd/' self.share = '/usr/share/wicd/' self.etc = '/etc/wicd/' self.scripts = self.etc + "scripts/" - self.preconnectscripts = self.scripts + "preconnect/" - self.postconnectscripts = self.scripts + "postconnect/" - self.disconnectscripts = self.scripts + "disconnect/" self.icons = '/usr/share/icons/hicolor/' self.images = '/usr/share/pixmaps/wicd/' self.encryption = self.etc + 'encryption/templates/' @@ -210,10 +204,11 @@ class configure(Command): kde4temp = subprocess.Popen(["kde4-config","--prefix"], stdout=subprocess.PIPE) returncode = kde4temp.wait() # let it finish, and get the exit code kde4dir_candidate = kde4temp.stdout.readline().strip() # read stdout - if len(kde4dir_candidate) == 0 or returncode != 0 or not os.path.isabs(kde4dir_candidate): + if len(kde4dir_candidate) == 0 or returncode != 0 or \ + not os.path.isabs(kde4dir_candidate): raise ValueError else: - self.kdedir = kde4dir_candidate + '/share/autostart' + self.kdedir = kde4dir_candidate + '/share/autostart' except (OSError, ValueError): # If neither kde-config nor kde4-config are not present or # return an error, then we can assume that kde isn't installed @@ -227,14 +222,12 @@ class configure(Command): self.initfilename = os.path.basename(self.initfile) self.wicdgroup = 'users' - def finalize_options(self): if self.distro_detect_failed and not self.no_install_init and \ 'FAIL' in [self.init, self.initfile]: print 'ERROR: Failed to detect distro. Configure cannot continue. ' + \ 'Please specify --init and --initfile to continue with configuration.' - - + # loop through the argument definitions in user_options for argument in self.user_options: # argument name is the first item in the user_options list @@ -257,12 +250,15 @@ class configure(Command): values = list() for argument in self.user_options: if argument[0].endswith('='): - print argument[0][:-1],'is', - print getattr(self, argument[0][:-1]) - values.append((argument[0][:-1], getattr(self, argument[0][:-1].replace('-','_')))) + cur_arg = argument[0][:-1] + cur_arg_value = getattr(self, cur_arg) + print "%s is %s" % (cur_arg, cur_arg_value) + values.append((cur_arg, cur_arg_value.replace('-', '_'))) else: - print "Found switch",argument,getattr(self, argument[0].replace('-','_')) - values.append((argument[0], bool(getattr(self, argument[0].replace('-','_'))))) + cur_arg = argument[0] + cur_arg_value = getattr(self, cur_arg.replace('-', '_')) + print "Found switch %s %s" % (argument, cur_arg_value) + values.append((cur_arg, bool(cur_arg_value))) print 'Replacing values in template files...' for item in os.listdir('in'): @@ -275,7 +271,8 @@ class configure(Command): item_out = open(final_name, 'w') for line in item_in.readlines(): for item, value in values: - line = line.replace('%' + str(item.upper().replace('-','_')) + '%', str(value)) + line = line.replace('%' + str(item.upper().replace('-','_')) + \ + '%', str(value)) # other things to replace that aren't arguments line = line.replace('%VERSION%', str(VERSION_NUM)) @@ -363,7 +360,8 @@ class get_translations(Command): shutil.move(pofile, lang_identifier+'.po') print 'Got',lang_identifier os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES') - os.system('msgfmt --output-file=translations/'+lang_identifier+'/LC_MESSAGES/wicd.mo '+lang_identifier+'.po') + os.system('msgfmt --output-file=translations/' + lang_identifier + + '/LC_MESSAGES/wicd.mo ' + lang_identifier + '.po') os.remove(lang_identifier+'.po') @@ -383,7 +381,7 @@ class uninstall(Command): try: import wpath -except: +except ImportError: print '''Error importing wpath.py. You can safely ignore this message. It is probably because you haven't run python setup.py configure yet or you are running it for the first time.''' @@ -410,12 +408,15 @@ try: (wpath.icons + '22x22/apps/', ['icons/22px/wicd-client.png']), (wpath.icons + '16x16/apps/', ['icons/16px/wicd-client.png']), (wpath.images, [('images/' + b) for b in os.listdir('images') if not b.startswith('.')]), - (wpath.encryption, [('encryption/templates/' + b) for b in os.listdir('encryption/templates') if not b.startswith('.')]), + (wpath.encryption, [('encryption/templates/' + b) for b in + os.listdir('encryption/templates') if not b.startswith('.')]), (wpath.networks, []), (wpath.bin, ['scripts/wicd-client', ]), (wpath.sbin, ['scripts/wicd', ]), (wpath.share, ['data/wicd.glade', ]), - (wpath.lib, ['wicd/wicd-client.py', 'wicd/monitor.py', 'wicd/wicd-daemon.py', 'wicd/configscript.py', 'wicd/suspend.py', 'wicd/autoconnect.py']), #'wicd/wicd-gui.py', + (wpath.lib, ['wicd/wicd-client.py', 'wicd/monitor.py', + 'wicd/wicd-daemon.py', 'wicd/configscript.py', + 'wicd/suspend.py', 'wicd/autoconnect.py']), (wpath.backends, ['wicd/backends/be-external.py', 'wicd/backends/be-ioctl.py']), (wpath.autostart, ['other/wicd-tray.desktop', ]), (wpath.scripts, []), @@ -424,12 +425,12 @@ try: (wpath.postconnectscripts, []), ] if not wpath.no_install_ncurses: - data.append(( wpath.lib, ['curses/curses_misc.py'])) - data.append(( wpath.lib, ['curses/prefs_curses.py'])) - data.append(( wpath.lib, ['curses/wicd-curses.py'])) - data.append(( wpath.lib, ['curses/netentry_curses.py'])) - data.append(( wpath.lib, ['curses/configscript_curses.py'])) - data.append(( wpath.bin, ['scripts/wicd-curses'])) + data.append((wpath.lib, ['curses/curses_misc.py'])) + data.append((wpath.lib, ['curses/prefs_curses.py'])) + data.append((wpath.lib, ['curses/wicd-curses.py'])) + data.append((wpath.lib, ['curses/netentry_curses.py'])) + data.append((wpath.lib, ['curses/configscript_curses.py'])) + data.append((wpath.bin, ['scripts/wicd-curses'])) if not wpath.no_install_man: data.append(( wpath.mandir + 'man8/', ['man/wicd-curses.8'])) piddir = os.path.dirname(wpath.pidfile) @@ -437,22 +438,23 @@ try: piddir += '/' data.append (( piddir, [] )) if not wpath.no_install_docs: - data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README', 'CHANGES','other/WHEREAREMYFILES' ])) + data.append((wpath.docdir, ['INSTALL', 'LICENSE', 'AUTHORS', + 'README', 'CHANGES', 'other/WHEREAREMYFILES'])) if not wpath.no_install_kde: - data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ])) + data.append((wpath.kdedir, ['other/wicd-tray.desktop'])) if not wpath.no_install_init: - data.append(( wpath.init, [ wpath.initfile ])) + data.append((wpath.init, [ wpath.initfile ])) if not wpath.no_install_man: - data.append(( wpath.mandir + 'man8/', [ 'man/wicd.8' ])) - data.append(( wpath.mandir + 'man5/', [ 'man/wicd-manager-settings.conf.5' ])) - data.append(( wpath.mandir + 'man5/', [ 'man/wicd-wired-settings.conf.5' ])) - data.append(( wpath.mandir + 'man5/', [ 'man/wicd-wireless-settings.conf.5' ])) - data.append(( wpath.mandir + 'man1/', [ 'man/wicd-client.1' ])) + data.append((wpath.mandir + 'man8/', [ 'man/wicd.8' ])) + data.append((wpath.mandir + 'man5/', [ 'man/wicd-manager-settings.conf.5' ])) + data.append((wpath.mandir + 'man5/', [ 'man/wicd-wired-settings.conf.5' ])) + data.append((wpath.mandir + 'man5/', [ 'man/wicd-wireless-settings.conf.5' ])) + data.append((wpath.mandir + 'man1/', [ 'man/wicd-client.1' ])) if not wpath.no_install_acpi: - data.append(( wpath.resume, ['other/80-wicd-connect.sh' ])) - data.append(( wpath.suspend, ['other/50-wicd-suspend.sh' ])) + data.append((wpath.resume, ['other/80-wicd-connect.sh' ])) + data.append((wpath.suspend, ['other/50-wicd-suspend.sh' ])) if not wpath.no_install_pmutils: - data.append(( wpath.pmutils, ['other/55wicd' ])) + data.append((wpath.pmutils, ['other/55wicd' ])) print 'Using pid path', os.path.basename(wpath.pidfile) print 'Language support for', for language in os.listdir('translations/'): @@ -462,8 +464,8 @@ try: if codes[0].lower() == codes[1].lower(): short_language = codes[0].lower() print short_language, - data.append((wpath.translations + short_language + '/LC_MESSAGES/', ['translations/' + language + '/LC_MESSAGES/wicd.mo'])) - print + data.append((wpath.translations + short_language + '/LC_MESSAGES/', + ['translations/' + language + '/LC_MESSAGES/wicd.mo'])) except Exception, e: print str(e) print '''Error setting up data array. This is normal if