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

Port code from CygwinCCompiler to UnixCCompiler #209

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

DWesl
Copy link
Contributor

@DWesl DWesl commented May 14, 2023

python-pillow/Pillow#7158 (comment) and
https://github.com/pypa/setuptools/blob/e76db4408e40a5c0a218ef6f652454f69c5aca59/setuptools/_distutils/ccompiler.py#L1055-L1058
suggest that Cygwin uses UnixCCompiler rather than CygwinCCompiler by default, so UnixCCompiler would also need to know how to find shared libraries, import libraries, and static libraries on Cygwin.

Port of #139 to UnixCCompiler

python-pillow/Pillow#7158 (comment)
suggests that Cygwin uses UnixCCompiler rather than CygwinCCompiler by default, so UnixCCompiler would need to know how to find shared libraries, import libraries, and static libraries on Cygwin.
@DWesl
Copy link
Contributor Author

DWesl commented May 14, 2023

UnixCCompiler.find_library_file now returns library names that are likely to occur on Cygwin, rather than those likely on Linux, which causes the doctest to fail. Should I fix that with # doctest: ELLIPSIS or something like

>>> result = compiler.find_library_file(dirs, 'abc').replace('\\', '/')
>>> if sys.platform == "cygwin":
...     print(result == "/foo/bar/existing/cygabc.dll")
... else:
...     print(result == "/foo/bar/existing/libabc.dylib")
True

@DWesl
Copy link
Contributor Author

DWesl commented May 19, 2023

Given Cygwin seems to use UnixCCompiler rather than CygwinCCompiler, should we also drop cygwinccompiler.py?

@radarhere
Copy link

Given Cygwin seems to use UnixCCompiler rather than CygwinCCompiler, should we also drop cygwinccompiler.py?

#185 similarly feels CygwinCCompiler isn't used, although thinks it should be.

@DWesl
Copy link
Contributor Author

DWesl commented Jun 23, 2023

How should I be fixing the doctests to not fail with working code on Cygwin?

@DWesl
Copy link
Contributor Author

DWesl commented Aug 3, 2023

The odd doctests suggest having CygwinCCompiler be a thin wrapper around UnixCCompiler might be the way to go: the only thing I can think to change would be the doctests in this PR, as everything else seems fine.

distutils/unixccompiler.py Outdated Show resolved Hide resolved
@jaraco
Copy link
Member

jaraco commented Apr 14, 2024

Oh, heck. Tests on cygwin are currently disabled because ruff fails to install there.

@DWesl
Copy link
Contributor Author

DWesl commented Apr 18, 2024

There's some recent progress on rust-lang/rust#79854; I'm somewhat curious how well the work done to cross-compile from Linux would carry over to cross-compiling from Windows.

@ghost
Copy link

ghost commented Apr 28, 2024

I'm somewhat curious how well the work done to cross-compile from Linux would carry over to cross-compiling from Windows.

there wasn't any existing cygwin cross compiler available on mingw or msys, but there is one on fedora linux

i also tried to get a cygwin cross compiler on archlinux: arch-cygwin (unofficial), it uses PKGBUILD (which is the same as what MSYS2 is using), might be useful if someone want to build them and package on msys2 EDIT: i made one for cross-compiling on windows

jaraco and others added 2 commits June 28, 2024 11:49
Co-authored-by: DWesl <22566757+DWesl@users.noreply.github.com>
@jaraco
Copy link
Member

jaraco commented Jun 28, 2024

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

The only failing test now is the failing coverage test, which is spurious and only there because the coverage is only checked on one platform, so it's ignorable.

@jaraco jaraco merged commit cfc09f2 into pypa:main Jun 28, 2024
18 of 20 checks passed
jaraco added a commit that referenced this pull request Jun 28, 2024
Port code from CygwinCCompiler to UnixCCompiler
@DWesl
Copy link
Contributor Author

DWesl commented Jun 28, 2024

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

It was a failure on the Cygwin doctests, which I think got disabled because there's no Rust compiler for Cygwin

@DWesl DWesl deleted the patch-3 branch June 28, 2024 18:25
radarhere added a commit to radarhere/Pillow that referenced this pull request Jul 2, 2024
@Kreijstal
Copy link

How should I be fixing the doctests to not fail with working code on Cygwin?

I don't see any problem with the doctests. Perhaps they've been resolved.

It was a failure on the Cygwin doctests, which I think got disabled because there's no Rust compiler for Cygwin

the problem is usually path conversion

https://github.com/thepowersgang/mrustc

you can kinda get rust here on cygwin, but there are many problems with path conversion and cygwin not being linux

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.

4 participants