From f2da85c65ff6ba5cfae698db7d8174f402789986 Mon Sep 17 00:00:00 2001 From: Paul Larson Date: Fri, 10 Feb 2023 10:16:07 -0600 Subject: [PATCH] Convert from setup.py to pyproject --- README.rst | 2 +- pyproject.toml | 24 +++++++++++++++++++++++- setup.py | 21 +++------------------ tox.ini | 2 +- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/README.rst b/README.rst index 58ad977d..b207f451 100644 --- a/README.rst +++ b/README.rst @@ -24,7 +24,7 @@ To install it in a virtual environment: $ virtualenv -p python3 env $ . env/bin/activate - $ ./setup install + $ pip install . Usage diff --git a/pyproject.toml b/pyproject.toml index a8f43fef..1b2ba197 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,24 @@ +[build-system] +requires = [ + "setuptools", + "setuptools-scm", +] +build-backend = "setuptools.build_meta" + +[project] +name = "testflinger-cli" +description = "Testflinger CLI" +readme = "README.rst" +dependencies = [ + "PyYAML", + "requests", + "xdg<5.2", +] +dynamic = ["version"] + +[project.scripts] +testflinger-cli = "testflinger_cli:cli" +testflinger = "testflinger_cli:cli" + [tool.black] -line-length = 79 +line-length = 79 \ No newline at end of file diff --git a/setup.py b/setup.py index 02351a03..77b2fc18 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -#!/usr/bin/env python -# Copyright (C) 2017-2020 Canonical +#!/usr/bin/env python3 +# Copyright (C) 2017-2023 Canonical # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,19 +16,4 @@ # from setuptools import setup -INSTALL_REQUIRES = ["pyyaml", "requests", "xdg<5.2"] - -setup( - name="testflinger-cli", - version="0.1", - description="CLI tool for working with testflinger", - packages=["testflinger_cli"], - zip_safe=False, - install_requires=INSTALL_REQUIRES, - test_suite="testflinger_cli.tests", - entry_points=""" - [console_scripts] - testflinger-cli=testflinger_cli:cli - testflinger=testflinger_cli:cli - """, -) +setup() diff --git a/tox.ini b/tox.ini index 87ba5bee..2ba286ad 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ deps = pytest-cov requests-mock commands = - {envbindir}/python setup.py develop + {envbindir}/pip install . {envbindir}/python -m black --check setup.py testflinger-cli testflinger_cli {envbindir}/python -m flake8 setup.py testflinger_cli {envbindir}/python -m pylint testflinger_cli