python: use setuptools with python >= 3.12
[lttng-ust.git] / src / python-lttngust / setup.py.in
CommitLineData
de4dee04
PP
1# -*- coding: utf-8 -*-
2#
c0c0989a 3# SPDX-License-Identifier: LGPL-2.1-only
de4dee04 4#
c0c0989a 5# Copyright (C) 2015 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
de4dee04 6
a49a7e68
FD
7import os
8import sys
9
cb80e2fb
MJ
10if sys.version_info < (3, 12):
11 from distutils.core import setup, Extension
12else:
13 from setuptools import setup, Extension
de4dee04 14
a49a7e68
FD
15PY_PATH_WARN_MSG = """
16-------------------------------------WARNING------------------------------------
17The install directory used:\n ({0})\nis not included in your PYTHONPATH.
18
19To add this directory to your Python search path permanently you can add the
20following command to your .bashrc/.zshrc:
21 export PYTHONPATH="${{PYTHONPATH}}:{0}"
22--------------------------------------------------------------------------------
23"""
24
25def main():
26 dist = setup(name='lttngust',
27 version='@PACKAGE_VERSION@',
28 description='LTTng-UST Python agent',
29 packages=['lttngust'],
30 package_dir={'lttngust': 'lttngust'},
31 options={'build': {'build_base': 'build'}},
32 url='http://lttng.org',
33 license='LGPL-2.1',
34 classifiers=[
35 'Development Status :: 5 - Production/Stable',
36 'Intended Audience :: Developers',
37 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
38 'Programming Language :: Python :: 2.7',
39 'Programming Language :: Python :: 3'
40 'Topic :: System :: Logging',
41 ])
42
43# After the installation, we check that the install directory is included in
44# the Python search path and we print a warning message when it's not. We need
45# to do this because Python search path differs depending on the distro and
46# some distros don't include any `/usr/local/` (the default install prefix) in
47# the search path. This is also useful for out-of-tree installs and tests. It's
48# only relevant to make this check on the `install` command.
49
50 if 'install' in dist.command_obj:
51 install_dir = dist.command_obj['install'].install_libbase
52 if install_dir not in sys.path:
53 # We can't consider this an error because if affects every
54 # distro differently. We only warn the user that some
55 # extra configuration is needed to use the agent
56 abs_install_dir = os.path.abspath(install_dir)
57 print(PY_PATH_WARN_MSG.format(abs_install_dir))
f92d03ee 58
a49a7e68
FD
59if __name__ == '__main__':
60 main()
This page took 0.03256 seconds and 4 git commands to generate.