PyPerforce: A Python interface for the Perforce SCM

Introduction

PyPerforce is a Python extension that allows you to access the Perforce software configuration management system efficiently from Python code.

Features:

Download

PyPerforce can be downloaded from here.

Project

PyPerforce is an Open Source project hosted on SourceForge at http://sourceforge.net/projects/pyperforce/.

Support

PyPerforce is maintained and supported personally by Lewis Baker.

If you would like to report a bug or feature request for this project then please submit a tracker item.

Documentation

PyPerforce has comprehensive API documentation as well some tutorials to help you get started.

PyPerforce documentation can be found at: http://pyperforce.sourceforge.net/doc/

Sample Code

This sample code shows how to connect to a Perforce server, update a client spec and then sync the client.

from perforce import *
p4 = Connection(port='perforce:1666')
try:
  p4.connect(prog='ClientUpdater')
  p4.user = 'jbloggs'
  try:
    # Retrieve the client spec
    client = Client(p4, 'my-client')
    
    # Update the spec
    client['View'] = [('//depot/foo/...', '//my-client/foo/...'),
                      ('//depot/bar/...', '//my-client/bar/...')]
    
    # Save the updated spec
    client.save()
    
    # Finally, sync the client
    client.sync()
    
  finally:
    p4.disconnect()  
    
except ConnectionFailed, e:
  print str(e)
  
except PerforceError, e:
  print str(e)


Copyright © 2005-2006 Maptek Pty. Ltd.

SourceForge.net Logo