[protobuf] Extensions with Python

2011-09-05 Thread Dave
Hi, I have a C++ based service that uses messages defined like so

[code]
message RPCMessage {
required string rpcname = 1;
extensions 100 to max;
}
[/code]


[code]


message CustomRPCMessage  {

message Response {
required String id = 1;
required int version = 2;
repeated String data = 3;
}

extend RPCMessage {
repeated Response response = 100;
}
}
[/code]

I want to write a python based script to act as a dummy server for
testing my client.

In C++ I can write:

CustomRPCMessage::Response* response =
message.AddExtension(CustomRPCMessage::response);
response-set_id(My ID);
response-set_version(10);



I've been trying to do the same in python, but can't seem to figure
out how to do it.  The AddExtension method doesn't seem to be
available.  Can anyone point me in the right direction?  Cheers?


At the moment I have
[code]
import CustomMessages_pb2
import RPCMessage_pb2

message = RPCMessage_pb2.RPCMessage()
message.rpcName = 'MyCustomMessage'

message.AddExtension(CustomMessages_pb2.CustomRPCMessage.response)

print 'do something here'
[/code]

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] building .proto files from Visual Studio 2010 for C#

2011-09-05 Thread lasse
How can I setup automatic build of .proto files in Visual Studio 2010?

I can see that protobuf-csharp-port does it but I have problems
finding where is set in the VS2010 GUI.
When I look in the Common.targets file I can find this:

  Target Name=_GenerateSource
