License and setup updates

This commit is contained in:
Sean Davis 2014-01-25 18:13:56 -05:00
parent a1691007b0
commit ecdfb1ecdd
10 changed files with 258 additions and 231 deletions

View File

@ -1,47 +1,32 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import locale
locale.textdomain('mugshot')
import gi
gi.require_version('Gtk', '3.0')
# Add project root directory (enable symlink and trunk execution)
# Get project root directory (enable symlink and trunk execution)
PROJECT_ROOT_DIRECTORY = os.path.abspath(
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
python_path = []
if os.path.abspath(__file__).startswith('/opt'):
locale.bindtextdomain('mugshot', '/opt/extras.ubuntu.com/mugshot/share/locale')
syspath = sys.path[:] # copy to avoid infinite loop in pending objects
for path in syspath:
opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/mugshot')
python_path.insert(0, opt_path)
sys.path.insert(0, opt_path)
os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/mugshot/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'mugshot'))
and PROJECT_ROOT_DIRECTORY not in sys.path):
python_path.insert(0, PROJECT_ROOT_DIRECTORY)
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
if python_path:
os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
# Add project root directory to python search path
sys.path.append(PROJECT_ROOT_DIRECTORY)
import mugshot
mugshot.main()

32
mugshot.1 Normal file
View File

@ -0,0 +1,32 @@
.de URL
\\$2 \(laURL: \\$1 \(ra\\$3
..
.if \n[.g] .mso www.tmac
.TH MUGSHOT "1" "January 2014" "mugshot 0.1" "User Commands"
.SH NAME
mugshot \- lightweight user configuration utility
.SH DESCRIPTION
Mugshot is a lightweight user configuration utility. Mugshot allows you to easily set profile image and user details for your user profile and any supported applications.
.SH SYNOPSIS
.B mugshot
[\fIoptions\fR]
.SH OPTIONS
.TP
\fB\-\-version\fR
show program's version number and exit
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Show debug messages (\fB\-vv\fR debugs mugshot_lib also)
.SH "SEE ALSO"
The full documentation for
.B mugshot
is maintained online at
.URL "http://wiki.smdavis.us/doku.php?id=mugshot-docs" "the authors documentation portal" "."
.SH BUGS
Please report bugs at
.URL "https://bugs.launchpad.net/mugshot" "the Mugshot Bugs page" "."
.SH AUTHOR
Sean Davis (smd.seandavis@gmail.com)

View File

@ -1,20 +1,22 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# Copyright (C) 2010 Rick Spencer <rick.spencer@canonical.com>
# Portions of this code are inspired by web_cam_box by Rick Spencer.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# Portions of this file are adapted from web_cam_box,
# Copyright (C) 2010 Rick Spencer <rick.spencer@canonical.com>
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from locale import gettext as _

View File

@ -1,18 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from locale import gettext as _
@ -134,9 +135,9 @@ def get_confirmation_dialog(parent, primary_message, secondary_message,
"""Display a confirmation (yes/no) dialog configured with primary and
secondary messages, as well as a custom icon if requested."""
dialog = Gtk.MessageDialog(transient_for=parent, flags=0,
type=Gtk.MessageType.QUESTION,
message_type=Gtk.MessageType.QUESTION,
buttons=Gtk.ButtonsType.YES_NO,
message_format=primary_message)
text=primary_message)
dialog.format_secondary_text(secondary_message)
if icon_name:
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)

View File

@ -1,20 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
'''Enhances builder connections, provides object to access glade objects'''

View File

@ -1,20 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk # pylint: disable=E0611
import logging

View File

@ -1,20 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gio, Gtk # pylint: disable=E0611
import logging

View File

@ -1,20 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
"""Helpers for an Ubuntu application."""
import logging

View File

@ -1,20 +1,19 @@
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
### DO NOT EDIT THIS FILE ###
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__all__ = [
'project_path_not_found',

208
setup.py
View File

@ -1,21 +1,19 @@
#!/usr/bin/env python
#!/usr/bin/python3
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 Sean Davis <smd.seandavis@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################
# Mugshot - Lightweight user configuration utility
# Copyright (C) 2013-2014 Sean Davis <smd.seandavis@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
@ -23,20 +21,23 @@ import sys
try:
import DistUtilsExtra.auto
except ImportError:
print >> sys.stderr, 'To build mugshot you need https://launchpad.net/python-distutils-extra'
sys.stderr.write("To build mugshot you need "
"https://launchpad.net/python-distutils-extra\n")
sys.exit(1)
assert DistUtilsExtra.auto.__version__ >= '2.18', 'needs DistUtilsExtra.auto >= 2.18'
assert DistUtilsExtra.auto.__version__ >= '2.18', \
'needs DistUtilsExtra.auto >= 2.18'
def update_config(libdir, values = {}):
filename = os.path.join(libdir, 'mugshot_lib/mugshotconfig.py')
def update_config(libdir, values={}):
"""Update the configuration file at installation time."""
filename = os.path.join(libdir, 'mugshot_lib', 'mugshotconfig.py')
oldvalues = {}
try:
fin = file(filename, 'r')
fout = file(filename + '.new', 'w')
fin = open(filename, 'r')
fout = open(filename + '.new', 'w')
for line in fin:
fields = line.split(' = ') # Separate variable from value
fields = line.split(' = ') # Separate variable from value
if fields[0] in values:
oldvalues[fields[0]] = fields[1].strip()
line = "%s = %s\n" % (fields[0], values[fields[0]])
@ -46,73 +47,64 @@ def update_config(libdir, values = {}):
fout.close()
fin.close()
os.rename(fout.name, fin.name)
except (OSError, IOError), e:
print ("ERROR: Can't find %s" % filename)
except (OSError, IOError):
print(("ERROR: Can't find %s" % filename))
sys.exit(1)
return oldvalues
def move_icon_file(root, target_data, prefix):
old_icon_path = os.path.normpath(root + target_data + '/share/mugshot/media')
for icon_size in ['16x16', '22x22', '24x24', '48x48', '64x64', 'scalable']:
"""Move the icon files to their installation prefix."""
old_icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'mugshot', 'media'))
for icon_size in ['16x16', '24x24', '32x32', '48x48', '64x64', 'scalable']:
if icon_size == 'scalable':
old_icon_file = old_icon_path + '/mugshot.svg'
old_icon_file = os.path.join(old_icon_path, 'mugshot.svg')
else:
old_icon_file = old_icon_path + '/mugshot_%s.svg' % icon_size.split('x')[0]
icon_path = os.path.normpath(root + prefix + '/share/icons/hicolor/%s/apps' % icon_size)
icon_file = icon_path + '/mugshot.svg'
old_icon_file = os.path.join(old_icon_path,
'mugshot_%s.svg' % icon_size.split('x')[0])
icon_path = os.path.normpath(
os.path.join(root, target_data, 'share', 'icons', 'hicolor',
icon_size, 'apps'))
icon_file = os.path.join(icon_path, 'mugshot.svg')
old_icon_file = os.path.realpath(old_icon_file)
icon_file = os.path.realpath(icon_file)
if not os.path.exists(old_icon_file):
print ("ERROR: Can't find", old_icon_file)
print(("ERROR: Can't find", old_icon_file))
sys.exit(1)
if not os.path.exists(icon_path):
os.makedirs(icon_path)
if old_icon_file != icon_file:
print(("Moving icon file: %s -> %s" % (old_icon_file, icon_file)))
os.rename(old_icon_file, icon_file)
# Media is now empty
if len(os.listdir(old_icon_path)) == 0:
print(("Removing emptry directory: %s" % old_icon_path))
os.rmdir(old_icon_path)
return icon_file
def move_desktop_file(root, target_data, prefix):
# The desktop file is rightly installed into install_data. But it should
# always really be installed into prefix, because while we can install
# normal data files anywhere we want, the desktop file needs to exist in
# the main system to be found. Only actually useful for /opt installs.
old_desktop_path = os.path.normpath(root + target_data +
'/share/applications')
old_desktop_file = old_desktop_path + '/mugshot.desktop'
desktop_path = os.path.normpath(root + prefix + '/share/applications')
desktop_file = desktop_path + '/mugshot.desktop'
if not os.path.exists(old_desktop_file):
print ("ERROR: Can't find", old_desktop_file)
sys.exit(1)
elif target_data != prefix + '/':
# This is an /opt install, so rename desktop file to use extras-
desktop_file = desktop_path + '/extras-mugshot.desktop'
try:
if not os.path.exists(desktop_path):
os.makedirs(desktop_path)
if old_desktop_file != desktop_file:
os.rename(old_desktop_file, desktop_file)
for filename in os.listdir(old_desktop_path):
os.remove( os.path.join(old_desktop_path, filename) )
os.rmdir(old_desktop_path)
except OSError as e:
print ("ERROR: Can't rename", old_desktop_file, ":", e)
sys.exit(1)
def get_desktop_file(root, target_data, prefix):
"""Move the desktop file to its installation prefix."""
desktop_path = os.path.realpath(
os.path.join(root, target_data, 'share', 'applications'))
desktop_file = os.path.join(desktop_path, 'mugshot.desktop')
return desktop_file
def update_desktop_file(filename, target_pkgdata, target_scripts):
def update_desktop_file(filename, script_path):
"""Update the desktop file with prefixed paths."""
try:
fin = file(filename, 'r')
fout = file(filename + '.new', 'w')
fin = open(filename, 'r')
fout = open(filename + '.new', 'w')
for line in fin:
if 'Exec=' in line:
cmd = line.split("=")[1].split(None, 1)
line = "Exec=%s" % (target_scripts + 'mugshot')
line = "Exec=%s" % os.path.join(script_path, 'mugshot')
if len(cmd) > 1:
line += " %s" % cmd[1].strip() # Add script arguments back
line += "\n"
@ -121,53 +113,73 @@ def update_desktop_file(filename, target_pkgdata, target_scripts):
fout.close()
fin.close()
os.rename(fout.name, fin.name)
except (OSError, IOError), e:
print ("ERROR: Can't find %s" % filename)
except (OSError, IOError):
print(("ERROR: Can't find %s" % filename))
sys.exit(1)
def compile_schemas(root, target_data):
if target_data == '/usr/':
return # /usr paths don't need this, they will be handled by dpkg
schemadir = os.path.normpath(root + target_data + 'share/glib-2.0/schemas')
if (os.path.isdir(schemadir) and
os.path.isfile('/usr/bin/glib-compile-schemas')):
os.system('/usr/bin/glib-compile-schemas "%s"' % schemadir)
class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
"""Command Class to install and update the directory."""
def run(self):
"""Run the setup commands."""
DistUtilsExtra.auto.install_auto.run(self)
if not self.root:
print(("=== Installing %s, version %s ===" %
(self.distribution.get_name(), self.distribution.get_version())))
if not self.prefix:
self.prefix = ''
if self.root:
target_data = os.path.relpath(self.install_data, self.root) + os.sep
target_pkgdata = os.path.join(target_data, 'share', 'mugshot', '')
target_scripts = os.path.join(self.install_scripts, '')
data_dir = os.path.join(self.prefix, 'share', 'mugshot', '')
script_path = os.path.join(self.prefix, 'bin')
else:
# --user install
self.root = ''
target_data = os.path.relpath(self.install_data) + os.sep
target_pkgdata = os.path.join(target_data, 'share', 'mugshot', '')
target_scripts = os.path.join(self.install_scripts, '')
target_data = '/' + os.path.relpath(self.install_data, self.root) + '/'
target_pkgdata = target_data + 'share/mugshot/'
target_scripts = '/' + os.path.relpath(self.install_scripts, self.root) + '/'
# Use absolute paths
target_data = os.path.realpath(target_data)
target_pkgdata = os.path.realpath(target_pkgdata)
target_scripts = os.path.realpath(target_scripts)
values = {'__mugshot_data_directory__': "'%s'" % (target_pkgdata),
data_dir = target_pkgdata
script_path = target_scripts
print(("Root: %s" % self.root))
print(("Prefix: %s\n" % self.prefix))
print(("Target Data: %s" % target_data))
print(("Target PkgData: %s" % target_pkgdata))
print(("Target Scripts: %s\n" % target_scripts))
print(("Mugshot Data Directory: %s" % data_dir))
values = {'__mugshot_data_directory__': "'%s'" % (data_dir),
'__version__': "'%s'" % self.distribution.get_version()}
update_config(self.install_lib, values)
desktop_file = move_desktop_file(self.root, target_data, self.prefix)
icon_file = move_icon_file(self.root, target_data, self.prefix)
update_desktop_file(desktop_file, target_pkgdata, target_scripts)
compile_schemas(self.root, target_data)
##################################################################################
###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
##################################################################################
desktop_file = get_desktop_file(self.root, target_data, self.prefix)
print(("Desktop File: %s\n" % desktop_file))
move_icon_file(self.root, target_data, self.prefix)
update_desktop_file(desktop_file, script_path)
DistUtilsExtra.auto.setup(
name='mugshot',
version='0.1',
version='2.0',
license='GPL-3',
author='Sean Davis',
author_email='smd.seandavis@gmail.com',
#description='UI for managing …',
#long_description='Here a longer description',
description='lightweight user configuration utility',
long_description='A lightweight user configuration utility. It allows you '
'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'])],
cmdclass={'install': InstallAndUpdateDataDirectory}
)