aboutsummaryrefslogtreecommitdiff
path: root/python/eapi.cc
blob: 23a714a6ca47393cfdfe5a2d74fd817020e8f700 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

/*
 * Copyright (c) 2007 Piotr Jaroszyński <peper@gentoo.org>
 *
 * This file is part of the Paludis package manager. Paludis is free software;
 * you can redistribute it and/or modify it under the terms of the GNU General
 * Public License version 2, as published by the Free Software Foundation.
 *
 * Paludis 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 General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <paludis_python.hh>

#include <paludis/eapi.hh>

using namespace paludis;
using namespace paludis::python;
namespace bp = boost::python;

void PALUDIS_VISIBLE expose_eapi()
{
    /**
     * SupportedEAPI
     */
    register_shared_ptrs_to_python<SupportedEAPI>();
    bp::class_<SupportedEAPI, boost::noncopyable>
        (
         "SupportedEAPI",
         "Information about a supported EAPI.",
         bp::no_init
        )
        .def_readonly("package_dep_spec_parse_mode", &SupportedEAPI::package_dep_spec_parse_mode,
                "[ro] PackageDepSpecParseMode"
                )

        .def_readonly("strict_package_dep_spec_parse_mode", &SupportedEAPI::strict_package_dep_spec_parse_mode,
                "[ro] PackageDepSpecParseMode"
                )

        .def_readonly("iuse_flag_parse_mode", &SupportedEAPI::iuse_flag_parse_mode,
                "[ro] IUseFlagParseMode"
                )

        .def_readonly("strict_iuse_flag_parse_mode", &SupportedEAPI::strict_iuse_flag_parse_mode,
                "[ro] IUseFlagParseMode"
                )

        .def_readonly("breaks_portage", &SupportedEAPI::breaks_portage,
                "[ro] bool"
                )
        ;

    /**
     * EAPI
     */
    register_shared_ptrs_to_python<EAPI>();
    bp::class_<EAPI, boost::noncopyable>
        ("EAPI",
         "Information about an EAPI.",
         bp::no_init
        )
        .def_readonly("name", &EAPI::name,
                "[ro] str"
                )

        .add_property("supported", bp::make_getter(&EAPI::supported,
                    bp::return_value_policy<bp::return_by_value>()),
                "[ro] SupportedEAPI"
                )
        ;

    /**
     * EAPIData
     */
    bp::class_<EAPIData, boost::noncopyable>
        (
         "EAPIData",
         "Holds information on recognised EAPIs.",
         bp::no_init
        )
        .add_static_property("instance", bp::make_function(&EAPIData::get_instance,
                    bp::return_value_policy<bp::reference_existing_object>()),
                "Singleton instance."
                )

        .def("eapi_from_string", &EAPIData::eapi_from_string,
                "eapi_from_string(str) -> EAPI\n"
                "Make an EAPI."
            )

        .def("unknown_eapi", &EAPIData::unknown_eapi,
                "unknown_eapi() -> EAPI\n"
                "Make the unknown EAPI."
            )
        ;
}