mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
setup: Make sure non-/usr prefix works
Basically mandate that configure is passed a prefix, since we need this info before the install process.
This commit is contained in:
parent
2a7a634df0
commit
ffb876e3a1
27
setup.py
27
setup.py
@ -7,7 +7,10 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from distutils.core import Command, setup
|
from distutils.core import Command, setup
|
||||||
|
from distutils.command.install import install
|
||||||
from distutils.command.install_egg_info import install_egg_info
|
from distutils.command.install_egg_info import install_egg_info
|
||||||
|
from distutils.sysconfig import get_config_var
|
||||||
|
sysprefix = get_config_var("prefix")
|
||||||
|
|
||||||
from DistUtilsExtra.auto import sdist_auto
|
from DistUtilsExtra.auto import sdist_auto
|
||||||
from DistUtilsExtra.command.build_i18n import build_i18n
|
from DistUtilsExtra.command.build_i18n import build_i18n
|
||||||
@ -157,6 +160,24 @@ class my_egg_info(install_egg_info):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class my_install(install):
|
||||||
|
"""
|
||||||
|
Error if we weren't 'configure'd with the correct install prefix
|
||||||
|
"""
|
||||||
|
def finalize_options(self):
|
||||||
|
if self.prefix is None:
|
||||||
|
if cliconfig.prefix != sysprefix:
|
||||||
|
print "Using prefix from 'configure': %s" % cliconfig.prefix
|
||||||
|
self.prefix = cliconfig.prefix
|
||||||
|
elif self.prefix != cliconfig.prefix:
|
||||||
|
print ("Install prefix=%s doesn't match configure prefix=%s\n"
|
||||||
|
"Pass matching --prefix to 'setup.py configure'" %
|
||||||
|
(self.prefix, cliconfig.prefix))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
install.finalize_options(self)
|
||||||
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Custom commands #
|
# Custom commands #
|
||||||
###################
|
###################
|
||||||
@ -167,6 +188,7 @@ class my_rpm(Command):
|
|||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -181,6 +203,7 @@ class my_rpm(Command):
|
|||||||
|
|
||||||
class configure(Command):
|
class configure(Command):
|
||||||
user_options = [
|
user_options = [
|
||||||
|
("prefix=", None, "installation prefix"),
|
||||||
("without-tui", None, "don't install virt-manager-tui"),
|
("without-tui", None, "don't install virt-manager-tui"),
|
||||||
("qemu-user=", None,
|
("qemu-user=", None,
|
||||||
"user libvirt uses to launch qemu processes (default=root)"),
|
"user libvirt uses to launch qemu processes (default=root)"),
|
||||||
@ -214,11 +237,13 @@ class configure(Command):
|
|||||||
self.hide_unsupported_rhel_options = 0
|
self.hide_unsupported_rhel_options = 0
|
||||||
self.preferred_distros = ""
|
self.preferred_distros = ""
|
||||||
self.default_graphics = "vnc"
|
self.default_graphics = "vnc"
|
||||||
|
self.prefix = sysprefix
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
template = ""
|
template = ""
|
||||||
template += "[config]\n"
|
template += "[config]\n"
|
||||||
|
template += "prefix = %s\n" % self.prefix
|
||||||
template += "with_tui = %s\n" % int(not self.without_tui)
|
template += "with_tui = %s\n" % int(not self.without_tui)
|
||||||
template += "default_qemu_user = %s\n" % self.qemu_user
|
template += "default_qemu_user = %s\n" % self.qemu_user
|
||||||
template += "libvirt_packages = %s\n" % self.libvirt_package_names
|
template += "libvirt_packages = %s\n" % self.libvirt_package_names
|
||||||
@ -419,7 +444,9 @@ setup(
|
|||||||
'build': my_build,
|
'build': my_build,
|
||||||
'build_i18n': my_build_i18n,
|
'build_i18n': my_build_i18n,
|
||||||
'build_icons': my_build_icons,
|
'build_icons': my_build_icons,
|
||||||
|
|
||||||
'sdist': sdist_auto,
|
'sdist': sdist_auto,
|
||||||
|
'install': my_install,
|
||||||
'install_egg_info': my_egg_info,
|
'install_egg_info': my_egg_info,
|
||||||
|
|
||||||
'configure': configure,
|
'configure': configure,
|
||||||
|
@ -44,7 +44,7 @@ __version__ = "0.9.4"
|
|||||||
|
|
||||||
|
|
||||||
# We should map this into the config somehow but I question if anyone cares
|
# We should map this into the config somehow but I question if anyone cares
|
||||||
prefix = "/usr"
|
prefix = _get_param("prefix", "/usr")
|
||||||
gettext_dir = os.path.join(prefix, "share", "locale")
|
gettext_dir = os.path.join(prefix, "share", "locale")
|
||||||
if os.getcwd() == _srcdir:
|
if os.getcwd() == _srcdir:
|
||||||
asset_dir = _srcdir
|
asset_dir = _srcdir
|
||||||
|
Loading…
Reference in New Issue
Block a user