author Jérémy Bobbio <>
Tue, 04 Jun 2019 11:53:03 +0200
changeset 862 942ef0731f4c
parent 840 bc3db19a8a53
child 870 4e54f0b7946f
permissions -rw-r--r--
Update Debian packaging Various improvements to Debian packaging: - Depend on python-yapps and python3-yapps for YAPPS runtime. - Use PYBUILD_NAME instead of debian/*.install files. - Use python3-sphinx instead of obsolete Python 2 version. - Always build Python 3 package. - Run tests at build time and adds relevant packages to Build-Depends. - Add superficial autopkgtest using autodep8. - Add autopkgtest script to run unittest against installed packages. - Add Vcs-Hg and Vcs-Browser fields. - Update Standards-Version to 4.3.0. In order to run the tests at build time and with autopkgtest, they need to be made part of the Python source package. The manifest has been modified accordingly.

#!/usr/bin/env python
# pylint: disable-msg=W0404,W0622,W0704,W0613,E0611,C0103
# copyright 2004-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact --
# This file is part of rql.
# rql 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.
# rql 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 rql. If not, see <>.
"""Generic Setup script, takes package info from file.

from setuptools import setup, find_packages
from setuptools.command import build_ext
from io import open
import os
import os.path as osp
import sys

here = osp.abspath(osp.dirname(__file__))

pkginfo = {}
with open(osp.join(here, '')) as f:
    exec(, pkginfo)

# Get the long description from the relevant file
with open(osp.join(here, 'README'), encoding='utf-8') as f:
    long_description =

kwargs = {}
if 'subpackage_of' in pkginfo:
    kwargs['namespace_packages'] = [pkginfo['subpackage_of']],

if os.environ.get('RQL_FORCE_GECODE'):
    MyBuildExt = build_ext.build_ext
    class MyBuildExt(build_ext.build_ext):
        """Extend build_ext command to pass through compilation error.
        In fact, if gecode extension fail, rql will use logilab.constraint

        def run(self):
            except Exception:
                import traceback
                                 'The compilation of the gecode C extension failed. '
                                 'rql will use logilab.constraint which is a pure '
                                 'python implementation. '
                                 'Please note that the C extension run faster. '
                                 'So, install a compiler then install rql again with'
                                 ' the "force" option for better performance.\n'

    name=pkginfo.get('distname', pkginfo['modname']),
    # See
    classifiers=pkginfo.get('classifiers', []),
    packages=find_packages(exclude=['contrib', 'docs', 'test*']),
    scripts=pkginfo.get('scripts', []),
    cmdclass={'build_ext': MyBuildExt},