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

No putp()/tigetflag()/tigetnum()/... (term.h) makes it messy to build Python wheels #55

Closed
ulfalizer opened this issue Mar 5, 2019 · 5 comments

Comments

@ulfalizer
Copy link

ulfalizer commented Mar 5, 2019

These were removed in commit 6b56929 ("Eliminated term.h, terminfo.c; moved mvcur() to move.c").

_cursesmodule.c from Python unconditionally calls them (though the term.h #include itself is optional (HAVE_TERM_H)).

Just recording an actual issue caused by the term.h removal.

Do you think the stubs could be brought back, even if term.h is left out?

@wmcbrine
Copy link
Owner

wmcbrine commented Mar 6, 2019

In retrospect, I think it was a terrible mistake to ever include them. I'm not inclined to bring them back.

Linking _cursesmodule.c against PDCurses didn't actually work anyway, did it? I mean, in terms of the result being usable. That's why there are multiple alternative Python curses interfaces to work with PDCurses, is it not?

I think the correct approach would be to make Python's curses API more portable. Relying on non-working stubs is not the way. (And, it's mostly not possible to make them work -- PDCurses just isn't designed that way at all.)

@ulfalizer
Copy link
Author

ulfalizer commented Mar 6, 2019

Works fine after making some minor modifications and #defining a few macros.

The README in the windows-curses repository has an overview of how _cursesmodule.c fits into things. I think all Python/PDCurses integrations link against it. The prebuilt wheels from Christoph Gohlke also do (windows-curses is just those wheels set up for rebuilding).

We've been using it to make a menuconfig interface available on Windows in addition to Linux. The only special-casing in the code is related to resizing (see _get_wch_compat() in menuconfig.py).

@ulfalizer
Copy link
Author

ulfalizer commented Mar 6, 2019

Random idea:

Do you think they could be hidden behind a PDCurses compile-time setting? That way, you'd have to explicitly ask for them, and you wouldn't get code compliling but silently failing because it expects the stubs to work otherwise.

Can see if you don't want to litter the code up like that though.

@cgohlke
Copy link

cgohlke commented Mar 6, 2019

Try to compile (and link) a copy of terminfo.c when building the _cursesmodule Python extension with the new PDCurses. Works for me.

@ulfalizer
Copy link
Author

@cgohlke
Seems like the least painful option. Thanks for the idea!

@wmcbrine wmcbrine closed this as completed Mar 6, 2019
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

3 participants