File 01-make-setup.py-honor-root-option.patch of Package quodlibet
Index: gdist/man.py
===================================================================
--- gdist/man.py (revision 4283)
+++ gdist/man.py (working copy)
@@ -21,20 +21,26 @@
"""
description = "install man pages"
+ user_options = [('root=', None,"install everything relative to this alternate root directory"),]
man_pages = None
prefix = None
+ root = None
def finalize_options(self):
GCommand.finalize_options(self)
- self.set_undefined_options('install', ('install_base', 'prefix'))
+ self.set_undefined_options('install', ('install_base', 'prefix'),
+ ('root', 'root'),)
self.man_pages = self.distribution.man_pages
for man_page in self.man_pages:
if not man_page[-1].isdigit():
raise SystemExit("%r has no section" % man_page)
def run(self):
- basepath = os.path.join(self.prefix, 'share', 'man')
+ if self.root and self.prefix.startswith("/"):
+ basepath = os.path.join(self.root, self.prefix[1:], 'share', 'man')
+ else:
+ basepath = os.path.join(self.prefix, 'share', 'man')
self.mkpath(basepath)
for man_page in self.man_pages:
manpath = os.path.join(basepath, "man" + man_page[-1])
Index: gdist/po.py
===================================================================
--- gdist/po.py (revision 4283)
+++ gdist/po.py (working copy)
@@ -73,10 +73,12 @@
"""
description = "install message catalog files"
+ user_options = [('root=', None,"install everything relative to this alternate root directory"),]
skip_build = None
build_base = None
install_base = None
+ root = None
def finalize_options(self):
GCommand.finalize_options(self)
@@ -84,13 +86,17 @@
self.set_undefined_options(
'install',
('install_base', 'install_base'),
- ('skip_build', 'skip_build'))
+ ('skip_build', 'skip_build'),
+ ('root', 'root'),)
def run(self):
if not self.skip_build:
self.run_command('build_mo')
+ if self.root and self.install_base.startswith("/"):
+ dest = os.path.join(self.root, self.install_base[1:], 'share', 'locale')
+ else:
+ dest = os.path.join(self.install_base, 'share', 'locale')
src = os.path.join(self.build_base, "share", "locale")
- dest = os.path.join(self.install_base, "share", "locale")
self.copy_tree(src, dest)
__all__ = ["build_mo", "install_mo"]
Index: gdist/shortcuts.py
===================================================================
--- gdist/shortcuts.py (revision 4283)
+++ gdist/shortcuts.py (working copy)
@@ -18,13 +18,13 @@
"""
description = "build .desktop files"
- user_options = []
build_base = None
def finalize_options(self):
GCommand.finalize_options(self)
self.shortcuts = self.distribution.shortcuts
- self.set_undefined_options('build', ('build_base', 'build_base'))
+ self.set_undefined_options('build',
+ ('build_base', 'build_base'))
def run(self):
basepath = os.path.join(self.build_base, 'share', 'applications')
@@ -48,11 +48,13 @@
"""
description = "install .desktop files"
+ user_options = [('root=', None,"install everything relative to this alternate root directory"),]
prefix = None
skip_build = None
shortcuts = None
build_base = None
+ root = None
def finalize_options(self):
GCommand.finalize_options(self)
@@ -60,7 +62,8 @@
self.set_undefined_options(
'install',
('install_base', 'prefix'),
- ('skip_build', 'skip_build'))
+ ('skip_build', 'skip_build'),
+ ('root', 'root'),)
self.set_undefined_options(
'build_shortcuts', ('shortcuts', 'shortcuts'))
@@ -68,7 +71,10 @@
def run(self):
if not self.skip_build:
self.run_command('build_shortcuts')
- basepath = os.path.join(self.prefix, 'share', 'applications')
+ if self.root and self.prefix.startswith("/"):
+ basepath = os.path.join(self.root, self.prefix[1:], 'share', 'applications')
+ else:
+ basepath = os.path.join(self.prefix, 'share', 'applications')
srcpath = os.path.join(self.build_base, 'share', 'applications')
self.mkpath(basepath)
for shortcut in self.shortcuts: