2012-02-23 21:16:33 +00:00
|
|
|
from setuptools import setup, Command
|
2010-11-25 14:33:37 +00:00
|
|
|
import sys
|
2018-04-06 23:33:51 +00:00
|
|
|
import warnings
|
|
|
|
|
|
|
|
|
|
|
|
warnings.filterwarnings("always", module=__name__)
|
2010-11-27 13:27:26 +00:00
|
|
|
|
2012-11-19 04:19:52 +00:00
|
|
|
|
2012-02-23 21:16:33 +00:00
|
|
|
class PyTest(Command):
|
|
|
|
user_options = []
|
2012-11-19 04:19:52 +00:00
|
|
|
|
2012-02-23 21:16:33 +00:00
|
|
|
def initialize_options(self):
|
|
|
|
pass
|
2012-11-19 04:19:52 +00:00
|
|
|
|
2012-02-23 21:16:33 +00:00
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
2012-11-19 04:19:52 +00:00
|
|
|
|
2012-02-23 21:16:33 +00:00
|
|
|
def run(self):
|
2013-08-10 14:47:52 +00:00
|
|
|
import subprocess
|
2019-04-05 13:49:50 +00:00
|
|
|
|
2019-12-14 18:11:09 +00:00
|
|
|
errno = subprocess.call([sys.executable, '-m', 'pytest'])
|
2012-02-23 21:16:33 +00:00
|
|
|
raise SystemExit(errno)
|
|
|
|
|
|
|
|
|
2016-10-18 14:00:27 +00:00
|
|
|
def read_injector_variable(name):
|
|
|
|
prefix = '%s = ' % (name,)
|
2019-02-07 11:24:40 +00:00
|
|
|
with open('injector/__init__.py') as f:
|
2016-10-18 14:00:27 +00:00
|
|
|
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__')
|
2013-08-10 14:47:52 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
import pypandoc
|
2019-04-05 13:49:50 +00:00
|
|
|
|
2013-08-10 14:47:52 +00:00
|
|
|
long_description = pypandoc.convert('README.md', 'rst')
|
|
|
|
except ImportError:
|
2019-04-05 13:49:50 +00:00
|
|
|
warnings.warn('Could not locate pandoc, using Markdown long_description.', ImportWarning)
|
2018-04-06 23:23:10 +00:00
|
|
|
with open('README.md') as f:
|
|
|
|
long_description = f.read()
|
2013-08-10 14:47:52 +00:00
|
|
|
|
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,
|
2010-11-27 13:27:26 +00:00
|
|
|
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'],
|
2019-02-07 11:24:40 +00:00
|
|
|
packages=['injector'],
|
2019-04-05 13:49:50 +00:00
|
|
|
package_data={'injector': ['py.typed']},
|
2010-11-25 14:33:37 +00:00
|
|
|
author='Alec Thomas',
|
|
|
|
author_email='alec@swapoff.org',
|
2012-02-23 21:16:33 +00:00
|
|
|
cmdclass={'test': PyTest},
|
2013-08-28 22:16:02 +00:00
|
|
|
keywords=[
|
2019-04-05 13:49:50 +00:00
|
|
|
'Dependency Injection',
|
|
|
|
'DI',
|
|
|
|
'Dependency Injection framework',
|
|
|
|
'Inversion of Control',
|
|
|
|
'IoC',
|
|
|
|
'Inversion of Control container',
|
2013-08-28 22:16:02 +00:00
|
|
|
],
|
2020-02-12 13:17:21 +00:00
|
|
|
install_requires=['typing_extensions>=3.7.4;python_version<"3.9"'],
|
2013-08-28 22:16:02 +00:00
|
|
|
)
|