Skip to content

Commit d34486b

Browse files
committed
change: use pyproject.toml instead of setup.py
1 parent ccd8c72 commit d34486b

File tree

2 files changed

+73
-118
lines changed

2 files changed

+73
-118
lines changed

pyproject.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[build-system]
2+
requires = ["setuptools>=64"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "esptool"
7+
authors = [
8+
{name = "Fredrik Ahlberg (themadinventor)"},
9+
{name = "Angus Gratton (projectgus)"},
10+
{name = "Espressif Systems"}
11+
]
12+
readme = {file = "README.md", content-type = "text/markdown"}
13+
license = {text = "GPLv2+"}
14+
description = "A serial utility to communicate & flash code to Espressif chips."
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Intended Audience :: Developers",
18+
"Natural Language :: English",
19+
"Operating System :: POSIX",
20+
"Operating System :: Microsoft :: Windows",
21+
"Operating System :: MacOS :: MacOS X",
22+
"Topic :: Software Development :: Embedded Systems",
23+
"Environment :: Console",
24+
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
]
32+
requires-python = ">=3.7"
33+
dynamic = ["version", "scripts"]
34+
35+
dependencies = [
36+
"bitstring>=3.1.6",
37+
"cryptography>=2.1.4",
38+
"ecdsa>=0.16.0",
39+
"pyserial>=3.3",
40+
"reedsolo>=1.5.3,<1.8",
41+
"PyYAML>=5.1",
42+
"intelhex",
43+
]
44+
45+
[project.urls]
46+
Homepage = "https://github.com/espressif/esptool/"
47+
Documentation = "https://docs.espressif.com/projects/esptool/"
48+
Source = "https://github.com/espressif/esptool/"
49+
Tracker = "https://github.com/espressif/esptool/issues/"
50+
Changelog = "https://github.com/espressif/esptool/blob/master/CHANGELOG.md"
51+
52+
[project.optional-dependencies]
53+
dev = [
54+
"pyelftools",
55+
"coverage~=6.0",
56+
"pre-commit",
57+
"pytest",
58+
"pytest-rerunfailures",
59+
"requests",
60+
"commitizen",
61+
]
62+
hsm = ["python-pkcs11"]
63+
64+
[tool.setuptools]
65+
include-package-data = true
66+
67+
[tool.setuptools.package-data]
68+
"*" = ["esptool/targets/stub_flasher/*.json"]
69+
70+
[tool.setuptools.packages]
71+
find = {exclude = ["ci", "flasher_stub", "test", "docs"]}

setup.py

Lines changed: 2 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
1-
# SPDX-FileCopyrightText: 2014-2023 Fredrik Ahlberg, Angus Gratton,
2-
# Espressif Systems (Shanghai) CO LTD, other contributors as noted.
3-
#
4-
# SPDX-License-Identifier: GPL-2.0-or-later
5-
6-
import io
71
import os
8-
import re
9-
import sys
10-
11-
try:
12-
from setuptools import find_packages, setup
13-
except ImportError:
14-
print(
15-
"Package setuptools is missing from your Python installation. "
16-
"Please see the installation section in the esptool documentation"
17-
" for instructions on how to install it."
18-
)
19-
sys.exit(1)
20-
21-
22-
# Example code to pull version from esptool module with regex, taken from
23-
# https://packaging.python.org/en/latest/guides/single-sourcing-package-version/
24-
def read(*names, **kwargs):
25-
with io.open(
26-
os.path.join(os.path.dirname(__file__), *names),
27-
encoding=kwargs.get("encoding", "utf8"),
28-
) as fp:
29-
return fp.read()
30-
31-
32-
def find_version(*file_paths):
33-
version_file = read(*file_paths)
34-
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
35-
if version_match:
36-
return version_match.group(1)
37-
raise RuntimeError("Unable to find version string.")
38-
2+
from setuptools import setup
393

404
if os.name != "nt":
415
scripts = ["esptool.py", "espefuse.py", "espsecure.py", "esp_rfc2217_server.py"]
@@ -51,87 +15,7 @@ def find_version(*file_paths):
5115
],
5216
}
5317

54-
55-
long_description = """
56-
==========
57-
esptool.py
58-
==========
59-
A Python-based, open-source, platform-independent utility to communicate with \
60-
the ROM bootloader in Espressif chips.
61-
62-
The esptool.py project is `hosted on github <https://github.com/espressif/esptool>`_.
63-
64-
Documentation
65-
-------------
66-
Visit online `esptool documentation <https://docs.espressif.com/projects/esptool/>`_ \
67-
or run ``esptool.py -h``.
68-
69-
Contributing
70-
------------
71-
Please see the `contributions guide \
72-
<https://docs.espressif.com/projects/esptool/en/latest/contributing.html>`_.
73-
"""
74-
7518
setup(
76-
name="esptool",
77-
version=find_version("esptool/__init__.py"),
78-
description="A serial utility to communicate & flash code to Espressif chips.",
79-
long_description=long_description,
80-
url="https://github.com/espressif/esptool/",
81-
project_urls={
82-
"Documentation": "https://docs.espressif.com/projects/esptool/",
83-
"Source": "https://github.com/espressif/esptool/",
84-
"Tracker": "https://github.com/espressif/esptool/issues/",
85-
},
86-
author="Fredrik Ahlberg (themadinventor) & Angus Gratton (projectgus) "
87-
"& Espressif Systems",
88-
author_email="",
89-
license="GPLv2+",
90-
classifiers=[
91-
"Development Status :: 5 - Production/Stable",
92-
"Intended Audience :: Developers",
93-
"Natural Language :: English",
94-
"Operating System :: POSIX",
95-
"Operating System :: Microsoft :: Windows",
96-
"Operating System :: MacOS :: MacOS X",
97-
"Topic :: Software Development :: Embedded Systems",
98-
"Environment :: Console",
99-
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
100-
"Programming Language :: Python :: 3.7",
101-
"Programming Language :: Python :: 3.8",
102-
"Programming Language :: Python :: 3.9",
103-
"Programming Language :: Python :: 3.10",
104-
"Programming Language :: Python :: 3.11",
105-
"Programming Language :: Python :: 3.12",
106-
],
107-
python_requires=">=3.7",
108-
setup_requires=(["wheel"] if "bdist_wheel" in sys.argv else []),
109-
extras_require={
110-
"dev": [
111-
"pyelftools",
112-
"coverage~=6.0",
113-
"pre-commit",
114-
"pytest",
115-
"pytest-rerunfailures",
116-
"requests",
117-
"commitizen",
118-
],
119-
"hsm": [
120-
"python-pkcs11",
121-
],
122-
},
123-
install_requires=[
124-
"bitstring>=3.1.6",
125-
"cryptography>=2.1.4",
126-
"ecdsa>=0.16.0",
127-
"pyserial>=3.3",
128-
"reedsolo>=1.5.3,<1.8",
129-
"PyYAML>=5.1",
130-
"intelhex",
131-
],
132-
packages=find_packages(),
133-
include_package_data=True,
134-
package_data={"": ["esptool/targets/stub_flasher/*.json"]},
135-
entry_points=entry_points,
13619
scripts=scripts,
20+
entry_points=entry_points,
13721
)

0 commit comments

Comments
 (0)