Exec Command=$(ProtocExePath) --proto_path=$(ProtosDirectory) --
descriptor_set_out=compiled.pb @(Protos-'%(RelativeDir)%(Filename)%
(Extension)', ' ') WorkingDirectory=$(BuildTempDirectory) /
Exec Command=$(ProtogenExePath) compiled.pb WorkingDirectory=$
(BuildTempDirectory) /
  /Target

but where is it used?

source:  http://code.google.com/p/protobuf-csharp-port/

Lasse

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: building .proto files from Visual Studio 2010 for C#

2011-09-05 Thread Jon Skeet
I don't build it in the GUI anywhere - just building in Visual Studio
doesn't rebuild the proto files.

They only get rebuilt when we manually run the build from the command
line.

Someone *did* mail me with a Visual Studio plugin to do with .proto
files, but I haven't got round to looking at it yet.

Jon

On Sep 5, 4:13 pm, lasse l...@schouw.me wrote:
 How can I setup automatic build of .proto files in Visual Studio 2010?

 I can see that protobuf-csharp-port does it but I have problems
 finding where is set in the VS2010 GUI.
 When I look in the Common.targets file I can find this:

   Target Name=_GenerateSource
     Exec Command=$(ProtocExePath) --proto_path=$(ProtosDirectory) --
 descriptor_set_out=compiled.pb @(Protos-'%(RelativeDir)%(Filename)%
 (Extension)', ' ') WorkingDirectory=$(BuildTempDirectory) /
     Exec Command=$(ProtogenExePath) compiled.pb WorkingDirectory=$
 (BuildTempDirectory) /
   /Target

 but where is it used?

 source:  http://code.google.com/p/protobuf-csharp-port/

 Lasse

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] building .proto files from Visual Studio 2010 for C#

2011-09-05 Thread Lars Schouw
I found this link
http://stackoverflow.com/questions/453820/protocol-buffers-in-c-projects-using-protobuf-net-best-practices-for-code-gene/1139289#1139289


On Mon, Sep 5, 2011 at 9:12 PM, Marc Gravell marc.grav...@gmail.com wrote:

 It is a pain that it is so hard to set up a Custom Tool in VS; I do have
 a custom tool working for protobuf-net, but it is annoying to have to
 install it manually (there's a download on the protobuf-net site). I pinged
 the nuget team to see if we can get something easier, but no hope there, for
 now at least. protobuf-net does *not* generate the same code as Jon's
 version, but it may serve you purposes. Of course, in either case using the
 command-line-tool manually or as part of a basic build script is pretty
 workable too.

 Marc

 On 5 September 2011 16:13, lasse l...@schouw.me wrote:

 How can I setup automatic build of .proto files in Visual Studio 2010?

 I can see that protobuf-csharp-port does it but I have problems
 finding where is set in the VS2010 GUI.
 When I look in the Common.targets file I can find this:

  Target Name=_GenerateSource
Exec Command=$(ProtocExePath) --proto_path=$(ProtosDirectory) --
 descriptor_set_out=compiled.pb @(Protos-'%(RelativeDir)%(Filename)%
 (Extension)', ' ') WorkingDirectory=$(BuildTempDirectory) /
Exec Command=$(ProtogenExePath) compiled.pb WorkingDirectory=$
 (BuildTempDirectory) /
  /Target

 but where is it used?

 source:  http://code.google.com/p/protobuf-csharp-port/

 Lasse

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.




 --
 Regards,

 Marc


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] building .proto files from Visual Studio 2010 for C#

2011-09-05 Thread Lars Schouw
Well well what have we here...
http://code.google.com/p/protobuf-net/source/browse/trunk/ProtoBufGenerator/ProtoBufTool.cs?r=258


On Mon, Sep 5, 2011 at 9:28 PM, Lars Schouw l...@schouw.com wrote:

 I found this link

 http://stackoverflow.com/questions/453820/protocol-buffers-in-c-projects-using-protobuf-net-best-practices-for-code-gene/1139289#1139289


 On Mon, Sep 5, 2011 at 9:12 PM, Marc Gravell marc.grav...@gmail.comwrote:

 It is a pain that it is so hard to set up a Custom Tool in VS; I do have
 a custom tool working for protobuf-net, but it is annoying to have to
 install it manually (there's a download on the protobuf-net site). I pinged
 the nuget team to see if we can get something easier, but no hope there, for
 now at least. protobuf-net does *not* generate the same code as Jon's
 version, but it may serve you purposes. Of course, in either case using the
 command-line-tool manually or as part of a basic build script is pretty
 workable too.

 Marc

 On 5 September 2011 16:13, lasse l...@schouw.me wrote:

 How can I setup automatic build of .proto files in Visual Studio 2010?

 I can see that protobuf-csharp-port does it but I have problems
 finding where is set in the VS2010 GUI.
 When I look in the Common.targets file I can find this:

  Target Name=_GenerateSource
Exec Command=$(ProtocExePath) --proto_path=$(ProtosDirectory) --
 descriptor_set_out=compiled.pb @(Protos-'%(RelativeDir)%(Filename)%
 (Extension)', ' ') WorkingDirectory=$(BuildTempDirectory) /
Exec Command=$(ProtogenExePath) compiled.pb WorkingDirectory=$
 (BuildTempDirectory) /
  /Target

 but where is it used?

 source:  http://code.google.com/p/protobuf-csharp-port/

 Lasse

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.




 --
 Regards,

 Marc




-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] building .proto files from Visual Studio 2010 for C#

2011-09-05 Thread Marc Gravell
I did already mention that one, honest ;p There is a download here:
http://protobuf-net.googlecode.com/files/protobuf-net-VS10.msi

Marc

On 5 September 2011 22:05, Lars Schouw l...@schouw.com wrote:

 Well well what have we here...

 http://code.google.com/p/protobuf-net/source/browse/trunk/ProtoBufGenerator/ProtoBufTool.cs?r=258


 On Mon, Sep 5, 2011 at 9:28 PM, Lars Schouw l...@schouw.com wrote:

 I found this link

 http://stackoverflow.com/questions/453820/protocol-buffers-in-c-projects-using-protobuf-net-best-practices-for-code-gene/1139289#1139289


 On Mon, Sep 5, 2011 at 9:12 PM, Marc Gravell marc.grav...@gmail.comwrote:

 It is a pain that it is so hard to set up a Custom Tool in VS; I do
 have a custom tool working for protobuf-net, but it is annoying to have to
 install it manually (there's a download on the protobuf-net site). I pinged
 the nuget team to see if we can get something easier, but no hope there, for
 now at least. protobuf-net does *not* generate the same code as Jon's
 version, but it may serve you purposes. Of course, in either case using the
 command-line-tool manually or as part of a basic build script is pretty
 workable too.

 Marc

 On 5 September 2011 16:13, lasse l...@schouw.me wrote:

 How can I setup automatic build of .proto files in Visual Studio 2010?

 I can see that protobuf-csharp-port does it but I have problems
 finding where is set in the VS2010 GUI.
 When I look in the Common.targets file I can find this:

  Target Name=_GenerateSource
Exec Command=$(ProtocExePath) --proto_path=$(ProtosDirectory) --
 descriptor_set_out=compiled.pb @(Protos-'%(RelativeDir)%(Filename)%
 (Extension)', ' ') WorkingDirectory=$(BuildTempDirectory) /
Exec Command=$(ProtogenExePath) compiled.pb WorkingDirectory=$
 (BuildTempDirectory) /
  /Target

 but where is it used?

 source:  http://code.google.com/p/protobuf-csharp-port/

 Lasse

 --
 You received this message because you are subscribed to the Google
 Groups Protocol Buffers group.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.




 --
 Regards,

 Marc






-- 
Regards,

Marc

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.