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

Fix setup.py to work with setuptools 41.4.0 and later #20

Closed
generalmimon opened this issue Jun 30, 2020 · 2 comments · Fixed by #21
Closed

Fix setup.py to work with setuptools 41.4.0 and later #20

generalmimon opened this issue Jun 30, 2020 · 2 comments · Fixed by #21

Comments

@generalmimon
Copy link
Member

generalmimon commented Jun 30, 2020

I haven't tested it, but looking at the setup.py file in this repo concerns me, if here couldn't happen the same problem with setuptools>=41.4.0 as we encountered in the kaitai_struct_python_runtime repo (kaitai-io/kaitai_struct_python_runtime#46).

In this comment kaitai-io/kaitai_struct_python_runtime#43 (comment) in the issue reporting the problem, @dgelessus wrote this:

This error is caused by setup.py files trying to read setup.cfg manually, which is not officially supported (see pypa/setuptools#1869). You're supposed to just call setup() without arguments and let setuptools find and read the setup.cfg file itself.

If that was the case, I think the same can happen also in this repo. Here's the setup.py here:

kaitai_fs/setup.py

Lines 7 to 11 in 0c4a773

cfg = read_configuration(str(Path(__file__).parent / 'setup.cfg'))
#print(cfg)
cfg["options"].update(cfg["metadata"])
cfg = cfg["options"]
setup(**cfg)

I don't have any deep experience with setuptools, setup.py and this kind of stuff, but this seems to me a lot like setup.py files trying to read setup.cfg manually.

@dgelessus, could you please look at it and possibly fix it?

@dgelessus
Copy link
Contributor

Just tested - python3 -m pip install ./kaitai_fs actually works without issues with pip==20.1.1 and setuptools==47.3.1 (which are the latest versions currently).

The error that we had with kaitai_struct_python_runtime only happens when you read setup.cfg manually and the setup.cfg has a python_requires setting in the [options] section. kaitai_fs's setup.cfg doesn't use python_requires, so the error doesn't occur here.

You are right though that the setup.py here is manually reading/parsing setup.cfg, which is not supported (even though it doesn't give any errors here), so we should fix that. I'll make a PR.

dgelessus added a commit to dgelessus/kaitai_fs that referenced this issue Jun 30, 2020
Reading setup.cfg manually is not supported by setuptools and causes
errors with some setup.cfg features (see pypa/setuptools#1869).
The supported way to use setup.cfg is to call setup() with no arguments
and let setuptools read and parse setup.cfg itself.
@generalmimon
Copy link
Member Author

@dgelessus Thanks for your review and the clarification, at least I'm a little wiser 🙂

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

Successfully merging a pull request may close this issue.

2 participants