File: setup.py.in

package info (click to toggle)
lxc 1%3A1.0.6-6
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 4,800 kB
  • sloc: ansic: 33,735; sh: 11,868; python: 1,223; makefile: 734
file content (57 lines) | stat: -rw-r--r-- 2,188 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/python3
#
# python-lxc: Python bindings for LXC
#
# (C) Copyright Canonical Ltd. 2012
#
# Authors:
# St├ęphane Graber <stgraber@ubuntu.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
# USA

import os, os.path
from distutils.core import setup, Extension

# Distutils doesn't cope well with source files that have relative paths going
# up in the directory tree: it tries to navigate outside of the build dir and
# fails miserably. Therefore, we will instead cd to the source directory,
# run this script from there, but write the build products to the correct path.
#
# Since we will be changing directories before building, we must transform
# all the path variables to their forms relative to srcdir.

srcdir, builddir, top_srcdir, top_builddir = map(os.path.abspath,
    ["@srcdir@", "@builddir@", "@top_srcdir@", "@top_builddir@"])

builddir, top_srcdir, top_builddir = map(lambda d: os.path.relpath(d, srcdir),
    [builddir, top_srcdir, top_builddir])

os.chdir(srcdir)

module = Extension('_lxc', sources=['lxc.c'],
                   include_dirs=[os.path.join(top_srcdir, 'src'),
                                 os.path.join(top_builddir, 'src')],
                   library_dirs=[os.path.join(top_builddir, 'src/lxc')],
                   libraries=['lxc'])


setup(name='_lxc',
      version='0.1',
      description='LXC',
      packages=['lxc'],
      package_dir={'lxc': 'lxc'},
      ext_modules=[module],
      options={'build': {'build_base': os.path.join(builddir, 'build')}})