From 5190ddc46566986d61024e61936600ae12e90c07 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mar 03 2020 01:07:51 +0000 Subject: Simplify and modernize setup.py, drop setup.py test support This drops the `python setup.py test` support (which is more or less considered unnecessary and useless these days), and also the --nodeps stuff, which we shouldn't need now we're much more heavily Python 3-only (and don't use fedmsg any more). Signed-off-by: Adam Williamson --- diff --git a/setup.py b/setup.py index 9bf1c65..e444a98 100644 --- a/setup.py +++ b/setup.py @@ -1,46 +1,11 @@ -import os -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 = '' - self.test_suite = 'tests' - - def run_tests(self): - #import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args.split()) - sys.exit(errno) - -# Utility function to read the README file. -# Used for the long_description. It's nice, because now 1) we have a top level -# README file and 2) it's easier to type in the README file than to put a raw -# string in below. Stolen from -# https://pythonhosted.org/an_example_pypi_project/setuptools.html -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - -# this is sloppy and wrong, see https://stackoverflow.com/a/4792601 -# discussion, but should be okay for our purposes. the problem here -# is that if you run 'python3 setup.py install' with all the install -# requires in place, setuptools installs scripts from several of the -# deps to /usr/local/bin , overriding the system copies in /usr/bin. -# This seems to happen when the copy in /usr/bin is for Python 2 not -# Python 3 - e.g. because /usr/bin/fedmsg-logger is Python 2, if you -# do 'python3 setup.py install' here, due to the fedmsg dep, you get -# a /usr/local/bin/fedmsg-logger which is Python 3...we want to be -# able to avoid this, so hack up a 'no deps' -if "--nodeps" in sys.argv: - INSTALLREQS = [] - sys.argv.remove("--nodeps") -else: - INSTALLREQS = open('install.requires').read().splitlines() +# 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="fedora_openqa", @@ -58,10 +23,10 @@ setup( url="https://pagure.io/fedora-qa/fedora_openqa", packages=["fedora_openqa"], package_dir={"": "src"}, - install_requires=INSTALLREQS, - tests_require=open('tests.requires').read().splitlines(), - cmdclass={'test': PyTest}, - long_description=read('README.md'), + install_requires=open('install.requires').read().splitlines(), + python_requires="!=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4", + long_description=LONGDESC, + long_description_content_type='text/markdown', classifiers=[ "Development Status :: 5 - Production/Stable", "Topic :: Utilities",