forked from rpm-py-installer/rpm-py-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
133 lines (104 loc) · 3.33 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
"""Classes to set up and install rpm-py-installer."""
import os
import sys
from distutils.cmd import Command
import setuptools
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install
from rpm_py_installer.version import VERSION
def install_rpm_py():
"""Install RPM Python binding."""
python_path = sys.executable
cmd = '{0} install.py'.format(python_path)
exit_status = os.system(cmd)
if exit_status != 0:
raise Exception('Command failed: {0}'.format(cmd))
class InstallCommand(install):
"""A class for "pip install".
Handled by "pip install rpm-py-installer",
when the package is published to PyPI as a source distribution (sdist).
"""
def run(self):
"""Run install process."""
install.run(self)
install_rpm_py()
class DevelopCommand(develop):
"""A class for setuptools development mode.
Handled by "pip install -e".
"""
def run(self):
"""Run install process with development mode."""
develop.run(self)
install_rpm_py()
class EggInfoCommand(egg_info):
"""A class for egg-info.
Handled by "pip install .".
"""
def run(self):
"""Run egg_info process."""
egg_info.run(self)
install_rpm_py()
class BdistWheelCommand(Command):
"""A class for "pip bdist_wheel".
Raise exception to always disable wheel cache.
See https://github.com/pypa/pip/issues/4720
"""
user_options = []
def initialize_options(self):
"""Initilize options.
Just extend the super class's abstract method.
"""
pass
def finalize_options(self):
"""Finalize options.
Just extend the super class's abstract method.
"""
pass
def run(self):
"""Run bdist_wheel process.
It raises error to make the method fail intentionally.
"""
raise Exception('bdist_wheel is not supported')
setuptools.setup(
name='rpm-py-installer',
version=VERSION,
license='MIT',
description='RPM Python binding Installer',
long_description='''
An installer to enable the RPM Python binding in any environment.
See "Homepage" on GitHub for detail.
''',
author='Jun Aruga',
author_email='[email protected]',
url='https://github.com/junaruga/rpm-py-installer',
packages=[
'rpm_py_installer',
],
# Keep install_requires empty to run install.py directly.
install_requires=[],
classifiers=[
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: System :: Installation/Setup',
],
scripts=[
'install.py',
],
cmdclass={
'install': InstallCommand,
'develop': DevelopCommand,
'egg_info': EggInfoCommand,
'bdist_wheel': BdistWheelCommand,
},
)