Total Complexity | 4 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
2 | # encoding: utf-8 |
||
3 | """ |
||
4 | setup.py |
||
5 | |||
6 | Created by Thomas Mangin on 2011-01-24. |
||
7 | Copyright (c) 2009-2017 Exa Networks. All rights reserved. |
||
8 | """ |
||
9 | |||
10 | import importlib |
||
11 | import platform |
||
12 | import os |
||
13 | import sys |
||
14 | import setuptools |
||
15 | from distutils.core import setup |
||
16 | |||
17 | # from setuptools.config import read_configuration |
||
18 | # conf_dict = read_configuration('./setup.cfg', find_others=True) |
||
19 | |||
20 | sys.path.append(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'lib/exabgp')) |
||
21 | exabgp_version = importlib.import_module('version') |
||
22 | |||
23 | |||
24 | def filesOf(directory): |
||
25 | files = [] |
||
26 | for l, d, fs in os.walk(directory): |
||
27 | if not d: |
||
28 | for f in fs: |
||
29 | files.append(os.path.join(l, f)) |
||
30 | return files |
||
31 | |||
32 | |||
33 | data_files = [ |
||
34 | ('etc/exabgp/examples', filesOf('etc/exabgp')), |
||
35 | ] |
||
36 | |||
37 | if platform.system() != 'NetBSD': |
||
38 | if sys.argv[-1] == 'systemd': |
||
39 | data_files.append(('/usr/lib/systemd/system', filesOf('etc/systemd'))) |
||
40 | |||
41 | if 'systemd' in sys.argv: |
||
42 | if os.path.exists('/usr/lib/systemd/system'): |
||
43 | data_files.append(('/usr/lib/systemd/system', filesOf('etc/systemd'))) |
||
44 | if os.path.exists('/lib/systemd/system'): |
||
45 | data_files.append(('/lib/systemd/system', filesOf('etc/systemd'))) |
||
46 | |||
47 | setuptools.setup( |
||
48 | download_url='https://github.com/Exa-Networks/exabgp/archive/%s.tar.gz' % exabgp_version.version.split('-')[0], |
||
49 | data_files=data_files, |
||
50 | ) |
||
51 |