-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·73 lines (60 loc) · 2.44 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
import setuptools
NAME = 'pyoslog'
about = {}
working_directory = os.path.join(os.path.abspath(os.path.dirname(__file__)), NAME)
with open(os.path.join(working_directory, '__version__.py')) as version_file:
exec(version_file.read(), about)
with open('README.md') as readme_file:
readme = readme_file.read()
# see compatibility.py - allow installation on older versions (or other OSs) but provide is_supported() at runtime
compatibility_module_name = 'compatibility'
compatibility_module_path = os.path.join(working_directory, '%s.py' % compatibility_module_name)
try:
# noinspection PyUnresolvedReferences
import importlib.util
spec = importlib.util.spec_from_file_location(compatibility_module_name, compatibility_module_path)
compatibility = importlib.util.module_from_spec(spec)
spec.loader.exec_module(compatibility)
except ImportError:
import imp
compatibility = imp.load_source(compatibility_module_name, compatibility_module_path)
ext_modules = []
# noinspection PyUnresolvedReferences
if compatibility.is_supported():
ext_modules.append(setuptools.Extension('_' + NAME, ['%s/_%s.c' % (NAME, NAME)]))
# https://setuptools.pypa.io/en/latest/references/keywords.html or https://docs.python.org/3/distutils/apiref.html
setuptools.setup(
name=NAME,
version=about['__version__'],
description=about['__description__'],
long_description=readme,
long_description_content_type='text/markdown',
author=about['__author__'],
author_email=about['__author_email__'],
url=about['__url__'],
project_urls={
'Documentation': 'https://pyoslog.readthedocs.io/',
'Bug Tracker': '%s/issues' % about['__url__'],
'Source Code': about['__url__'],
},
# 3.6+ for core.py constants inline type hints, but not enabled because we support installation on earlier versions
# python_requires='>=3.6',
platforms=['darwin'],
packages=[NAME],
ext_modules=ext_modules,
package_data={'': ['LICENSE']},
include_package_data=True,
license=about['__license__'],
classifiers=[
'Operating System :: MacOS',
'Programming Language :: Python',
'Programming Language :: C',
'Topic :: Software Development',
'Topic :: System :: Logging',
'Typing :: Typed',
'Intended Audience :: Developers',
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: Apache Software License'
]
)