pylink
pylink copied to clipboard
Use latest JLink installation DLL, not the oldest
In our use case, a problem occurred when using pylink, since it uses the first DLL found in C:\Program Files (x86)\SEGGER. This patch makes it use the newest one.
I think it is legit to suppose, that the newest version of JLink DLL is the less buggy and has the greatest support.
Is it possible to do this in such a way that a user could specify a specific version of the DLL? We've had cases in the past where only a very specific version of the DLL would suffice (I'm thinking back to 4.98e during the Great Blight of the 5.x release tree).
On Tue, Feb 13, 2018 at 1:13 PM, Ford [email protected] wrote:
@hkpeprah requested changes on this pull request.
I like the idea behind this, but I think it needs a bit more work. I'd want the behaviour to be consistent across Windows/Linux/Mac. There's some tests around this, and comments about how the naming convention has changed from version-to-version and platform-to-platform, so we'd want a nice way of figuring out what is what version, then returning the newest versioned one we found. That way behaviour would be consistent, whereas os.listdir isn't.
In pylink/library.py https://github.com/square/pylink/pull/19#discussion_r167969851:
@@ -114,12 +114,9 @@ def find_library_windows(cls):
# Find all the versioned J-Link directories. ds = filter(lambda x: x.startswith('JLink'), os.listdir(dir_path))
for jlink_dir in ds:# The DLL always has the same name, so if it is found, just# return it.lib_path = os.path.join(dir_path, jlink_dir, dll)if os.path.isfile(lib_path):yield lib_path
lib_path = os.path.join(dir_path, ds[-1], dll) # use the latest jlink DLL (ds[-1])So this won't necessarily return the newest version. os.listdir returns the directories in the order specified by the underlying filesystem. In some cases, this is just the latest directory created, which is generally the latest installed version, but can be an older version if someone switches between versions often.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/pylink/pull/19#pullrequestreview-96263651, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtLiKqVXBauv1YHJHa6-OS8Ljy7GgB9ks5tUd7KgaJpZM4SD0su .
I believe so. Either allowing a specific version or using the latest version will require the same code changes; some way of mapping to versions, given that the naming conventions have changed over time. So one will give us the other.
Sounds like a case for locale.strcoll!
On Mon, Feb 26, 2018 at 12:00 PM, Ford [email protected] wrote:
@hkpeprah commented on this pull request.
In pylink/library.py https://github.com/square/pylink/pull/19#discussion_r170680838:
@@ -114,12 +114,9 @@ def find_library_windows(cls):
# Find all the versioned J-Link directories. ds = filter(lambda x: x.startswith('JLink'), os.listdir(dir_path))
for jlink_dir in ds:# The DLL always has the same name, so if it is found, just# return it.lib_path = os.path.join(dir_path, jlink_dir, dll)if os.path.isfile(lib_path):yield lib_path
lib_path = os.path.join(dir_path, ds[-1], dll) # use the latest jlink DLL (ds[-1])Yah, I like the idea of that behaviour. The reason why I said that listdir might not be the best approach is that the order isn't guaranteed, so if we say that we always return the latest one, then we have to do some sorting in addition to listdir. To sort properly, we'll need to handle the different file naming conventions that have been had over time.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/square/pylink/pull/19#discussion_r170680838, or mute the thread https://github.com/notifications/unsubscribe-auth/AFtLiCbuQy49FkDHmWDWQ0qhBMpTu_Quks5tYvElgaJpZM4SD0su .
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.