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

ConfigParser issue with duplicate option entries #225

Open
axlroden opened this issue Aug 25, 2022 · 2 comments
Open

ConfigParser issue with duplicate option entries #225

axlroden opened this issue Aug 25, 2022 · 2 comments

Comments

@axlroden
Copy link

I have an issue with the way Shiv runs ConfigParser for a specific module I need.

configparser.DuplicateOptionError: While reading from PosixPath('/tmp/tmpjl8xhapm/pyroute2-0.7.2.dist-info/entry_points.txt') [line 56]: option 'conntrack' in section 'pyroute2' already exists

pyroute2 has multiple entries of conntrack with different capitalisation. Conntrack/conntrack.
Excerpt from pyroute2 setup.cfg

conntrack = pyroute2.conntrack
--
45 | iproute = pyroute2.iproute
… |  
61 | NetlinkDumpInterrupted = pyroute2.netlink.exceptions:NetlinkDumpInterrupted
62 | Conntrack = pyroute2.conntrack:Conntrack

Since this is a linux module it shouldn't be an issue to handle this, but from what I can understand ConfigParser changes everything to lowercase because of Windows.

https://stackoverflow.com/a/19359720/837767
This answer explains it, and shows a fix for the issue.

Any way to implement this into shiv ?

@axlroden
Copy link
Author

Just tested adding:

config_parser.optionxform = str


Here, will fix the issue I have.

Not sure it would break any windows binaries ?

@lorencarvalho
Copy link
Contributor

Hi @axlroden,

Thanks for the issue! I think your solution sounds good and could even be safely implemented in a way that's compatible with Windows & Linux, by gating the optionxform on the output of https://docs.python.org/3/library/platform.html#platform.system

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

No branches or pull requests

2 participants