I would like to write some scripts in python that do some automated changes to source code. If the script determines it needs to change the file I would like to first check it out of perforce. I don’t care about checking in because I will always want to build and test first.
Share
Perforce has Python wrappers around their C/C++ tools, available in binary form for Windows, and source for other platforms:
http://www.perforce.com/perforce/loadsupp.html#api
You will find their documentation of the scripting API to be helpful:
http://www.perforce.com/perforce/doc.current/manuals/p4script/p4script.pdf
Use of the Python API is quite similar to the command-line client:
I’ll verify it from the command line: