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