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

Kconfiglib cannot be installed from MSYS #77

Closed
dobairoland opened this issue Sep 27, 2019 · 7 comments
Closed

Kconfiglib cannot be installed from MSYS #77

dobairoland opened this issue Sep 27, 2019 · 7 comments

Comments

@dobairoland
Copy link

$ pip install kconfiglib
Collecting kconfiglib
  Downloading https://files.pythonhosted.org/packages/13/3b/836b3af23701728830771d5c45fc3bd1c67ea646b49f6384a44343aa0b3e/kconfiglib-12.14.1-py2.py3-none-any.whl (142kB)
     |################################| 143kB 2.2MB/s
Collecting windows-curses; sys_platform == "win32" (from kconfiglib)
  ERROR: Could not find a version that satisfies the requirement windows-curses; sys_platform == "win32" (from kconfiglib) (from versions: none)
ERROR: No matching distribution found for windows-curses; sys_platform == "win32" (from kconfiglib)

I closed this zephyrproject-rtos/windows-curses#4 accepting that windows-curses cannot be installed in MSYS but I think Kconfiglib should not request it there if it cannot be installed.

@ulfalizer
Copy link
Owner

ulfalizer commented Sep 27, 2019

Didn't know it reported as win32 to be honest. I'll look into it once I get back to a Windows box.

Maybe you could try playing around a bit in MSYS 2 and see what some different Python system identification functions return?

@dobairoland
Copy link
Author

Usually, we test for MSYSTEM if it is in os.environ but I don't see anything like that here: https://www.python.org/dev/peps/pep-0508/#environment-markers

@ulfalizer
Copy link
Owner

ulfalizer commented Sep 28, 2019

Got MSYS2 installed now.

Usually, we test for MSYSTEM if it is in os.environ but I don't see anything like that here: https://www.python.org/dev/peps/pep-0508/#environment-markers

Yeah, I don't see a way to identify MSYS2 with environment markers either. Bit messy that it doesn't distinguish itself from the "official" Python. Would be nice if there was an "install if compatible package available" option in setuptools/wheels, but I didn't see anything like that.

Looking at https://github.com/msys2/msys2/wiki/Terminals, MSYS2 doesn't use the regular Windows Console API for its terminal (it uses Mintty), so it won't be compatible with windows-curses. Might be possible to get Python's curses working with it though, since it comes with an ncurses package by default (I ran into the same _curses.error: setupterm: could not find terminfo database error you did from some testing though).

I could drop windows-curses from install_requires in setup.py and require it to be installed manually, but since people might depend on it being automatically installed, it might be a bit mean.

I'll dig some more to see if I can find a way to detect MSYS2 or only install windows-curses if possible, but seems messy so far.

Have you considered just copying Kconfiglib into ESP-IDF by the way? It's the solution I recommend in general for third-party dependencies that don't have any complicated dependencies themselves, because it's so stupid that it can't break. I'm a bit stone-age though. :)

@dobairoland
Copy link
Author

Yes, unfortunately it is very messy and inconvenient either for Windows console users or MSYS users.

Thank you for looking into this.

I ran into the same _curses.error: setupterm: could not find terminfo database error you did from some testing though

You can get a little further if you set the TERMINFO environment variable.

Have you considered just copying Kconfiglib into ESP-IDF by the way?

Yes, we are including it now but would like to install by pip in the future. We are including also menuconfig.py and that why we ran into the issue how to support both Windows console and MSYS.

@ulfalizer
Copy link
Owner

Maybe I could make a major version bump and drop the windows-curses dependency later, if it gets too messy.

Back on the grind atm, but I'll think over it.

@dobairoland
Copy link
Author

Maybe a sufficient solution would be for now to make windows-curses to be installable in MSYS but not installing any wheel at all. But I'm not sure if it is possible...

dobairoland added a commit to dobairoland/Kconfiglib that referenced this issue Oct 4, 2019
ulfalizer added a commit that referenced this issue Oct 5, 2019
Adds commit 21b4c1e ("Do not automatically install windows-curses on
Windows"), which fixes installation on MSYS2. See that commit for an
explanation, and this issue: #77

Also adds commit 72e3d20 ("menuconfig: Give hint when 'curses' can't be
imported on Windows"), to make it easy for users to know what to do if
stuff breaks.

Sorry if this change caused problems!
ulfalizer added a commit that referenced this issue Oct 5, 2019
Adds commit 21b4c1e ("Do not automatically install windows-curses on
Windows"), which fixes installation on MSYS2. See that commit for an
explanation, and this issue: #77

Also adds commit 72e3d20 ("menuconfig: Give hint when 'curses' can't be
imported on Windows"), to make it easy for users to know what to do if
stuff breaks.

Sorry if this change caused problems!
@ulfalizer
Copy link
Owner

Fixed by removing the windows-curses dependency, in 068bc48.

menuconfig now prints a hint re. installing windows-curses if curses can't be imported on Windows (though it won't work on MSYS2).

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 a pull request may close this issue.

2 participants