[p4python] RE: [p4] Python scripting with Perforce

Robert Cowham robert at vaccaperna.co.uk
Sat Oct 1 04:28:29 PDT 2005


It uses distutils which works pretty well - do you not have gcc installed?

For RPM, it should be as simple as "python setup.py bdist_rpm" and anyone
who does this and cares to send me the results I will put them on the web
page.

Robert 

> -----Original Message-----
> From: perforce-user-bounces at perforce.com 
> [mailto:perforce-user-bounces at perforce.com] On Behalf Of Jason Dillon
> Sent: 30 September 2005 23:10
> To: Don Williamson
> Cc: perforce-user at perforce.com
> Subject: Re: [p4] Python scripting with Perforce
> 
> Anyone know if there is an RPM out there for this?
> 
> --jason
> 
> 
> On Sep 30, 2005, at 2:45 AM, Don Williamson wrote:
> 
> > Paul, I can't help with this but we use P4Python extensively for 
> > scripting of build/daemon/trigger scripts, etc. It works 
> brilliantly:
> >
> > http://public.perforce.com/guest/robert_cowham/perforce/API/python/
> > index.html
> >
> > - Don
> >
> >
> > J. Paul Reed wrote:
> >
> >> Hey all:
> >> I've just started playing with scripting some Perforce 
> triggers and 
> >> such with Python. I went with Python because of Perforce's 
> -G option, 
> >> but after playing with it for an afternoon, I'm slightly 
> >> disappointed.
> >> I'm curious if anyone knows:
> >> 1. Why the marshal module was used, as opposed to the 
> pickle/ shelve 
> >> modules?
> >> I'm having problems fetching data from a Perforce ("p4 counters") 
> >> invocation. In further reading the Python documentation, I saw:
> >> [marshal] is not a general ``persistence'' module. For general 
> >> persistence and transfer of Python objects through RPC 
> calls, see the 
> >> modules pickle and shelve. The marshal module exists mainly to 
> >> support reading and writing the ``pseudo-compiled'' code 
> for Python 
> >> modules of .pyc files. Therefore, the Python maintainers 
> reserve the 
> >> right to modify the marshal format in backward incompatible ways 
> >> should the need arise. If you're serializing and de-serializing 
> >> Python objects, use the pickle module instead.
> >> I'm wondering if my problems (namely that my counters 
> invocation only 
> >> returns the first counter) are related to possible changes 
> that may 
> >> have been made to the Python interpreter in 2.3.x that are 
> >> incompatible with the binary marshaled data Perforce is dumping.
> >> 2. Am I the only one that finds the structure of the 
> marshaled output 
> >> somewhat... confusing?
> >> The sample trigger on page 102 of 2005.1 Administrator's 
> Guide gives 
> >> a "p4 group -o" invocation with marshaled output; the output dumps 
> >> keys of UserNNN, where N is 0 to the total number of users 
> you have. 
> >> This requires matching against the keys (see if it matches 
> '^User', 
> >> as the sample does) to see if it's a key you want the 
> value to. Why 
> >> wasn't this just put into an array of hashes called 
> "Users"? Is this 
> >> a limitation of the marshal module, or?
> >> I'd be curious to see the reasoning used here; I'm building some 
> >> infrastructure that I rallied behind using Python for, 
> most notably 
> >> because of this convenient marshaling capability, but my initial 
> >> impression of this feature is that it's somewhat incomplete and 
> >> fragile in terms of specific Python interpreter version 
> dependencies, 
> >> and if that's actually a case, that makes this a no-go; I 
> can't have 
> >> infrastructure breaking when we do a
> >> x.y.z+1 Python interpreter upgrade.
> >> Is this accurate or am I doing something wrong?
> >> Later,
> >> Paul
> >>
> >
> > _______________________________________________
> > perforce-user mailing list  -  perforce-user at perforce.com 
> > http://maillist.perforce.com/mailman/listinfo/perforce-user
> >
> 
> 




More information about the p4python mailing list