injector/setup.py

74 lines
1.9 KiB
Python
Raw Normal View History

from setuptools import setup, Command
2010-11-25 14:33:37 +00:00
import sys
import warnings
warnings.filterwarnings("always", module=__name__)
2012-11-19 04:19:52 +00:00
class PyTest(Command):
user_options = []
2012-11-19 04:19:52 +00:00
def initialize_options(self):
pass
2012-11-19 04:19:52 +00:00
def finalize_options(self):
pass
2012-11-19 04:19:52 +00:00
def run(self):
import subprocess
errno = subprocess.call([sys.executable, '-m', 'pytest'])
raise SystemExit(errno)
def read_injector_variable(name):
prefix = '%s = ' % (name,)
with open('injector/__init__.py') as f:
for line in f:
if line.startswith(prefix):
return line.replace(prefix, '').strip().strip("'")
raise AssertionError('variable %s not found' % (name,))
version = read_injector_variable('__version__')
version_tag = read_injector_variable('__version_tag__')
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except ImportError:
warnings.warn('Could not locate pandoc, using Markdown long_description.', ImportWarning)
with open('README.md') as f:
long_description = f.read()
2010-11-25 14:33:37 +00:00
description = long_description.splitlines()[0].strip()
setup(
name='injector',
2020-02-05 10:19:43 +00:00
url='https://github.com/alecthomas/injector',
download_url='https://pypi.org/project/injector/',
2010-11-25 14:33:37 +00:00
version=version,
options=dict(egg_info=dict(tag_build=version_tag)),
2010-11-25 14:33:37 +00:00
description=description,
long_description=long_description,
license='BSD',
platforms=['any'],
packages=['injector'],
package_data={'injector': ['py.typed']},
2010-11-25 14:33:37 +00:00
author='Alec Thomas',
author_email='alec@swapoff.org',
cmdclass={'test': PyTest},
2013-08-28 22:16:02 +00:00
keywords=[
'Dependency Injection',
'DI',
'Dependency Injection framework',
'Inversion of Control',
'IoC',
'Inversion of Control container',
2013-08-28 22:16:02 +00:00
],
install_requires=['typing_extensions>=3.7.4;python_version<"3.9"'],
2013-08-28 22:16:02 +00:00
)