Perforce Python Script Collection.

rajeshkumar created the topic: Perforce Python Script Collection.

Implement a script that will do following:

1. Read config file. This file will contain following settings:
a. For mail delivery (SMTP)
b. For access to perforce server
2. Get from perforce a list of changes made since last script run time and get all updated files
3. Invoke script that will ‘build’ the changes – it will be located in the working folder of the
script(build.bat/build.sh). Script itself should come from perforce as well during step 2.
4. If running of build script is successful, add/update contents of folder named ‘bin’ in the perforce
repository (it is expected that build script will put there a product of its work)
5. In case of error of invocation, send out an email with the list of changes retrieved in p.2 and all outputs of
build script (both stdout/stderr), in which case contents of ‘bin’ folder should not be updated to perforce

Solution
Script details:
master.py – This file is the main file which should be excuted to get the all desired output as per the task
build.bat – This is a Build file which will be executing during compilation phase in master.py. config.ini: Following key should be modified as the environment specification

Sender
Receivers
Message
Host
p4port
p4user
p4client
p4passwd
Scenario to create fail Build:
Remove comment line from “REM mkdir raj” in build.bat

How to use?
Change the config.ini file appropriately and fire master.py script. If you find any issues, please follow the log error message accordingly.

File is as attached

File Attachment:
File Name: build.bat.txt
File Size:0 KB

File Attachment:
File Name: config.ini.txt
File Size:0 KB

File Attachment:
File Name: Index.txt
File Size:0 KB

File Attachment:
File Name: master.txt
File Size:4 KB
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Tagged :
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x