PEP8 setup.py

This commit is contained in:
Sean Davis 2014-04-01 21:55:50 -04:00
parent cec2b750a5
commit c000724dc0
1 changed files with 13 additions and 12 deletions

View File

@ -22,10 +22,10 @@ try:
import DistUtilsExtra.auto import DistUtilsExtra.auto
except ImportError: except ImportError:
sys.stderr.write("To build mugshot you need " sys.stderr.write("To build mugshot you need "
"https://launchpad.net/python-distutils-extra\n") "https://launchpad.net/python-distutils-extra\n")
sys.exit(1) sys.exit(1)
assert DistUtilsExtra.auto.__version__ >= '2.18', \ assert DistUtilsExtra.auto.__version__ >= '2.18', \
'needs DistUtilsExtra.auto >= 2.18' 'needs DistUtilsExtra.auto >= 2.18'
def update_config(libdir, values={}): def update_config(libdir, values={}):
@ -55,17 +55,17 @@ def update_config(libdir, values={}):
def move_icon_file(root, target_data, prefix): def move_icon_file(root, target_data, prefix):
"""Move the icon files to their installation prefix.""" """Move the icon files to their installation prefix."""
old_icon_path = os.path.normpath( old_icon_path = os.path.normpath(os.path.join(root, target_data, 'share',
os.path.join(root, target_data, 'share', 'mugshot', 'media')) 'mugshot', 'media'))
for icon_size in ['16x16', '22x22', '24x24', '48x48', '64x64', 'scalable']: for icon_size in ['16x16', '22x22', '24x24', '48x48', '64x64', 'scalable']:
if icon_size == 'scalable': if icon_size == 'scalable':
old_icon_file = os.path.join(old_icon_path, 'mugshot.svg') old_icon_file = os.path.join(old_icon_path, 'mugshot.svg')
else: else:
old_icon_file = os.path.join(old_icon_path, old_icon_file = os.path.join(old_icon_path,
'mugshot_%s.svg' % icon_size.split('x')[0]) 'mugshot_%s.svg' %
icon_path = os.path.normpath( icon_size.split('x')[0])
os.path.join(root, target_data, 'share', 'icons', 'hicolor', icon_path = os.path.normpath(os.path.join(root, target_data, 'share',
icon_size, 'apps')) 'icons', 'hicolor', icon_size, 'apps'))
icon_file = os.path.join(icon_path, 'mugshot.svg') icon_file = os.path.join(icon_path, 'mugshot.svg')
old_icon_file = os.path.realpath(old_icon_file) old_icon_file = os.path.realpath(old_icon_file)
icon_file = os.path.realpath(icon_file) icon_file = os.path.realpath(icon_file)
@ -89,8 +89,8 @@ def move_icon_file(root, target_data, prefix):
def get_desktop_file(root, target_data, prefix): def get_desktop_file(root, target_data, prefix):
"""Move the desktop file to its installation prefix.""" """Move the desktop file to its installation prefix."""
desktop_path = os.path.realpath( desktop_path = os.path.realpath(os.path.join(root, target_data, 'share',
os.path.join(root, target_data, 'share', 'applications')) 'applications'))
desktop_file = os.path.join(desktop_path, 'mugshot.desktop') desktop_file = os.path.join(desktop_path, 'mugshot.desktop')
return desktop_file return desktop_file
@ -125,13 +125,14 @@ class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
DistUtilsExtra.auto.install_auto.run(self) DistUtilsExtra.auto.install_auto.run(self)
print(("=== Installing %s, version %s ===" % print(("=== Installing %s, version %s ===" %
(self.distribution.get_name(), self.distribution.get_version()))) (self.distribution.get_name(), self.distribution.get_version())))
if not self.prefix: if not self.prefix:
self.prefix = '' self.prefix = ''
if self.root: if self.root:
target_data = os.path.relpath(self.install_data, self.root) + os.sep target_data = os.path.relpath(self.install_data, self.root) + \
os.sep
target_pkgdata = os.path.join(target_data, 'share', 'mugshot', '') target_pkgdata = os.path.join(target_data, 'share', 'mugshot', '')
target_scripts = os.path.join(self.install_scripts, '') target_scripts = os.path.join(self.install_scripts, '')