mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-08-02 04:21:59 +03:00
setup.py: Move module list building to its own function
Makes it a bit more clear what all that code is used for, rather than intermixing it with function definitions. Besides the comment additions, this is a no-op and just reindents the block, into a function.
This commit is contained in:
95
setup.py
95
setup.py
@ -72,49 +72,59 @@ def get_api_xml_files():
|
|||||||
|
|
||||||
return (libvirt_api, libvirt_qemu_api, libvirt_lxc_api)
|
return (libvirt_api, libvirt_qemu_api, libvirt_lxc_api)
|
||||||
|
|
||||||
ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False)
|
def get_module_lists():
|
||||||
cflags = get_pkgconfig_data(["--cflags"], "libvirt", False)
|
"""
|
||||||
|
Determine which modules we are actually building, and all their
|
||||||
|
required config
|
||||||
|
"""
|
||||||
|
c_modules = []
|
||||||
|
py_modules = []
|
||||||
|
ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False)
|
||||||
|
cflags = get_pkgconfig_data(["--cflags"], "libvirt", False)
|
||||||
|
|
||||||
c_modules = []
|
module = Extension('libvirtmod',
|
||||||
py_modules = []
|
sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'],
|
||||||
|
libraries = [ "virt" ],
|
||||||
module = Extension('libvirtmod',
|
|
||||||
sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'],
|
|
||||||
libraries = [ "virt" ],
|
|
||||||
include_dirs = [ "." ])
|
|
||||||
if cflags != "":
|
|
||||||
module.extra_compile_args.append(cflags)
|
|
||||||
if ldflags != "":
|
|
||||||
module.extra_link_args.append(ldflags)
|
|
||||||
|
|
||||||
c_modules.append(module)
|
|
||||||
py_modules.append("libvirt")
|
|
||||||
|
|
||||||
moduleqemu = Extension('libvirtmod_qemu',
|
|
||||||
sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'],
|
|
||||||
libraries = [ "virt-qemu" ],
|
|
||||||
include_dirs = [ "." ])
|
include_dirs = [ "." ])
|
||||||
if cflags != "":
|
|
||||||
moduleqemu.extra_compile_args.append(cflags)
|
|
||||||
if ldflags != "":
|
|
||||||
moduleqemu.extra_link_args.append(ldflags)
|
|
||||||
|
|
||||||
c_modules.append(moduleqemu)
|
|
||||||
py_modules.append("libvirt_qemu")
|
|
||||||
|
|
||||||
if have_libvirt_lxc:
|
|
||||||
modulelxc = Extension('libvirtmod_lxc',
|
|
||||||
sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'],
|
|
||||||
libraries = [ "virt-lxc" ],
|
|
||||||
include_dirs = [ "." ])
|
|
||||||
if cflags != "":
|
if cflags != "":
|
||||||
modulelxc.extra_compile_args.append(cflags)
|
module.extra_compile_args.append(cflags)
|
||||||
if ldflags != "":
|
if ldflags != "":
|
||||||
modulelxc.extra_link_args.append(ldflags)
|
module.extra_link_args.append(ldflags)
|
||||||
|
|
||||||
c_modules.append(modulelxc)
|
c_modules.append(module)
|
||||||
py_modules.append("libvirt_lxc")
|
py_modules.append("libvirt")
|
||||||
|
|
||||||
|
moduleqemu = Extension('libvirtmod_qemu',
|
||||||
|
sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'],
|
||||||
|
libraries = [ "virt-qemu" ],
|
||||||
|
include_dirs = [ "." ])
|
||||||
|
if cflags != "":
|
||||||
|
moduleqemu.extra_compile_args.append(cflags)
|
||||||
|
if ldflags != "":
|
||||||
|
moduleqemu.extra_link_args.append(ldflags)
|
||||||
|
|
||||||
|
c_modules.append(moduleqemu)
|
||||||
|
py_modules.append("libvirt_qemu")
|
||||||
|
|
||||||
|
if have_libvirt_lxc:
|
||||||
|
modulelxc = Extension('libvirtmod_lxc',
|
||||||
|
sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'],
|
||||||
|
libraries = [ "virt-lxc" ],
|
||||||
|
include_dirs = [ "." ])
|
||||||
|
if cflags != "":
|
||||||
|
modulelxc.extra_compile_args.append(cflags)
|
||||||
|
if ldflags != "":
|
||||||
|
modulelxc.extra_link_args.append(ldflags)
|
||||||
|
|
||||||
|
c_modules.append(modulelxc)
|
||||||
|
py_modules.append("libvirt_lxc")
|
||||||
|
|
||||||
|
return c_modules, py_modules
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# Custom commands #
|
||||||
|
###################
|
||||||
|
|
||||||
class my_build(build):
|
class my_build(build):
|
||||||
|
|
||||||
@ -281,14 +291,21 @@ class my_clean(clean):
|
|||||||
if os.path.exists("build"):
|
if os.path.exists("build"):
|
||||||
remove_tree("build")
|
remove_tree("build")
|
||||||
|
|
||||||
|
|
||||||
|
##################
|
||||||
|
# Invoke setup() #
|
||||||
|
##################
|
||||||
|
|
||||||
|
_c_modules, _py_modules = get_module_lists()
|
||||||
|
|
||||||
setup(name = 'libvirt-python',
|
setup(name = 'libvirt-python',
|
||||||
version = '1.2.3',
|
version = '1.2.3',
|
||||||
url = 'http://www.libvirt.org',
|
url = 'http://www.libvirt.org',
|
||||||
maintainer = 'Libvirt Maintainers',
|
maintainer = 'Libvirt Maintainers',
|
||||||
maintainer_email = 'libvir-list@redhat.com',
|
maintainer_email = 'libvir-list@redhat.com',
|
||||||
description = 'The libvirt virtualization API',
|
description = 'The libvirt virtualization API',
|
||||||
ext_modules = c_modules,
|
ext_modules = _c_modules,
|
||||||
py_modules = py_modules,
|
py_modules = _py_modules,
|
||||||
package_dir = {
|
package_dir = {
|
||||||
'': 'build'
|
'': 'build'
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user