mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
so we can report the Xend version number as opposed to Xen's version number. Signed-off-by: Alastair Tse <atse@xensource.com>
100 lines
3.2 KiB
Python
100 lines
3.2 KiB
Python
#!/usr/bin/python
|
|
|
|
from distutils.core import setup, Extension
|
|
import os
|
|
|
|
XEN_TOOLS_VERSION = '3.0.4'
|
|
|
|
def embed_version():
|
|
""" Embed Mercurial Changeset Version in xen/__init__.py. """
|
|
try:
|
|
import commands
|
|
import re
|
|
output = commands.getoutput('hg tip')
|
|
version = XEN_TOOLS_VERSION
|
|
changeset = ''
|
|
date = ''
|
|
if output:
|
|
for line in output.split('\n'):
|
|
is_changeset = re.search(r'^changeset:\s*(.*)$', line)
|
|
if is_changeset:
|
|
changeset = is_changeset.group(1)
|
|
is_date = re.search(r'^date:\s*(.*)$', line)
|
|
if is_date:
|
|
date = is_date.group(1)
|
|
|
|
xen_init = open('xen/__init__.py', 'w')
|
|
xen_init.write('# Warning, this file is autogenerated by setup.py\n')
|
|
if version and changeset and date:
|
|
xen_init.write('VERSION = "%s-%s (%s)"\n' %
|
|
(version, changeset, date))
|
|
else:
|
|
xen_init.write('VERSION = "%s"\n' % version)
|
|
xen_init.close()
|
|
except:
|
|
print 'Warning: Unable to extract version.'
|
|
|
|
XEN_ROOT = "../.."
|
|
|
|
extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
|
|
|
|
|
|
include_dirs = [ XEN_ROOT + "/tools/libxc",
|
|
XEN_ROOT + "/tools/xenstore",
|
|
]
|
|
|
|
library_dirs = [ XEN_ROOT + "/tools/libxc",
|
|
XEN_ROOT + "/tools/xenstore",
|
|
]
|
|
|
|
libraries = [ "xenctrl", "xenguest", "xenstore" ]
|
|
|
|
xc = Extension("xc",
|
|
extra_compile_args = extra_compile_args,
|
|
include_dirs = include_dirs + [ "xen/lowlevel/xc" ],
|
|
library_dirs = library_dirs,
|
|
libraries = libraries,
|
|
sources = [ "xen/lowlevel/xc/xc.c" ])
|
|
|
|
xs = Extension("xs",
|
|
extra_compile_args = extra_compile_args,
|
|
include_dirs = include_dirs + [ "xen/lowlevel/xs" ],
|
|
library_dirs = library_dirs,
|
|
libraries = libraries,
|
|
sources = [ "xen/lowlevel/xs/xs.c" ])
|
|
|
|
acm = Extension("acm",
|
|
extra_compile_args = extra_compile_args,
|
|
include_dirs = include_dirs + [ "xen/lowlevel/acm" ],
|
|
library_dirs = library_dirs,
|
|
libraries = libraries,
|
|
sources = [ "xen/lowlevel/acm/acm.c" ])
|
|
|
|
|
|
embed_version()
|
|
|
|
setup(name = 'xen',
|
|
version = XEN_TOOLS_VERSION,
|
|
description = 'Xen',
|
|
packages = ['xen',
|
|
'xen.lowlevel',
|
|
'xen.util',
|
|
'xen.xend',
|
|
'xen.xend.server',
|
|
'xen.xend.xenstore',
|
|
'xen.xm',
|
|
'xen.web',
|
|
'xen.sv',
|
|
|
|
'xen.xend.tests',
|
|
'xen.xend.server.tests',
|
|
'xen.xend.xenstore.tests',
|
|
'xen.xm.tests'
|
|
],
|
|
ext_package = "xen.lowlevel",
|
|
ext_modules = [ xc, xs, acm ]
|
|
)
|
|
|
|
os.chdir('logging')
|
|
execfile('setup.py')
|