Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Package serial -> serial_labgrid #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Bastian-Krause
Copy link
Member

labgrid's pyserial fork uses the same package name as the original pyserial. This becomes a problem once another dependency pulls in the original pyserial. Then one package will overwrite the other.

Thus, rename the package from "serial" to "serial_labgrid":

  • pyproject.toml edited manually
  • pip install rope, then run:
import rope

project = rope.base.project.Project(".")
serial = project.find_module("serial")

changes = rope.refactor.rename.Rename(project, serial).get_changes("serial_labgrid")
project.do(changes)
  • update serial.urlhandler -> serial_labgrid.urlhandler in serial_labgrid/__init__.py:protocol_handler_packages

This is the first step to fix labgrid-project/labgrid#1245.

labgrid's pyserial fork uses the same package name as the original
pyserial. This becomes a problem once another dependency pulls in the
original pyserial. Then one package will overwrite the other.

Thus, rename the package from "serial" to "serial_labgrid":
- pyproject.toml edited manually
- `pip install rope`, then run:

```
import rope

project = rope.base.project.Project(".")
serial = project.find_module("serial")

changes = rope.refactor.rename.Rename(project, serial).get_changes("serial_labgrid")
project.do(changes)
```

- update serial.urlhandler -> serial_labgrid.urlhandler
  in serial_labgrid/__init__.py:protocol_handler_packages

Signed-off-by: Bastian Krause <[email protected]>
@Emantor
Copy link
Member

Emantor commented Jan 21, 2024

This prevents distributions from using a correctly patched upstream pyserial. I am less in favor of merging this because of that reason.

@Bastian-Krause
Copy link
Member Author

This prevents distributions from using a correctly patched upstream pyserial. I am less in favor of merging this because of that reason.

For the record: @Emantor means these import changes that will be needed in labgrid:

import serial -> import serial_labgrid
import serial.rfc2217 -> import serial_labgrid.rfc2217

Since the pyproject.toml already references this fork, a patch would be required anyway (at least if the distro uses that somehow). As far as I know, nixos is the only distro packaging a recent labgrid version.

Alternatives to this PR are:

  • make sure our pyserial fork is overwriting pyserial (not the other way around), but that means other pyserial dependencies will be silently ignored (e.g. a package requiring pyserial>=3.6)
  • switch to a different serial library (e.g. https://github.com/tiagocoutinho/serialio)

As the alternatives sound like they might introduce even bigger problems, I'm still in favour of merging this "cleaner solution" - at least for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

modbusrtu/dev extras make pyserial overwrite pyserial-labgrid
2 participants