~pieq/checkbox/add-30suspend-1reboot-cycles-support

2496.1.5 by Zygmunt Krynicki
setup.py: add top-level multiplexing setup.py
1
#!/usr/bin/env python3
2
# This file is part of Checkbox.
3
#
4
# Copyright 2012 Canonical Ltd.
5
# Written by:
6
#   Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
7
#
8
# Checkbox is free software: you can redistribute it and/or modify
2530.1.7 by Daniel Manrique
setup.py: Changed header mentioning GPLv3 or later to just GPLv3
9
# it under the terms of the GNU General Public License version 3,
10
# as published by the Free Software Foundation.
2496.1.5 by Zygmunt Krynicki
setup.py: add top-level multiplexing setup.py
11
#
12
# Checkbox is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
19
20
"""
21
setup.py multiplexer
22
====================
23
24
This `setup.py` is really a multiplexer to various setup.py files (for
25
plainbox, checkbox-ng, etc). It was implemented because readthedocs.org cannot
26
handle many projects in one repository correctly.
27
"""
2516.1.6 by Sylvain Pineau
setup.py: Include checkbox-old and all the providers to the multiplexer
28
import glob
2496.1.5 by Zygmunt Krynicki
setup.py: add top-level multiplexing setup.py
29
import os
30
import subprocess
31
import sys
32
2808.1.14 by Zygmunt Krynicki
support: don't multiplex to checkbox-old
33
delegate_to = ['plainbox', 'checkbox-ng', 'checkbox-support']
2516.1.6 by Sylvain Pineau
setup.py: Include checkbox-old and all the providers to the multiplexer
34
delegate_to.extend(glob.glob('plainbox-provider*'))
2496.1.5 by Zygmunt Krynicki
setup.py: add top-level multiplexing setup.py
35
try:
36
    base = os.path.dirname(__file__)
37
    for target_dir in delegate_to:
38
        # NOTE: use sys.executable because 'python' and 'python3' resolve to
39
        # non-virtualenv (!) versions of python when building on
40
        # readthedocs.org
41
        cmd = [sys.executable, 'setup.py'] + sys.argv[1:]
42
        cwd = os.path.join(base, target_dir)
43
        subprocess.check_call(cmd, cwd=cwd)
44
except subprocess.CalledProcessError as exc:
2748.1.3 by Zygmunt Krynicki
setup.py: print the directory when delegated setup fails
45
    raise SystemExit("{} in {}".format(exc, cwd))