|
Packit |
130fc8 |
#!/usr/bin/env python
|
|
Packit |
130fc8 |
# encoding: utf-8
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
# Copyright © 2016 Collabora Ltd. <http://www.collabora.co.uk/>
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# Permission is hereby granted, free of charge, to any person
|
|
Packit |
130fc8 |
# obtaining a copy of this software and associated documentation
|
|
Packit |
130fc8 |
# files (the "Software"), to deal in the Software without
|
|
Packit |
130fc8 |
# restriction, including without limitation the rights to use, copy,
|
|
Packit |
130fc8 |
# modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
Packit |
130fc8 |
# of the Software, and to permit persons to whom the Software is
|
|
Packit |
130fc8 |
# furnished to do so, subject to the following conditions:
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# The above copyright notice and this permission notice shall be
|
|
Packit |
130fc8 |
# included in all copies or substantial portions of the Software.
|
|
Packit |
130fc8 |
#
|
|
Packit |
130fc8 |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
Packit |
130fc8 |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Packit |
130fc8 |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
Packit |
130fc8 |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
Packit |
130fc8 |
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
Packit |
130fc8 |
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
Packit |
130fc8 |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
Packit |
130fc8 |
# DEALINGS IN THE SOFTWARE.
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
from distutils.dir_util import copy_tree, mkpath
|
|
Packit |
130fc8 |
from distutils.file_util import copy_file
|
|
Packit |
130fc8 |
from setuptools.dist import Distribution
|
|
Packit |
130fc8 |
from setuptools import setup, Extension
|
|
Packit |
130fc8 |
import os
|
|
Packit |
130fc8 |
import subprocess
|
|
Packit |
130fc8 |
import sys
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
if os.path.exists('.version'):
|
|
Packit |
130fc8 |
version = open('.version').read().strip()
|
|
Packit |
130fc8 |
else:
|
|
Packit |
130fc8 |
version = subprocess.check_output(['autoconf', '--trace', 'AC_INIT:$2',
|
|
Packit |
130fc8 |
'configure.ac']).decode('utf-8').strip()
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
class Build(Distribution().get_command_class('build')):
|
|
Packit |
130fc8 |
"""Dummy version of distutils build which runs an Autotools build system
|
|
Packit |
130fc8 |
instead.
|
|
Packit |
130fc8 |
"""
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
def run(self):
|
|
Packit |
130fc8 |
srcdir = os.getcwd()
|
|
Packit |
130fc8 |
builddir = os.path.join(srcdir, self.build_temp)
|
|
Packit |
130fc8 |
configure = os.path.join(srcdir, 'configure')
|
|
Packit |
130fc8 |
mkpath(builddir)
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
if not os.path.exists(configure):
|
|
Packit |
130fc8 |
configure = os.path.join(srcdir, 'autogen.sh')
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
subprocess.check_call([
|
|
Packit |
130fc8 |
configure,
|
|
Packit |
130fc8 |
'--disable-maintainer-mode',
|
|
Packit |
130fc8 |
'PYTHON=' + sys.executable,
|
|
Packit |
130fc8 |
# Put the documentation, etc. out of the way: we only want
|
|
Packit |
130fc8 |
# the Python code and extensions
|
|
Packit |
130fc8 |
'--prefix=' + os.path.join(builddir, 'prefix'),
|
|
Packit |
130fc8 |
],
|
|
Packit |
130fc8 |
cwd=builddir)
|
|
Packit |
130fc8 |
make_args = [
|
|
Packit |
130fc8 |
'pythondir=' + os.path.join(srcdir, self.build_lib),
|
|
Packit |
130fc8 |
'pyexecdir=' + os.path.join(srcdir, self.build_lib),
|
|
Packit |
130fc8 |
]
|
|
Packit |
130fc8 |
subprocess.check_call(['make', '-C', builddir] + make_args)
|
|
Packit |
130fc8 |
subprocess.check_call(['make', '-C', builddir, 'install'] + make_args)
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
class BuildExt(Distribution().get_command_class('build_ext')):
|
|
Packit |
130fc8 |
def run(self):
|
|
Packit |
130fc8 |
pass
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
class BuildPy(Distribution().get_command_class('build_py')):
|
|
Packit |
130fc8 |
def run(self):
|
|
Packit |
130fc8 |
pass
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
dbus_bindings = Extension('_dbus_bindings',
|
|
Packit |
130fc8 |
sources=['_dbus_bindings/module.c'])
|
|
Packit |
130fc8 |
dbus_glib_bindings = Extension('_dbus_glib_bindings',
|
|
Packit |
130fc8 |
sources=['_dbus_glib_bindings/module.c'])
|
|
Packit |
130fc8 |
|
|
Packit |
130fc8 |
setup(
|
|
Packit |
130fc8 |
name='dbus-python',
|
|
Packit |
130fc8 |
version=version,
|
|
Packit |
130fc8 |
description='Python bindings for libdbus',
|
|
Packit |
130fc8 |
maintainer='The D-Bus maintainers',
|
|
Packit |
130fc8 |
maintainer_email='dbus@lists.freedesktop.org',
|
|
Packit |
130fc8 |
download_url='http://dbus.freedesktop.org/releases/dbus-python/',
|
|
Packit |
130fc8 |
url='http://www.freedesktop.org/wiki/Software/DBusBindings/#python',
|
|
Packit |
130fc8 |
packages=['dbus'],
|
|
Packit |
130fc8 |
ext_modules=[dbus_bindings, dbus_glib_bindings],
|
|
Packit |
130fc8 |
license='Expat (MIT/X11)',
|
|
Packit |
130fc8 |
classifiers=[
|
|
Packit |
130fc8 |
'Development Status :: 7 - Inactive',
|
|
Packit |
130fc8 |
'License :: OSI Approved :: MIT License',
|
|
Packit |
130fc8 |
'Programming Language :: C',
|
|
Packit |
130fc8 |
'Programming Language :: Python :: 2',
|
|
Packit |
130fc8 |
'Programming Language :: Python :: 3',
|
|
Packit |
130fc8 |
'Programming Language :: Python :: Implementation :: CPython',
|
|
Packit |
130fc8 |
'Topic :: Software Development :: Object Brokering',
|
|
Packit |
130fc8 |
],
|
|
Packit |
130fc8 |
cmdclass={
|
|
Packit |
130fc8 |
'build': Build,
|
|
Packit |
130fc8 |
'build_py': BuildPy,
|
|
Packit |
130fc8 |
'build_ext': BuildExt,
|
|
Packit |
130fc8 |
},
|
|
Packit |
130fc8 |
)
|