~ubuntu-branches/ubuntu/precise/python-lzma/precise

« back to all changes in this revision

Viewing changes to .pc/594919-py27-linkage-fix/setup.py

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-06 13:28:35 UTC
  • Revision ID: james.westby@ubuntu.com-20110606132835-gq6jef8eo1asxwgj
Tags: 0.5.3-1ubuntu2
Revert back to Debian source, LP 594919 was a bug in python2.7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- coding: utf-8 -*-
3
 
#
4
 
# Python Bindings for libLZMA
5
 
#
6
 
# Copyright (c) 2008 Per Øyvind Karlsen <peroyvind@mandriva.org>
7
 
# liblzma Copyright (C) 2007-2008  Lasse Collin
8
 
# LZMA SDK Copyright (C) 1999-2007 Igor Pavlov
9
 
#
10
 
# This library is free software; you can redistribute it and/or
11
 
# modify it under the terms of the GNU Lesser General Public
12
 
# License as published by the Free Software Foundation; either
13
 
# version 3 of the License, or (at your option) any later version.
14
 
#
15
 
# This library is distributed in the hope that it will be useful,
16
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
 
# Lesser General Public License for more details.
19
 
#
20
 
# You should have received a copy of the GNU Lesser General Public
21
 
# License along with this library; if not, write to the Free Software
22
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 
#
24
 
import sys, os, subprocess
25
 
from warnings import warn
26
 
from setuptools import setup, Extension
27
 
 
28
 
descr = "Python bindings for liblzma"
29
 
long_descr = """PylibLZMA provides a python interface for the liblzma library
30
 
to read and write data that has been compressed or can be decompressed
31
 
by Lasse Collin's xz / lzma utils."""
32
 
version = '0.5.3'
33
 
version_define = [('VERSION', '"%s"' % version)]
34
 
 
35
 
# FIXME: Probably some nicer way to do this
36
 
if 'sdist' in sys.argv:
37
 
    os.system('bzr log . > ChangeLog')
38
 
modules = ['liblzma']
39
 
c_files = ['liblzma.c', 'liblzma_compressobj.c', 'liblzma_decompressobj.c', 'liblzma_file.c', 'liblzma_fileobj.c', 'liblzma_options.c', 'liblzma_util.c']
40
 
for i in xrange(len(c_files)):
41
 
    c_files[i] = os.path.join('src', c_files[i])
42
 
 
43
 
compile_args = []
44
 
warnflags = ['-Wall', '-Wextra', '-pedantic', '-Wswitch-enum', '-Wswitch-default']
45
 
compile_args.extend(warnflags)
46
 
link_args = []
47
 
if not subprocess.Popen('touch gnu99-test.c; gcc -std=gnu99 -E gnu99-test.c > /dev/null; rm -f gnu99-test.c',
48
 
                shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True).stdout.read():
49
 
    compile_args.append('-std=gnu99')
50
 
 
51
 
pc_cflags = subprocess.Popen("pkg-config --cflags liblzma", shell=True, stdout=subprocess.PIPE, close_fds=True).stdout.readline().strip()
52
 
if(pc_cflags):
53
 
        compile_args.extend(pc_cflags.split(' '))
54
 
pc_libs = subprocess.Popen("pkg-config --libs liblzma", shell=True, stdout=subprocess.PIPE, close_fds=True).stdout.readline().strip()
55
 
if(pc_libs):
56
 
        link_args.extend(pc_libs.split(' '))
57
 
 
58
 
extens=[Extension('lzma', c_files, extra_compile_args=compile_args, extra_link_args=link_args, define_macros=version_define)]
59
 
 
60
 
setup(
61
 
    name = "pyliblzma",
62
 
    version = version,
63
 
    description = descr,
64
 
    author = "Per Øyvind Karlsen",
65
 
    author_email = "peroyvind@mandriva.org",
66
 
    url = "https://launchpad.net/pyliblzma",
67
 
    license = 'LGPL 3 ',
68
 
    keywords = "xz lzma compression",
69
 
    long_description = long_descr,
70
 
    platforms = sys.platform,
71
 
    classifiers = [
72
 
        'Development Status :: 4 - Beta',
73
 
        'Programming Language :: Python',
74
 
        'Topic :: Software Development :: Libraries :: Python Modules',
75
 
        'Intended Audience :: Developers',
76
 
        'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
77
 
        'Operating System :: POSIX :: Linux'
78
 
    ],
79
 
    py_modules = modules,
80
 
    ext_modules = extens,
81
 
    test_suite = 'tests',
82
 
)
83
 
 
84
 
sys.exit(0)