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.

classification
Title: Integrate "Argument Clinic" into CPython build
Type: Stage: commit review
Components: Build Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: larry Nosy List: larry, loewis, pitrou, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2013-10-23 06:12 by larry, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
larry.make.clinic.patch.1.diff larry, 2013-11-22 23:10 review
larry.make.clinic.patch.2.diff larry, 2013-11-22 23:46 review
Messages (16)
msg201000 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-10-23 06:12
Somebody needs to figure out how to best integrate Argument Clinic into the build.  Antoine, I think you said it sounded like... "fun"?  Maybe?  Anyway, I'm hoping you're willing to take a stab at it.  If not please assign the issue back to nobody, and sorry the intrusion.
msg201001 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-10-23 06:40
Drat!
msg201004 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-23 08:31
Well, I don't really know how to do it. You'd have to have a step that somehow scans for .c files in the source tree, looks for clinic headers and compute whether they're outdated?
(but this must only be done if the .c files are younger than the .o files, i.e. the step should probably be integrated to the C compilation step)
msg201091 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-10-24 05:06
I thought it'd be more like, write a special C program that probes to see if you have a built python in the current directory, and if not looks on the path for a python3 (>=3.3), and if it finds a python it can use it runs Clinic on its arguments.  Then make sure it gets built before any of the C files.  Then change the .c -> .o target so it runs that program before running $(CC).
msg201097 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-24 08:15
Well, why is clinic 3.3 only? It would be slightly easier if it accepted any "python3" executable.
msg201099 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-24 08:37
> Well, I don't really know how to do it. You'd have to have a step that somehow scans for .c files in the source tree, looks for clinic headers and compute whether they're outdated?

Does it really need to be automated? We may only regenerate clinic things after a fresh configure (uncompress tarball, rnu configure, make). Or explicitly using a special command, ex: "make clinic" (which would only regenerate clinic things).

(I didn't check how clinic works, so I'm maybe saying something stupid.)
msg201100 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-24 08:41
> > Well, I don't really know how to do it. You'd have to have a step
> > that somehow scans for .c files in the source tree, looks for
> > clinic headers and compute whether they're outdated?
> 
> Does it really need to be automated? We may only regenerate clinic
> things after a fresh configure (uncompress tarball, rnu configure,
> make). Or explicitly using a special command, ex: "make clinic"
> (which would only regenerate clinic things).

"make clinic" may be a good compromise indeed.
msg201202 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-10-25 02:42
> Well, why is clinic 3.3 only? It would be slightly easier
> if it accepted any "python3" executable.

Patches welcome!  I have bigger fish to fry.
msg201215 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-25 07:15
> Patches welcome!  I have bigger fish to fry.

That doesn't solve the "why" question. You wrote the code and it probably takes you two minutes to make a fix.
msg201243 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-10-25 15:31
For a long time it was actually 3.4+ only.  I was depending on a particular AST node that wasn't exposed to Python until 3.4 trunk.  But that went away, and I tried it with 3.3 and it worked fine, so I labeled it 3.3+.  For all I know it works fine under 3.1, never tried it.
msg203912 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-11-22 23:10
Attached is a patch to at least add a "make clinic" target for the UNIX-like platforms.  This doesn't add anything for the Windows build.
msg203915 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-11-22 23:24
+	$(RUNSHARED) $(PYTHON_FOR_BUILD) ./Tools/clinic/clinic.py */*.c

There are deeper directories containing .c files: Mac/Tools, Modules/cjkcodecs, Modules/_ctypes, Modules/_decimal, Modules/expat, ./PC/bdist_wininst, etc.
msg203924 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-11-22 23:45
Okay, there's more than one way to skin this cat.  This version uses os.walk().
msg203925 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-11-22 23:46
(Whoops, forgot to attach the new diff.)
msg204126 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-23 22:59
New changeset 29370c25e0f1 by Larry Hastings in branch 'default':
Issue #19358: "make clinic" now runs the Argument Clinic preprocessor
http://hg.python.org/cpython/rev/29370c25e0f1
msg204127 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2013-11-23 23:26
Fixed.  By the way, this checkin also added a tiny new feature to Argument Clinic: if the file hasn't changed, it doesn't bother to rewrite it (or touch it in any way).
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63557
2013-11-23 23:26:52larrysetstatus: open -> closed
messages: + msg204127

assignee: larry
resolution: fixed
stage: patch review -> commit review
2013-11-23 22:59:17python-devsetnosy: + python-dev
messages: + msg204126
2013-11-22 23:46:14larrysetfiles: + larry.make.clinic.patch.2.diff

messages: + msg203925
2013-11-22 23:45:52larrysetmessages: + msg203924
2013-11-22 23:24:19vstinnersetmessages: + msg203915
2013-11-22 23:10:05larrysetfiles: + larry.make.clinic.patch.1.diff
keywords: + patch
messages: + msg203912

stage: patch review
2013-10-25 15:31:33larrysetmessages: + msg201243
2013-10-25 07:15:12pitrousetmessages: + msg201215
2013-10-25 02:42:30larrysetmessages: + msg201202
2013-10-24 08:41:24pitrousetmessages: + msg201100
2013-10-24 08:37:20vstinnersetnosy: + vstinner
messages: + msg201099
2013-10-24 08:15:29pitrousetmessages: + msg201097
2013-10-24 05:06:21larrysetmessages: + msg201091
2013-10-23 08:31:32pitrousetnosy: + loewis
messages: + msg201004
2013-10-23 06:40:29larrysetmessages: + msg201001
2013-10-23 06:39:36pitrousetassignee: pitrou -> (no value)
2013-10-23 06:12:31larrycreate