-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
executable file
·83 lines (72 loc) · 2.32 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
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
import errno
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from no_async import __doc__, __version__
project_directory = os.path.abspath(os.path.dirname(__file__))
readme_path = os.path.join(project_directory, 'README.rst')
readme_file = open(readme_path)
try:
long_description = readme_file.read()
finally:
readme_file.close()
def bdist_wheel_tag_check(tag, args=sys.argv):
if 'bdist_wheel' not in args:
return False
if '--python-tag' in args and tag in args:
return True
if ('--python-tag=' + tag) in args:
return True
return False
if 'sdist' in sys.argv:
# When building a source distribution, include all variants:
modules = ['normal', 'no_positional_only_arguments', 'no_async']
else:
# When not building a source distribution, we select
# just the file for the matching Python version:
modules = ['compose']
path_setup_py_uses = os.path.join(project_directory, 'compose.py')
if bdist_wheel_tag_check('py38'):
source_file = 'normal.py'
elif bdist_wheel_tag_check('py35'):
source_file = 'no_positional_only_arguments.py'
elif bdist_wheel_tag_check('py2.py30'):
source_file = 'no_async.py'
elif sys.version_info >= (3, 8):
source_file = 'normal.py'
elif sys.version_info >= (3, 5):
source_file = 'no_positional_only_arguments.py'
else:
source_file = 'no_async.py'
source_path = os.path.join(project_directory, source_file)
try:
os.unlink(path_setup_py_uses)
except OSError as error:
if error.errno != errno.ENOENT:
raise
try:
link = os.link
except AttributeError:
link = os.symlink
link(source_path, path_setup_py_uses)
setup(
name='compose',
version=__version__,
description=__doc__.split('\n')[0],
long_description=long_description,
license='0BSD',
url='https://github.com/mentalisttraceur/python-compose',
author='Alexander Kozhevnikov',
author_email='[email protected]',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 2',
'Operating System :: OS Independent',
],
py_modules=modules,
)