This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年04月03日 00:31 by sylvain.corlay, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| has_flag.diff | sylvain.corlay, 2016年04月03日 01:30 | review | ||
| has_flag.diff | sylvain.corlay, 2016年04月04日 04:29 | review | ||
| has_flag.diff | sylvain.corlay, 2016年04月04日 19:10 | review | ||
| Messages (18) | |||
|---|---|---|---|
| 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) * (Python triager) | 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) * (Python triager) | 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) * (Python triager) | Date: 2016年04月04日 17:00 | |
I guess it would make sense to depend on issue25544 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) * (Python triager) | 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) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | Date: 2016年08月20日 01:45 | |
https://mail.python.org/pipermail/distutils-sig/2016-August/029469.html |
|||
| msg386366 - (view) | Author: Steve Dower (steve.dower) * (Python committer) | 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 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:29 | admin | set | github: 70876 |
| 2021年02月03日 18:21:48 | steve.dower | set | status: open -> closed nosy: + steve.dower messages: + msg386366 resolution: out of date stage: patch review -> resolved |
| 2016年08月20日 01:45:18 | ned.deily | set | messages: + msg273181 |
| 2016年08月19日 22:42:26 | ned.deily | set | messages: + msg273162 |
| 2016年08月19日 19:59:24 | sylvain.corlay | set | messages: + msg273157 |
| 2016年08月19日 18:45:13 | ned.deily | set | nosy:
+ ned.deily messages: + msg273152 |
| 2016年08月19日 08:44:00 | berker.peksag | set | nosy:
+ berker.peksag stage: commit review -> patch review versions: - Python 2.7 |
| 2016年08月18日 19:34:40 | sylvain.corlay | set | messages: + msg273062 |
| 2016年05月09日 04:21:38 | James.Tatum | set | nosy:
+ James.Tatum messages: + msg265183 |
| 2016年04月21日 19:17:04 | sylvain.corlay | set | messages: + msg263932 |
| 2016年04月06日 11:17:04 | SilentGhost | set | status: pending -> open |
| 2016年04月06日 11:15:28 | SilentGhost | set | status: open -> pending assignee: dstufft messages: + msg262942 stage: patch review -> commit review |
| 2016年04月06日 00:52:16 | sylvain.corlay | set | messages: + msg262927 |
| 2016年04月04日 19:10:10 | sylvain.corlay | set | files:
+ has_flag.diff messages: + msg262863 |
| 2016年04月04日 17:00:56 | SilentGhost | set | dependencies:
+ cleanup temporary files in distutils.has_function messages: + msg262855 |
| 2016年04月04日 16:35:30 | sylvain.corlay | set | messages: + msg262853 |
| 2016年04月04日 10:01:25 | SilentGhost | set | messages: + msg262851 |
| 2016年04月04日 04:29:58 | sylvain.corlay | set | files:
+ has_flag.diff messages: + msg262843 |
| 2016年04月03日 10:19:55 | SilentGhost | set | nosy:
+ SilentGhost messages: + msg262821 |
| 2016年04月03日 06:11:01 | SilentGhost | set | stage: patch review versions: - Python 3.2, Python 3.3, Python 3.4, Python 3.5 |
| 2016年04月03日 01:30:09 | sylvain.corlay | set | files:
+ has_flag.diff keywords: + patch messages: + msg262808 |
| 2016年04月03日 00:31:21 | sylvain.corlay | create | |