direct-io.hg

changeset 14259:7f0d8e3c538e

Move ptsname module under tools/python.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Mon Mar 05 18:54:26 2007 +0000 (2007-03-05)
parents 53589c343d46
children e5a0dd445e41
files tools/Makefile tools/ptsname/Makefile tools/ptsname/ptsname.c tools/ptsname/setup.py tools/python/ptsname/ptsname.c tools/python/setup.py
line diff
     1.1 --- a/tools/Makefile	Mon Mar 05 18:10:41 2007 +0000
     1.2 +++ b/tools/Makefile	Mon Mar 05 18:54:26 2007 +0000
     1.3 @@ -26,7 +26,6 @@ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
     1.4  ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
     1.5  SUBDIRS-y += python
     1.6  SUBDIRS-y += pygrub
     1.7 -SUBDIRS-y += ptsname
     1.8  endif
     1.9  
    1.10  .PHONY: all
     2.1 --- a/tools/ptsname/Makefile	Mon Mar 05 18:10:41 2007 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,22 +0,0 @@
     2.4 -
     2.5 -XEN_ROOT = ../..
     2.6 -include $(XEN_ROOT)/tools/Rules.mk
     2.7 -
     2.8 -.PHONY: all
     2.9 -all: build
    2.10 -.PHONY: build
    2.11 -build:
    2.12 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
    2.13 -
    2.14 -.PHONY: install
    2.15 -ifndef XEN_PYTHON_NATIVE_INSTALL
    2.16 -install: all
    2.17 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix=""
    2.18 -else
    2.19 -install: all
    2.20 -	CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)"
    2.21 -endif
    2.22 -
    2.23 -.PHONY: clean
    2.24 -clean:
    2.25 -	rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out
     3.1 --- a/tools/ptsname/ptsname.c	Mon Mar 05 18:10:41 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,44 +0,0 @@
     3.4 -/******************************************************************************
     3.5 - * ptsname.c
     3.6 - * 
     3.7 - * A python extension to expose the POSIX ptsname() function.
     3.8 - * 
     3.9 - * Copyright (C) 2007 XenSource Ltd
    3.10 - */
    3.11 -
    3.12 -#include <Python.h>
    3.13 -#include <stdlib.h>
    3.14 -
    3.15 -/* Needed for Python versions earlier than 2.3. */
    3.16 -#ifndef PyMODINIT_FUNC
    3.17 -#define PyMODINIT_FUNC DL_EXPORT(void)
    3.18 -#endif
    3.19 -
    3.20 -static PyObject *do_ptsname(PyObject *self, PyObject *args)
    3.21 -{
    3.22 -    int fd;
    3.23 -    char *path;
    3.24 -
    3.25 -    if (!PyArg_ParseTuple(args, "i", &fd))
    3.26 -        return NULL;
    3.27 -
    3.28 -    path = ptsname(fd);
    3.29 -
    3.30 -    if (!path)
    3.31 -    {
    3.32 -        PyErr_SetFromErrno(PyExc_IOError);
    3.33 -        return NULL;
    3.34 -    } 
    3.35 -
    3.36 -    return PyString_FromString(path);
    3.37 -}
    3.38 -
    3.39 -static PyMethodDef ptsname_methods[] = { 
    3.40 -    { "ptsname", do_ptsname, METH_VARARGS }, 
    3.41 -    { NULL }
    3.42 -};
    3.43 -
    3.44 -PyMODINIT_FUNC initptsname(void)
    3.45 -{
    3.46 -    Py_InitModule("ptsname", ptsname_methods);
    3.47 -}
     4.1 --- a/tools/ptsname/setup.py	Mon Mar 05 18:10:41 2007 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,11 +0,0 @@
     4.4 -from distutils.core import setup, Extension
     4.5 -
     4.6 -extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
     4.7 -
     4.8 -setup(name         = 'ptsname',
     4.9 -      version      = '1.0',
    4.10 -      description  = 'POSIX ptsname() function',
    4.11 -      author       = 'Tim Deegan',
    4.12 -      author_email = 'Tim.Deegan@xensource.com',
    4.13 -      license      = 'GPL',
    4.14 -      ext_modules  = [ Extension("ptsname", [ "ptsname.c" ]) ])
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/python/ptsname/ptsname.c	Mon Mar 05 18:54:26 2007 +0000
     5.3 @@ -0,0 +1,44 @@
     5.4 +/******************************************************************************
     5.5 + * ptsname.c
     5.6 + * 
     5.7 + * A python extension to expose the POSIX ptsname() function.
     5.8 + * 
     5.9 + * Copyright (C) 2007 XenSource Ltd
    5.10 + */
    5.11 +
    5.12 +#include <Python.h>
    5.13 +#include <stdlib.h>
    5.14 +
    5.15 +/* Needed for Python versions earlier than 2.3. */
    5.16 +#ifndef PyMODINIT_FUNC
    5.17 +#define PyMODINIT_FUNC DL_EXPORT(void)
    5.18 +#endif
    5.19 +
    5.20 +static PyObject *do_ptsname(PyObject *self, PyObject *args)
    5.21 +{
    5.22 +    int fd;
    5.23 +    char *path;
    5.24 +
    5.25 +    if (!PyArg_ParseTuple(args, "i", &fd))
    5.26 +        return NULL;
    5.27 +
    5.28 +    path = ptsname(fd);
    5.29 +
    5.30 +    if (!path)
    5.31 +    {
    5.32 +        PyErr_SetFromErrno(PyExc_IOError);
    5.33 +        return NULL;
    5.34 +    } 
    5.35 +
    5.36 +    return PyString_FromString(path);
    5.37 +}
    5.38 +
    5.39 +static PyMethodDef ptsname_methods[] = { 
    5.40 +    { "ptsname", do_ptsname, METH_VARARGS }, 
    5.41 +    { NULL }
    5.42 +};
    5.43 +
    5.44 +PyMODINIT_FUNC initptsname(void)
    5.45 +{
    5.46 +    Py_InitModule("ptsname", ptsname_methods);
    5.47 +}
     6.1 --- a/tools/python/setup.py	Mon Mar 05 18:10:41 2007 +0000
     6.2 +++ b/tools/python/setup.py	Mon Mar 05 18:54:26 2007 +0000
     6.3 @@ -44,7 +44,14 @@ acm = Extension("acm",
     6.4                 libraries          = libraries,
     6.5                 sources            = [ "xen/lowlevel/acm/acm.c" ])
     6.6  
     6.7 -modules = [ xc, xs, acm ]
     6.8 +ptsname = Extension("ptsname",
     6.9 +               extra_compile_args = extra_compile_args,
    6.10 +               include_dirs       = include_dirs + [ "ptsname" ],
    6.11 +               library_dirs       = library_dirs,
    6.12 +               libraries          = libraries,
    6.13 +               sources            = [ "ptsname/ptsname.c" ])
    6.14 +
    6.15 +modules = [ xc, xs, acm, ptsname ]
    6.16  if os.uname()[0] == 'SunOS':
    6.17      modules.append(scf)
    6.18