1#!/usr/bin/env python
2
3# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
4# See LICENSE.txt for complete terms.
5
6from io import open  # Allow `encoding` kwarg on Python 2.7
7from os.path import abspath, dirname, join
8
9
10from setuptools import setup, find_packages
11
12BASE_DIR = dirname(abspath(__file__))
13VERSION_FILE = join(BASE_DIR, 'stix', 'version.py')
14
15
16def get_version():
17    with open(VERSION_FILE) as f:
18        for line in f.readlines():
19            if line.startswith("__version__"):
20                version = line.split()[-1].strip('"')
21                return version
22        raise AttributeError("Package does not have a __version__")
23
24
25def get_long_description():
26    with open('README.rst', encoding='utf-8') as f:
27        return f.read()
28
29
30install_requires = [
31    'lxml>=2.2.3 ; python_version == "2.7" or python_version >= "3.5"',
32    'lxml>=2.2.3,<4.4.0 ; python_version > "2.7" and python_version < "3.5"',
33    'mixbox>=1.0.4',
34    'cybox>=2.1.0.13,<2.1.1.0',
35    'python-dateutil',
36]
37
38
39setup(
40    name="stix",
41    version=get_version(),
42    author="STIX Project, MITRE Corporation",
43    author_email="stix@mitre.org",
44    description="An API for parsing and generating STIX content.",
45    long_description=get_long_description(),
46    url="https://stixproject.github.io/",
47    packages=find_packages(),
48    install_requires=install_requires,
49    license="BSD",
50    classifiers=[
51        'Development Status :: 5 - Production/Stable',
52        'Intended Audience :: Developers',
53        'License :: OSI Approved :: BSD License',
54        'Operating System :: OS Independent',
55        'Programming Language :: Python :: 2',
56        'Programming Language :: Python :: 2.7',
57        'Programming Language :: Python :: 3',
58        'Programming Language :: Python :: 3.4',
59        'Programming Language :: Python :: 3.5',
60        'Programming Language :: Python :: 3.6',
61        'Programming Language :: Python :: 3.7',
62        'Programming Language :: Python :: 3.8',
63    ],
64    project_urls={
65        'Documentation': 'https://stix.readthedocs.io/',
66        'Source Code': 'https://github.com/STIXProject/python-stix/',
67        'Bug Tracker': 'https://github.com/STIXProject/python-stix/issues/',
68    },
69)
70