X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=python-lttngust%2Fsetup.py.in;h=1024d5725fae97932694f4454aba370e43e4bcb8;hb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;hp=7f21c5cf957f5cd9710aeb431deeebf49c2a56ee;hpb=5b6ff569c0bf82b72f263a259e7a73a453903648;p=lttng-ust.git diff --git a/python-lttngust/setup.py.in b/python-lttngust/setup.py.in index 7f21c5cf..1024d572 100644 --- a/python-lttngust/setup.py.in +++ b/python-lttngust/setup.py.in @@ -1,25 +1,57 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2015 - Jonathan Rajotte +# SPDX-License-Identifier: LGPL-2.1-only # -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library 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 Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# Copyright (C) 2015 Jonathan Rajotte + +import os +import sys from distutils.core import setup, Extension -setup(name='lttngust', - version='@PACKAGE_VERSION@', - description='Lttng ust agent', - packages=['lttngust'], - package_dir={'lttngust': 'lttngust'}, - options={'build': {'build_base': 'build'}}) +PY_PATH_WARN_MSG = """ +-------------------------------------WARNING------------------------------------ +The install directory used:\n ({0})\nis not included in your PYTHONPATH. + +To add this directory to your Python search path permanently you can add the +following command to your .bashrc/.zshrc: + export PYTHONPATH="${{PYTHONPATH}}:{0}" +-------------------------------------------------------------------------------- +""" + +def main(): + dist = setup(name='lttngust', + version='@PACKAGE_VERSION@', + description='LTTng-UST Python agent', + packages=['lttngust'], + package_dir={'lttngust': 'lttngust'}, + options={'build': {'build_base': 'build'}}, + url='http://lttng.org', + license='LGPL-2.1', + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3' + 'Topic :: System :: Logging', + ]) + +# After the installation, we check that the install directory is included in +# the Python search path and we print a warning message when it's not. We need +# to do this because Python search path differs depending on the distro and +# some distros don't include any `/usr/local/` (the default install prefix) in +# the search path. This is also useful for out-of-tree installs and tests. It's +# only relevant to make this check on the `install` command. + + if 'install' in dist.command_obj: + install_dir = dist.command_obj['install'].install_libbase + if install_dir not in sys.path: + # We can't consider this an error because if affects every + # distro differently. We only warn the user that some + # extra configuration is needed to use the agent + abs_install_dir = os.path.abspath(install_dir) + print(PY_PATH_WARN_MSG.format(abs_install_dir)) + +if __name__ == '__main__': + main()