5 messages in com.perforce.perforce-user[p4] p4api adventures with RedHat 6.2| From | Sent On | Attachments |
|---|---|---|
| cima...@taylors.org | 09 Dec 2000 16:47 | |
| Matthew Rice | 09 Dec 2000 20:22 | |
| Gareth Rees | 10 Dec 2000 03:15 | |
| Robert Cowham | 10 Dec 2000 04:08 | |
| Gareth Rees | 10 Dec 2000 09:47 |
| Subject: | [p4] p4api adventures with RedHat 6.2![]() |
|---|---|
| From: | Robert Cowham (rob...@vaccaperna.co.uk) |
| Date: | 12/10/2000 04:08:01 AM |
| List: | com.perforce.perforce-user |
Note that I have a come across a feature of the "p4 -G" on windows - the unmarshalling stops early in some cases.
I discovered that "p4 -G labels" was fine and I got all labels in the system, but "p4 -G clients" stopped with EOF during the unmarshal after a couple of clients. Piping the "p4 -G clients" to a file and then unmarshalling on a Linux platform worked fine pointing the finger at a bug in Python on windows (win2k in this case).
One of these days when I get a moment I will debug the Python classes (1.5.2 but also tried 2.0 with same behavior).
Anyone else seen similar?
Robert p.s. Has been notified to support
-----Original Message----- From: perforce-user-admin at perforce.com [mailto:perforce-user-admin at perforce.com]On Behalf Of Gareth Rees Sent: Sunday, December 10, 2000 11:16 To: perforce-user at perforce.com Cc: cimarron+perforce at taylors.org Subject: Re: [p4] p4api adventures with RedHat 6.2
At 16:47 -0800 2000-12-09, cimarron+perforce at taylors.org wrote:
Is anyone using the p4api with python with RedHat 6.2 and if so what did you do to get it to work?
At Ravenbrook we're using Python with Perforce on RedHat Linux and Windows NT, but not by compiling a Python interface to the Perforce API. Instead we're using the -G option to the p4 command (see "p4 help undoc") which causes Perforce to do input and output as a list of marshalled Python dictionaries.
It's very simple to use p4 -G; you can see one approach in the p4 module at <http://www.ravenbrook.com/project/p4dti/master/code/replicator/p4.py>. Using p4 -G has advantages over compiling a Python interface to the Perforce API: you don't have to recompile on each platform you port your code to; you don't have to recompile for each version of Python; you don't have to recompile for each version of the Perforce API; the interface is familiar to any Perforce user (just use the Perforce commands). The disadvantage is that you have to run a p4 process for each operation; in practice that doesn't seem to be a problem.
Here's an example showing the module used to make a pending changelist by using 'change -o' to get a blank change form as a Python dictionary, editing the description, and passing the result back to 'change -i'.
Python 1.5.2 (#1, Feb 1 2000, 16:32:16) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
import p4 i = p4.p4() change = i.run('change -o') change
[{'Change': 'new', 'User': 'gdr', 'Description': '<enter description here>\012', 'code': 'stat', 'Client': 'gdr-swan', 'Status': 'new'}]
change[0]['Description'] = 'Test change to demonstrate p4 module' i.run('change -i', change) [{'code': 'info', 'data': 'Change 5767 created.', 'level': 0}] i.run('changes -s pending')
[{'desc': 'Test change to demonstrate p4 m', 'change': '5767', 'time': '976446303', 'client': 'gdr-swan', 'user': 'gdr', 'code': 'stat', 'status': 'pending'}]
_______________________________________________ perforce-user mailing list - perforce-user at perforce.com http://maillist.perforce.com/mailman/listinfo/perforce-user




