bt2: use format_bt_error and format_bt_error_cause to generate _Error and _ErrorCause...
[babeltrace.git] / src / bindings / python / bt2 / setup.py.in
CommitLineData
09ef660c
MJ
1# The MIT License (MIT)
2#
3# Copyright (C) 2017 - Francis Deslauriers <francis.deslauriers@efficios.com>
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21# THE SOFTWARE.
22
23import sys
24
25from distutils.core import setup, Extension
26
27PY_PATH_WARN_MSG = """
28-------------------------------------WARNING------------------------------------
29The install directory used:\n ({})\nis not included in your PYTHONPATH.
30
31To add this directory to your Python search path permanently you can add the
32following command to your .bashrc/.zshrc:
33 export PYTHONPATH="${{PYTHONPATH}}:{}"
34--------------------------------------------------------------------------------
35"""
36
61d96b89 37
09ef660c 38def main():
61d96b89
FD
39 babeltrace_ext = Extension(
40 'bt2._native_bt',
41 sources=['bt2/native_bt.c', '@srcdir@/bt2/logging.c'],
42 libraries=['babeltrace2', 'glib-2.0'],
43 extra_objects=[
94e72386 44 '@top_builddir@/src/autodisc/.libs/libbabeltrace2-autodisc.a',
61d96b89
FD
45 '@top_builddir@/src/logging/.libs/libbabeltrace2-logging.a',
46 '@top_builddir@/src/common/.libs/libbabeltrace2-common.a',
47 '@top_builddir@/src/py-common/.libs/libbabeltrace2-py-common.a',
7d30475f 48 '@top_builddir@/src/string-format/.libs/libbabeltrace2-string-format.a',
61d96b89
FD
49 ],
50 )
09ef660c 51
61d96b89
FD
52 dist = setup(
53 name='bt2',
54 version='@PACKAGE_VERSION@',
55 description='Babeltrace 2 Python Bindings',
56 packages=['bt2'],
57 package_dir={'bt2': 'bt2'},
58 options={
59 'build': {'build_base': 'build', 'build_lib': 'build/build_lib'},
60 'build_ext': {'build_lib': 'build/build_lib'},
61 },
62 url='http://diamon.org/babeltrace',
63 ext_modules=[babeltrace_ext],
64 license='MIT',
65 classifiers=[
66 'Development Status :: 5 - Production/Stable',
67 'Intended Audience :: Developers',
68 'License :: OSI Approved :: The MIT License',
69 'Programming Language :: Python :: 3' 'Topic :: System :: Logging',
70 ],
71 )
09ef660c 72
61d96b89
FD
73 # After the installation, we check that the install directory is included in
74 # the Python search path and we print a warning message when it's not.
75 # We need to do this because Python search path differs depending on the distro
76 # and some distros don't include any /usr/local/ in the search path. This is
77 # also useful for out-of-tree installs and tests.
78 # It's only relevant to make this check on the `install` command.
09ef660c
MJ
79
80 if 'install' in dist.command_obj:
81 install_dir = dist.command_obj['install'].install_libbase
82 if install_dir not in sys.path:
83 # We can't consider this an error because if affects every
84 # distro differently. We only warn the user that some
85 # extra configuration is needed to use the bindings
86 print(PY_PATH_WARN_MSG.format(install_dir, install_dir))
87
61d96b89 88
09ef660c
MJ
89if __name__ == "__main__":
90 main()
This page took 0.051285 seconds and 4 git commands to generate.