Open buzmeg opened 2 years ago
When installed by pip install .
, following file will be created.
~/.local/lib/python3.9/site-packages/pyocd/_version.py
You just need to copy this file into your working repository.
Then you can invoke pyocd like this.
python -mpyocd
Maybe it is a good idea to pip uninstall pyocd
to avoid confusion.
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '0.32.3.dev147'
version_tuple = (0, 32, 3, 'dev147')
Strange. I get quite different behavior when I execute when pyocd is installed vs isn't:
(.venv) :~/python/pyOCD$ python -mpyocd list
# Probe Unique ID
-------------------------------------
0 Segger J-Link EDU <serial>
(.venv) :~/python/pyOCD$ pip uninstall pyocd
Found existing installation: pyocd 0.33.2.dev2+dirty
Uninstalling pyocd-0.33.2.dev2+dirty:
Would remove:
/home/username/python/pyOCD/.venv/bin/pyocd
/home/username/python/pyOCD/.venv/bin/pyocd-gdbserver
/home/username/python/pyOCD/.venv/lib/python3.8/site-packages/pyocd-0.33.2.dev2+dirty.dist-info/*
/home/username/python/pyOCD/.venv/lib/python3.8/site-packages/pyocd/*
Proceed (y/n)? y
Successfully uninstalled pyocd-0.33.2.dev2+dirty
(.venv) :~/python/pyOCD$ python -mpyocd list
No available debug probes are connected
(.venv) :~/python/pyOCD$ pip install .
Processing /home/username/python/pyOCD
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: typing-extensions<5.0,>=4.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (4.2.0)
Requirement already satisfied: intelhex<3.0,>=2.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (2.3.0)
Requirement already satisfied: pyelftools<1.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (0.28)
Requirement already satisfied: colorama<1.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (0.4.4)
Requirement already satisfied: prettytable<3.0,>=2.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (2.5.0)
Requirement already satisfied: capstone<5.0,>=4.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (4.0.2)
Requirement already satisfied: intervaltree<4.0,>=3.0.2 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (3.1.0)
Requirement already satisfied: natsort<9.0,>=8.0.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (8.1.0)
Requirement already satisfied: pyusb<2.0,>=1.2.1 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (1.2.1)
Requirement already satisfied: six<2.0,>=1.15.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (1.16.0)
Requirement already satisfied: pyyaml<7.0,>=6.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (6.0)
Requirement already satisfied: cmsis-pack-manager<1.0,>=0.4.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (0.4.0)
Requirement already satisfied: pyocd-pemicro>=1.0.6 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (1.1.3)
Requirement already satisfied: pylink-square<1.0,>=0.11.1 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (0.12.0)
Requirement already satisfied: libusb-package<2.0,>=1.0 in ./.venv/lib/python3.8/site-packages (from pyocd==0.33.2.dev2+dirty) (1.0.25.0)
Requirement already satisfied: wcwidth in ./.venv/lib/python3.8/site-packages (from prettytable<3.0,>=2.0->pyocd==0.33.2.dev2+dirty) (0.2.5)
Requirement already satisfied: sortedcontainers<3.0,>=2.0 in ./.venv/lib/python3.8/site-packages (from intervaltree<4.0,>=3.0.2->pyocd==0.33.2.dev2+dirty) (2.4.0)
Requirement already satisfied: appdirs<2.0,>=1.4 in ./.venv/lib/python3.8/site-packages (from cmsis-pack-manager<1.0,>=0.4.0->pyocd==0.33.2.dev2+dirty) (1.4.4)
Requirement already satisfied: milksnake<1.0,>=0.1.5 in ./.venv/lib/python3.8/site-packages (from cmsis-pack-manager<1.0,>=0.4.0->pyocd==0.33.2.dev2+dirty) (0.1.5)
Requirement already satisfied: pypemicro==0.1.9 in ./.venv/lib/python3.8/site-packages (from pyocd-pemicro>=1.0.6->pyocd==0.33.2.dev2+dirty) (0.1.9)
Requirement already satisfied: future in ./.venv/lib/python3.8/site-packages (from pylink-square<1.0,>=0.11.1->pyocd==0.33.2.dev2+dirty) (0.18.2)
Requirement already satisfied: psutil>=5.2.2 in ./.venv/lib/python3.8/site-packages (from pylink-square<1.0,>=0.11.1->pyocd==0.33.2.dev2+dirty) (5.9.0)
Requirement already satisfied: cffi>=1.6.0 in ./.venv/lib/python3.8/site-packages (from milksnake<1.0,>=0.1.5->cmsis-pack-manager<1.0,>=0.4.0->pyocd==0.33.2.dev2+dirty) (1.15.0)
Requirement already satisfied: pycparser in ./.venv/lib/python3.8/site-packages (from cffi>=1.6.0->milksnake<1.0,>=0.1.5->cmsis-pack-manager<1.0,>=0.4.0->pyocd==0.33.2.dev2+dirty) (2.21)
Building wheels for collected packages: pyocd
Building wheel for pyocd (PEP 517) ... done
Created wheel for pyocd: filename=pyocd-0.33.2.dev2+dirty-py3-none-any.whl size=12696981 sha256=59df1ca6f395099d6ac16c1c3a3cb752ee34b128dacafca3127b76a1da7a9785
Stored in directory: /tmp/pip-ephem-wheel-cache-qdg84zt2/wheels/9d/4e/ab/5a4804bf7b503f5240e2245e11fe22d43cf0fad03ad4255d04
Successfully built pyocd
Installing collected packages: pyocd
Successfully installed pyocd-0.33.2.dev2+dirty\
(.venv) :~/python/pyOCD$ python -mpyocd list
# Probe Unique ID
-------------------------------------
0 Segger J-Link EDU <serial>
Hmm, please try adding these lines to the end of pyocd/probe/aggregator.py .
from ..probe.jlink_probe import JLinkProbe
PROBE_CLASSES["jlink"] = JLinkProbe
Or instead use this as a top level script. like: python main.py list
main.py
from pyocd.probe.aggregator import PROBE_CLASSES
from pyocd.probe.cmsis_dap_probe import CMSISDAPProbe
from pyocd.probe.jlink_probe import JLinkProbe
PROBE_CLASSES["cmsisdap"] = CMSISDAPProbe
PROBE_CLASSES["jlink"] = JLinkProbe
from pyocd.__main__ import main
main()
I admit I have personal preference to above wacky method. but it looks like sane people's choice is different.
Which is discussed in https://github.com/pyocd/pyOCD/issues/938 .
That is pip install -e .
the editable mode.
As things stand right now, it seems like I have to "pip install", try out pyocd, make changes to code, "pip install", try out pyocd, etc.
Is there a way to run the edited pyocd code directly from the command line without the "pip install" step?
The purpose of this is to allow me to run this under VSCode directly so things like debugging and stepping actually work. If there is a better way to run this from VSCode than trying to run from the command line, I'm happy to do that instead.
Thanks.