Skip to content

Commit

Permalink
setup.py: respect --install-data. Fixes #1575
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Apr 16, 2015
1 parent 545cd5c commit da5f473
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 63 deletions.
12 changes: 3 additions & 9 deletions quodlibet/gdist/appdata.py
Expand Up @@ -13,7 +13,6 @@
import os

from distutils.dep_util import newer
from distutils.util import change_root
from distutils.core import Command


Expand Down Expand Up @@ -60,11 +59,10 @@ class install_appdata(Command):
description = "install .appdata.xml files"
user_options = []

prefix = None
install_dir = None
skip_build = None
appdata = None
build_base = None
root = None

def initialize_options(self):
self.outfiles = []
Expand All @@ -73,8 +71,7 @@ def finalize_options(self):
self.set_undefined_options('build', ('build_base', 'build_base'))
self.set_undefined_options(
'install',
('root', 'root'),
('install_base', 'prefix'),
('install_data', 'install_dir'),
('skip_build', 'skip_build'))

self.set_undefined_options(
Expand All @@ -87,10 +84,7 @@ def run(self):
if not self.skip_build:
self.run_command('build_appdata')

basepath = os.path.join(self.prefix, 'share', 'appdata')
if self.root is not None:
basepath = change_root(self.root, basepath)

basepath = os.path.join(self.install_dir, 'share', 'appdata')
srcpath = os.path.join(self.build_base, 'share', 'appdata')
out = self.mkpath(basepath)
self.outfiles.extend(out or [])
Expand Down
14 changes: 5 additions & 9 deletions quodlibet/gdist/dbus_services.py
Expand Up @@ -8,7 +8,6 @@

import os

from distutils.util import change_root
from distutils.core import Command


Expand Down Expand Up @@ -53,11 +52,10 @@ class install_dbus_services(Command):
user_options = []

def initialize_options(self):
self.prefix = None
self.install_dir = None
self.skip_build = None
self.dbus_services = None
self.build_base = None
self.root = None
self.outfiles = []

def finalize_options(self):
Expand All @@ -67,8 +65,7 @@ def finalize_options(self):

self.set_undefined_options(
'install',
('root', 'root'),
('install_base', 'prefix'),
('install_data', 'install_dir'),
('skip_build', 'skip_build'))

self.set_undefined_options(
Expand All @@ -82,9 +79,8 @@ def run(self):
if not self.skip_build:
self.run_command('build_dbus_services')

basepath = os.path.join(self.prefix, 'share', 'dbus-1', 'services')
if self.root is not None:
basepath = change_root(self.root, basepath)
basepath = os.path.join(
self.install_dir, 'share', 'dbus-1', 'services')
out = self.mkpath(basepath)
self.outfiles.extend(out or [])

Expand All @@ -95,7 +91,7 @@ def run(self):
fullpath = os.path.join(basepath, service_name)
(out, _) = self.copy_file(fullsrc, fullpath)
self.outfiles.append(out)
_replace(fullpath, "@PREFIX@", self.prefix)
_replace(fullpath, "@PREFIX@", self.install_dir)


__all__ = ["build_dbus_services", "install_dbus_services"]
16 changes: 4 additions & 12 deletions quodlibet/gdist/icons.py
Expand Up @@ -9,7 +9,6 @@
import os
import subprocess

from distutils.util import change_root
from distutils.core import Command


Expand All @@ -35,25 +34,21 @@ class install_icons(Command):
"""Copy app icons to hicolor/pixmaps and update the global cache"""

user_options = []
root = None
prefix = None
install_dir = None

def initialize_options(self):
self.outfiles = []

def finalize_options(self):
self.set_undefined_options('install',
('root', 'root'),
('install_base', 'prefix'))
('install_data', 'install_dir'))

def get_outputs(self):
return self.outfiles

def run(self):
# install into hicolor icon theme
basepath = os.path.join(self.prefix, 'share', 'icons', 'hicolor')
if self.root is not None:
basepath = change_root(self.root, basepath)
basepath = os.path.join(self.install_dir, 'share', 'icons', 'hicolor')

local = os.path.join("quodlibet", "images", "hicolor")

Expand All @@ -71,9 +66,6 @@ def run(self):
update_icon_cache(basepath)

# install png versions to /usr/share/pixmaps
basepath = os.path.join(self.prefix, 'share', 'pixmaps')
if self.root is not None:
basepath = change_root(self.root, basepath)

basepath = os.path.join(self.install_dir, 'share', 'pixmaps')
out = self.copy_tree(png, basepath)
self.outfiles.extend(out)
11 changes: 3 additions & 8 deletions quodlibet/gdist/man.py
Expand Up @@ -13,7 +13,6 @@

import os

from distutils.util import change_root
from distutils.core import Command


Expand All @@ -30,20 +29,18 @@ class install_man(Command):
def initialize_options(self):
self.man_pages = None
self.mandir = None
self.prefix = None
self.root = None
self.install_dir = None
self.outfiles = []

def finalize_options(self):
self.set_undefined_options(
'install',
('root', 'root'),
('install_base', 'prefix'),
('install_data', 'install_dir'),
('mandir', 'mandir'),
)

if self.mandir is None:
self.mandir = os.path.join(self.prefix, 'share', 'man')
self.mandir = os.path.join(self.install_dir, 'share', 'man')

self.man_pages = self.distribution.man_pages
for man_page in self.man_pages:
Expand All @@ -55,8 +52,6 @@ def get_outputs(self):

def run(self):
basepath = self.mandir
if self.root is not None:
basepath = change_root(self.root, basepath)
out = self.mkpath(basepath)
self.outfiles.extend(out or [])

Expand Down
11 changes: 3 additions & 8 deletions quodlibet/gdist/po.py
Expand Up @@ -19,7 +19,6 @@
import shutil

from distutils.dep_util import newer
from distutils.util import change_root
from distutils.spawn import find_executable
from distutils.core import Command

Expand Down Expand Up @@ -207,16 +206,14 @@ class install_mo(Command):
def initialize_options(self):
self.skip_build = None
self.build_base = None
self.install_base = None
self.root = None
self.install_dir = None
self.outfiles = []

def finalize_options(self):
self.set_undefined_options('build', ('build_base', 'build_base'))
self.set_undefined_options(
'install',
('root', 'root'),
('install_base', 'install_base'),
('install_data', 'install_dir'),
('skip_build', 'skip_build'))

def get_outputs(self):
Expand All @@ -226,9 +223,7 @@ def run(self):
if not self.skip_build:
self.run_command('build_mo')
src = os.path.join(self.build_base, "share", "locale")
dest = os.path.join(self.install_base, "share", "locale")
if self.root is not None:
dest = change_root(self.root, dest)
dest = os.path.join(self.install_dir, "share", "locale")
out = self.copy_tree(src, dest)
self.outfiles.extend(out)

Expand Down
12 changes: 3 additions & 9 deletions quodlibet/gdist/search_provider.py
Expand Up @@ -8,24 +8,21 @@

import os

from distutils.util import change_root
from distutils.core import Command


class install_search_provider(Command):

user_options = []
root = None
prefix = None
install_dir = None
search_provider = None

def initialize_options(self):
self.outfiles = []

def finalize_options(self):
self.set_undefined_options('install',
('root', 'root'),
('install_base', 'prefix'))
('install_data', 'install_dir'))

