From 7ac772bc970d4773b551a7d55e010f4953efd283 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Tue, 19 Mar 2024 01:02:54 +0530 Subject: [PATCH] Switch to pyproject.toml Since PEP 621, pyproject.toml is the standard way of specifying project metadata. This patch simply migrates everything in setup.py to pyproject.toml Link: https://peps.python.org/pep-0621/ PEP 621 Signed-off-by: Ayush Singh --- .gitignore | 4 +++ cc2538_bsl/__init__.py | 0 cc2538-bsl.py => cc2538_bsl/cc2538_bsl.py | 5 ++- pyproject.toml | 41 +++++++++++++++++++++-- setup.py | 36 -------------------- 5 files changed, 47 insertions(+), 39 deletions(-) create mode 100644 cc2538_bsl/__init__.py rename cc2538-bsl.py => cc2538_bsl/cc2538_bsl.py (99%) delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 531dcc4..940a159 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.py[cod] *$py.class +*.egg-info # C extensions *.so @@ -16,3 +17,6 @@ htmlcov/ nosetests.xml coverage.xml *,cover + +# venv +.venv diff --git a/cc2538_bsl/__init__.py b/cc2538_bsl/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cc2538-bsl.py b/cc2538_bsl/cc2538_bsl.py similarity index 99% rename from cc2538-bsl.py rename to cc2538_bsl/cc2538_bsl.py index 2f0370e..df27aaa 100755 --- a/cc2538-bsl.py +++ b/cc2538_bsl/cc2538_bsl.py @@ -1064,7 +1064,7 @@ def cli_setup(): return parser.parse_args() -if __name__ == "__main__": +def main_cli(): args = cli_setup() force_speed = False @@ -1263,3 +1263,6 @@ def cli_setup(): if QUIET >= 10: traceback.print_exc() exit('ERROR: %s' % str(err)) + +if __name__ == "__main__": + main_cli() diff --git a/pyproject.toml b/pyproject.toml index ebd25cd..55bf026 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,47 @@ [build-system] requires = [ "setuptools>=60", - "setuptools-scm>=8.0"] + "setuptools-scm>=8.0" +] build-backend = "setuptools.build_meta" [project] name = "cc2538-bsl" -dynamic = ["version", "description", "readme", "requires-python", "license", "authors", "keywords", "classifiers", "dependencies", "optional-dependencies"] +description="Script to communicate with Texas Instruments CC13xx/CC2538/CC26xx Serial Boot Loader ." +keywords=[ "cc2538", "cc1310", "cc13xx", "bootloader", "cc26xx", "cc2650", "cc2640" ] +authors = [ { name = "Jelmer Tiete", email = "jelmer@tiete.be" } ] +readme = "README.md" +license = { file = "LICENSE.md" } +classifiers=[ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering", +] +requires-python = ">=3.4" +dynamic = ["version"] +dependencies = [ "pyserial" ] + +[project.urls] +Home = "https://github.com/JelmerT/cc2538-bsl" +Repository = "https://github.com/JelmerT/cc2538-bsl" +Issues = "https://github.com/JelmerT/cc2538-bsl/issues" + [tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "node-and-date" + +[project.optional-dependencies] +cc2538-bsl = [ "intelhex" ] +intelhex = [ "python-magic" ] + +[project.scripts] +cc2538-bsl = "cc2538_bsl.cc2538_bsl:main_cli" +# cc2538-bsl = "cc2538-bsl.py" + +[tool.setuptools] +platforms = ["posix"] diff --git a/setup.py b/setup.py deleted file mode 100644 index bec084b..0000000 --- a/setup.py +++ /dev/null @@ -1,36 +0,0 @@ -from setuptools import setup - - -setup( - name="cc2538-bsl", - description="Script to communicate with Texas Instruments CC13xx/CC2538/CC26xx Serial Boot Loader .", - long_description=open("README.md", encoding="utf-8").read(), - keywords="cc2538, cc1310, cc13xx, bootloader, cc26xx, cc2650, cc2640", - url="https://github.com/JelmerT/cc2538-bsl", - author="Jelmer Tiete", - author_email="jelmer@tiete.be", - license="BSD-3-Clause", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", - "Operating System :: POSIX :: Linux", - "Operating System :: MacOS", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering", - ], - platforms="posix", - python_requires=">=3.4", - setup_requires=["setuptools_scm"], - use_scm_version=lambda: { - "version_scheme": "post-release", - "local_scheme": "node-and-date", - }, - install_requires=["pyserial"], - extras_require={ - 'cc2538-bsl': ["intelhex"], - 'intelhex': ["python-magic"] - }, - scripts=["cc2538-bsl.py"], -)