msg262805 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-03 00:31 |
I would be very useful to have a `has_flag` method in `distutils.CCompiler` similar to `has_function`, allowing to check if the compiler supports certain flags. Cmake has a `CHECK_CXX_COMPILER_FLAG` macro for that purpose, which checks if a simple C++ file compiles with the said flag. |
|
|
msg262808 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-03 01:30 |
I attached a patch for ccompiler.py adding the new `has_flag` method. |
|
|
msg262821 - (view) |
Author: SilentGhost (SilentGhost) *  |
Date: 2016-04-03 10:19 |
I've left a comment on Rietveld |
|
|
msg262843 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-04 04:29 |
New version of the patch using the context manager. |
|
|
msg262851 - (view) |
Author: SilentGhost (SilentGhost) *  |
Date: 2016-04-04 10:01 |
I understand that you're copying approach of has_function, but shouldn't you remove this temporary file at the end of the function? Perhaps using tempfile.NamedTemporaryFile would be a better solution (both in has_flag and has_function). Also import can be moved to the top level, since it's used in more than one method. |
|
|
msg262853 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-04 16:35 |
@minrk submitted http://bugs.python.org/file40933/0001-cleanup-temporary-files-in-ccompiler.has_function.patch doing what you describe for `has_function`. I don't know much about the process to contribute to cpython. I would be glad to open a "PR" incorporating Min's commits too. |
|
|
msg262855 - (view) |
Author: SilentGhost (SilentGhost) *  |
Date: 2016-04-04 17:00 |
I guess it would make sense to depend on and implement the has_flag with minrk's patch in mind. I guess his patch didn't get a second look because it didn't apply cleanly. In any case, for implementing has_flag using current best practice is what I'd recommend. |
|
|
msg262863 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-04 19:10 |
A new version of the patch using `NamedTemporaryFile` instead a the regular fdopen. |
|
|
msg262927 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-06 00:52 |
Are you fine with the new state of the patch? |
|
|
msg262942 - (view) |
Author: SilentGhost (SilentGhost) *  |
Date: 2016-04-06 11:15 |
I'm largely fine with it, bar the in-function import. It would also be good if you could verify that no other temporary files are left after the function is run. As I said earlier, issue 25544 should have priority and it should get a refreshed patch soon. Donald, I'm assigning issue to you since you're maintaining this module. |
|
|
msg263932 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-04-21 19:17 |
Hey, any blocker to getting this in? |
|
|
msg265183 - (view) |
Author: James Tatum (James.Tatum) * |
Date: 2016-05-09 04:21 |
FYI, NamedTemporaryFile doesn't work well with Windows. There are a handful of issues about it. |
|
|
msg273062 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-08-18 19:34 |
Any chance to get this in for 3.6? |
|
|
msg273152 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2016-08-19 18:45 |
Sylvain, have you brought this feature request up on the Distutils mailing list? The PyPA there is responsible for packaging features. One big issue with adding new features to Distutils is the backwards-compatibility tradeoff: many third-party package authors want to support their distributions on multiple Python versions which is one of the reasons why we are generally very cautious about changing or even adding APIs to Distutils at this point in its life. https://mail.python.org/mailman/listinfo/distutils-sig |
|
|
msg273157 - (view) |
Author: Sylvain Corlay (sylvain.corlay) * |
Date: 2016-08-19 19:59 |
Thanks Ned. I posted a couple of messages on distutils-sig and got little attention. I think that this feature is very important for detecting whether a compiler supports a certain flag like `-std=c++11` and provide a meaningful error when needed. CMake has the same feature, implemented in a similar fashion (CHECK_CXX_COMPILER_FLAG). |
|
|
msg273162 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2016-08-19 22:42 |
"I posted a couple of messages on distutils-sig and got little attention." OK, for future reference, the start of the discussion was here: https://mail.python.org/pipermail/distutils-sig/2016-May/029010.html It looks like the first item, the one relative to this issue, got lost in the discussion of the second item. I'm attempting to (re-)start the discussion there (my post may be awaiting moderation). |
|
|
msg273181 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2016-08-20 01:45 |
https://mail.python.org/pipermail/distutils-sig/2016-August/029469.html |
|
|
msg386366 - (view) |
Author: Steve Dower (steve.dower) *  |
Date: 2021-02-03 18:21 |
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils. If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools |
|
|