From 0f36ff36d54d4e26ff6e72f85a38b93662ccdd5c Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 12 2020 17:19:41 +0000 Subject: Modernize and simplify setup.py Drop support for `setup.py test`, simplify long description generation, setuptools-git dep moved to pyproject.toml. Signed-off-by: Adam Williamson --- diff --git a/setup.py b/setup.py index cb085f3..f03daa7 100644 --- a/setup.py +++ b/setup.py @@ -17,32 +17,14 @@ """Setuptools script.""" -import sys -from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand +from os import path +from setuptools import setup +HERE = path.abspath(path.dirname(__file__)) -class PyTest(TestCommand): - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = [] - - def run_tests(self): - #import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) - -# From: https://github.com/pypa/pypi-legacy/issues/148 -# Produce rst-formatted long_description if pypandoc is available (to -# look nice on pypi), otherwise just use the Markdown-formatted one -try: - import pypandoc - longdesc = pypandoc.convert('README.md', 'rst') -except ImportError: - longdesc = open('README.md').read() +# Get the long description from the README file +with open(path.join(HERE, 'README.md'), encoding='utf-8') as f: + LONGDESC = f.read() setup( name="wikitcms", @@ -55,13 +37,10 @@ setup( url="https://pagure.io/fedora-qa/python-wikitcms", packages=["wikitcms"], package_dir={"": "src"}, - setup_requires=[ - 'setuptools_git', - ], install_requires=open('install.requires').read().splitlines(), tests_require=open('tests.requires').read().splitlines(), - cmdclass={'test': PyTest}, - long_description=longdesc, + long_description=LONGDESC, + long_description_content_type='text/markdown', classifiers=[ "Development Status :: 5 - Production/Stable", "Topic :: Utilities",