diff --git a/mugshot/MugshotWindow.py b/mugshot/MugshotWindow.py
index 382fe10..02ac627 100644
--- a/mugshot/MugshotWindow.py
+++ b/mugshot/MugshotWindow.py
@@ -51,6 +51,7 @@ def which(command):
command.'''
command = subprocess.Popen(['which', command],
stdout=subprocess.PIPE).stdout.read().strip()
+ command = command.decode('utf-8')
if command == '':
logger.debug('Command "%s" could not be found.' % command)
return None
@@ -445,6 +446,7 @@ class MugshotWindow(Window):
return return_codes
username = os.getenv('USER')
+ sudo = which('sudo')
chfn = which('chfn')
# Get each of the updated values.
@@ -461,7 +463,7 @@ class MugshotWindow(Window):
# Full name can only be modified by root. Try using sudo to modify.
logger.debug('Attempting to set fullname with sudo chfn')
- child = pexpect.spawn('sudo %s %s' % (chfn, username))
+ child = pexpect.spawn('%s %s %s' % (sudo, chfn, username))
child.timeout = 5
try:
child.expect([".*ssword.*", pexpect.EOF])
@@ -482,7 +484,7 @@ class MugshotWindow(Window):
return_codes.append(child.exitstatus)
logger.debug('Attempting to set user details with chfn')
- child = pexpect.spawn('chfn')
+ child = pexpect.spawn(chfn)
child.timeout = 5
try:
child.expect([".*ssword.*", pexpect.EOF])
@@ -542,7 +544,10 @@ class MugshotWindow(Window):
logger.debug('Getting settings from %s' % prefs_file)
for line in open(prefs_file):
if "UserProfile/Data" in line:
- value = line.split('')[1].split('')[0]
+ try:
+ value = line.split('')[1].split('')[0]
+ except IndexError:
+ continue
value = value.strip()
# First Name
if 'name="givenname"' in line:
diff --git a/po/mugshot.pot b/po/mugshot.pot
index f304851..e8a73da 100644
--- a/po/mugshot.pot
+++ b/po/mugshot.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2014-01-25 18:39-0500\n"
+"POT-Creation-Date: 2014-01-25 19:41-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -148,18 +148,18 @@ msgstr ""
msgid "Retry"
msgstr ""
-#: ../mugshot/MugshotWindow.py:374
+#: ../mugshot/MugshotWindow.py:375
msgid "Update Pidgin buddy icon?"
msgstr ""
-#: ../mugshot/MugshotWindow.py:375
+#: ../mugshot/MugshotWindow.py:376
msgid "Would you also like to update your Pidgin buddy icon?"
msgstr ""
-#: ../mugshot/MugshotWindow.py:578
+#: ../mugshot/MugshotWindow.py:583
msgid "Update LibreOffice user details?"
msgstr ""
-#: ../mugshot/MugshotWindow.py:579
+#: ../mugshot/MugshotWindow.py:584
msgid "Would you also like to update your user details in LibreOffice?"
msgstr ""
diff --git a/setup.py b/setup.py
index 7646aed..b5e3f40 100644
--- a/setup.py
+++ b/setup.py
@@ -81,7 +81,7 @@ def move_icon_file(root, target_data, prefix):
# Media is now empty
if len(os.listdir(old_icon_path)) == 0:
- print(("Removing emptry directory: %s" % old_icon_path))
+ print(("Removing empty directory: %s" % old_icon_path))
os.rmdir(old_icon_path)
return icon_file
@@ -180,6 +180,8 @@ DistUtilsExtra.auto.setup(
'to easily set profile image and user details for your '
'user profile and any supported applications.',
url='https://launchpad.net/mugshot',
- data_files=[('share/man/man1', ['mugshot.1'])],
+ data_files=[('share/man/man1', ['mugshot.1']),
+ ('share/glib-2.0/schemas', ['data/glib-2.0/schemas/'
+ 'apps.mugshot.gschema.xml'])],
cmdclass={'install': InstallAndUpdateDataDirectory}
)