Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pyocd/_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from __future__ import annotations

import zipfile
from pathlib import Path

from setuptools.command.build_py import build_py as _build_py
from setuptools.command.sdist import sdist as _sdist


def _ensure_svd_zip() -> None:
script_dir = Path(__file__).resolve().parent
svd_dir_path = script_dir / "debug" / "svd"
svd_data_dir_path = svd_dir_path / "data"
svd_zip_path = svd_dir_path / "svd_data.zip"

if svd_data_dir_path.exists():
with zipfile.ZipFile(svd_zip_path, "w", zipfile.ZIP_DEFLATED) as svd_zip:
for svd_file in sorted(svd_data_dir_path.iterdir()):
if svd_file.is_file():
svd_zip.write(svd_file, svd_file.name)
elif not svd_zip_path.exists():
raise RuntimeError(
"neither the source SVD data directory nor built svd_data.zip exist",
)


class build_py(_build_py):
def run(self) -> None:
_ensure_svd_zip()
super().run()


class sdist(_sdist):
def run(self) -> None:
_ensure_svd_zip()
super().run()
119 changes: 117 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,130 @@
requires = [
"setuptools>=51",
"wheel",
"setuptools_scm[toml]>=6.0,<7.0; python_version < \"3.7\"",
"setuptools_scm[toml]>=7.0; python_version >= \"3.7\"",
"setuptools_scm>=7.0",
]
build-backend = "setuptools.build_meta"

[project]
name = "pyocd"
description = "Cortex-M debugger for Python"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "Apache-2.0" }
maintainers = [
{ name = "Chris Reed", email = "[email protected]" },
]
keywords = ["embedded", "debug", "debugger", "arm", "gdb", "gdbserver", "flash", "test"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Manufacturing",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: POSIX :: BSD",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development",
"Topic :: Software Development :: Debuggers",
"Topic :: Software Development :: Embedded Systems",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
]
dynamic = ["version"]
dependencies = [
"capstone>=5.0,<6.0",
"cmsis-pack-manager>=0.5.2,<1.0",
"colorama<1.0",
"hidapi>=0.10.1,<1.0; platform_system != 'Linux'",
"importlib_metadata>=3.6",
"importlib_resources",
"intelhex>=2.0,<3.0",
"intervaltree>=3.0.2,<4.0",
"lark>=1.1.5,<2.0",
"libusb-package>=1.0,<2.0",
"natsort>=8.0.0,<9.0",
"prettytable>=2.0,<4.0",
"pyelftools<1.0",
"pylink-square>=1.0,<2.0",
"pyusb>=1.2.1,<2.0",
"pyyaml>=6.0,<7.0",
"six>=1.15.0,<2.0",
"typing-extensions>=4.0,<5.0",
]

[project.optional-dependencies]
pemicro = [
"pyocd_pemicro>=1.0.6",
]
test = [
"pytest>=6.2",
"pytest-cov",
"coverage",
"flake8",
"pylint",
"tox",
]

[project.scripts]
pyocd = "pyocd.__main__:main"
pyocd-gdbserver = "pyocd.tools.gdb_server:main"

[project.entry-points."pyocd.probe"]
cmsisdap = "pyocd.probe.cmsis_dap_probe:CMSISDAPProbePlugin"
jlink = "pyocd.probe.jlink_probe:JLinkProbePlugin"
picoprobe = "pyocd.probe.picoprobe:PicoprobePlugin"
remote = "pyocd.probe.tcp_client_probe:TCPClientProbePlugin"
stlink = "pyocd.probe.stlink_probe:StlinkProbePlugin"

[project.entry-points."pyocd.rtos"]
argon = "pyocd.rtos.argon:ArgonPlugin"
freertos = "pyocd.rtos.freertos:FreeRTOSPlugin"
rtx5 = "pyocd.rtos.rtx5:RTX5Plugin"
threadx = "pyocd.rtos.threadx:ThreadXPlugin"
zephyr = "pyocd.rtos.zephyr:ZephyrPlugin"

[project.urls]
Website = "https://pyocd.io/"
Documentation = "https://pyocd.io//docs"
Source = "https://github.com/pyocd/pyOCD"
Issues = "https://github.com/pyocd/pyOCD/issues"
Discussions = "https://github.com/pyocd/pyOCD/discussions"
Releases = "https://github.com/pyocd/pyOCD/releases"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ["pyocd*"]

[tool.setuptools.package-data]
pyocd = ["debug/svd/svd_data.zip"]

[tool.setuptools.cmdclass]
build_py = "pyocd._build.build_py"
sdist = "pyocd._build.sdist"

[tool.setuptools_scm]
write_to = "pyocd/_version.py"
local_scheme = "dirty-tag"

[tool.flake8]
exclude = [
"test_user_script.py",
"gdb_test_script.py",
]

[tool.pytest.ini_options]
testpaths = ["test/unit"]
junit_family = "xunit2"
Expand Down
114 changes: 0 additions & 114 deletions setup.cfg

This file was deleted.

43 changes: 0 additions & 43 deletions setup.py

This file was deleted.

Loading
Loading