python: use setuptools with python >= 3.12
[lttng-ust.git] / python-lttngust / setup.py.in
CommitLineData
de4dee04
PP
1# -*- coding: utf-8 -*-
2#
bf261856 3# Copyright (C) 2015 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
de4dee04
PP
4#
5# This library is free software; you can redistribute it and/or modify it under
6# the terms of the GNU Lesser General Public License as published by the Free
7# Software Foundation; version 2.1 of the License.
8#
9# This library is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12# details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this library; if not, write to the Free Software Foundation, Inc.,
16# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
a49a7e68
FD
18import os
19import sys
20
f8cee41d
MJ
21if sys.version_info < (3, 12):
22 from distutils.core import setup, Extension
23else:
24 from setuptools import setup, Extension
de4dee04 25
a49a7e68
FD
26PY_PATH_WARN_MSG = """
27-------------------------------------WARNING------------------------------------
28The install directory used:\n ({0})\nis not included in your PYTHONPATH.
29
30To add this directory to your Python search path permanently you can add the
31following command to your .bashrc/.zshrc:
32 export PYTHONPATH="${{PYTHONPATH}}:{0}"
33--------------------------------------------------------------------------------
34"""
35
36def main():
37 dist = setup(name='lttngust',
38 version='@PACKAGE_VERSION@',
39 description='LTTng-UST Python agent',
40 packages=['lttngust'],
41 package_dir={'lttngust': 'lttngust'},
42 options={'build': {'build_base': 'build'}},
43 url='http://lttng.org',
44 license='LGPL-2.1',
45 classifiers=[
46 'Development Status :: 5 - Production/Stable',
47 'Intended Audience :: Developers',
48 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
49 'Programming Language :: Python :: 2.7',
50 'Programming Language :: Python :: 3'
51 'Topic :: System :: Logging',
52 ])
53
54# After the installation, we check that the install directory is included in
55# the Python search path and we print a warning message when it's not. We need
56# to do this because Python search path differs depending on the distro and
57# some distros don't include any `/usr/local/` (the default install prefix) in
58# the search path. This is also useful for out-of-tree installs and tests. It's
59# only relevant to make this check on the `install` command.
60
61 if 'install' in dist.command_obj:
62 install_dir = dist.command_obj['install'].install_libbase
63 if install_dir not in sys.path:
64 # We can't consider this an error because if affects every
65 # distro differently. We only warn the user that some
66 # extra configuration is needed to use the agent
67 abs_install_dir = os.path.abspath(install_dir)
68 print(PY_PATH_WARN_MSG.format(abs_install_dir))
f92d03ee 69
a49a7e68
FD
70if __name__ == '__main__':
71 main()
This page took 0.028715 seconds and 4 git commands to generate.