self.search_provider = self.distribution.search_provider

Expand All @@ -34,10 +31,7 @@ def get_outputs(self):

def run(self):
basepath = os.path.join(
self.prefix, 'share', 'gnome-shell', 'search-providers')
if self.root is not None:
basepath = change_root(self.root, basepath)

self.install_dir, 'share', 'gnome-shell', 'search-providers')
out = self.mkpath(basepath)
self.outfiles.extend(out or [])
(out, _) = self.copy_file(self.search_provider, basepath)
Expand Down
11 changes: 3 additions & 8 deletions quodlibet/gdist/shortcuts.py
Expand Up @@ -9,7 +9,6 @@
import os

from distutils.dep_util import newer
from distutils.util import change_root
from distutils.core import Command


Expand Down Expand Up @@ -62,11 +61,10 @@ class install_shortcuts(Command):
description = "install .desktop files"
user_options = []

prefix = None
install_dir = None
skip_build = None
shortcuts = None
build_base = None
root = None

def initialize_options(self):
self.outfiles = []
Expand All @@ -75,8 +73,7 @@ def finalize_options(self):
self.set_undefined_options('build', ('build_base', 'build_base'))
self.set_undefined_options(
'install',
('root', 'root'),
('install_base', 'prefix'),
('install_data', 'install_dir'),
('skip_build', 'skip_build'))

self.set_undefined_options(
Expand All @@ -88,9 +85,7 @@ def get_outputs(self):
def run(self):
if not self.skip_build:
self.run_command('build_shortcuts')
basepath = os.path.join(self.prefix, 'share', 'applications')
if self.root is not None:
basepath = change_root(self.root, basepath)
basepath = os.path.join(self.install_dir, 'share', 'applications')
srcpath = os.path.join(self.build_base, 'share', 'applications')
out = self.mkpath(basepath)
self.outfiles.extend(out or [])
Expand Down

0 comments on commit da5f473

Please sign in to comment.