Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Talking to apt-get from Python

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Talking to apt-get from Python

#1 Post by Lavene »

I'm still fooling around with my Python/ Qt front-end to apt-get and I have run into a problem.

I'm starting 'apt-get upgrade' as a process (QProcess to be exact) and it starts ok. The problem is when it asks if you want to continue after presenting the list of what will be done. I try to feed 'y' from within Python to stdin but it does not accept it and aborts.

I've tried to look at the apt sourcecode but I'm not exactly an expert on C++ so it didn't make me any wiser.

Any ideas on how to communicate with apt-get or some pointer to where to look would be greatly apreciated.

Tina :)

jjmac
Posts: 384
Joined: 2005-12-28 23:34
Location: Australia

#2 Post by jjmac »

Sounds interesting. Is this a gui that your've drawn up yourself ?

Can't say much on Python, but with C++ you would be looking at the cin cout istream and ostream objects i would think. They have a set of stream manipulating methods that may be useful.

Running doxygen on the file set in /usr/include/c++ should collect all the relevant comment fields.

But i find it clearer to just grep through the headers directly myself.

Wouldn't you have to send it to pythons standard output, then pipe it in to apt-get ???


jm

Lavene
Site admin
Site admin
Posts: 4958
Joined: 2006-01-04 04:26
Location: Oslo, Norway

#3 Post by Lavene »

Yes, I made the GUI using Qt. It's mainly a learning project for my self, but just for fun I've put up on BerliOS: Tinapt.

So far I just start apt-get as a process and simply read/ write to stdout/ stdin. I plan to rewrite the whole thing using the python-apt module, but it's not very well documented so I haven't figured out how to properly use it yet.

Tina :)

jjmac
Posts: 384
Joined: 2005-12-28 23:34
Location: Australia

#4 Post by jjmac »

Howdy ..


Yes, some nice clean screen shots. Good to see a lack of clutter in a gui for a change.

I would expect you would need some qt wrapper facility to use python code. Some equivalent of the standard system(cons char *) call. But python specific of course. I think they use things called stubs. I haven't been there as yet though so can't be of much use.

>>
it's not very well documented ...
>>

It's almost ironic sometimes. Is it not :)

Good Luck ...


jm

Post Reply