maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900) (https://talk.maemo.org/showthread.php?t=44576)

noobmonkey 2010-02-18 23:34

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by hartti (Post 535591)
Ok. Calling that through os.popen() seems to work. Cool.
(I was expecting there to be a python module for getting this without command line stuff :-)

Thanks qwerty12!

Hartti


There is :) - Qwerty's post stated -
"osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION"

But i havn't tried using it :)


At least it works :)

hartti 2010-02-18 23:43

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
I was expecting that there is a method yyyy in module xxxx, which I could just call and get the version number. Like
version = yyyy.xxxx()

I got qwerty12's trick to work with the following code. To me that still looks like calling a command line command from the python code :-)

import os
a = os.popen("osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION")
version = a.next()
a.close()

Hartti

noobmonkey 2010-02-18 23:46

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by hartti (Post 535614)
I was expecting that there is a method yyyy in module xxxx, which I could just call and get the version number. Like
version = yyyy.xxxx()

I got qwerty12's trick to work with the following code. To me that still looks like calling a command line command from the python code :-)

import os
a = os.popen("osso-product-info -q OSSO_PRODUCT_RELEASE_VERSION")
version = a.next()
a.close()

Hartti


AHhh good point - dont think there is an api/lib for everything yet :( - a few i have read looked great until i saw the line (FIX: Blah blah not working, needs to be added)

Work in progress! - if you do find a better way, would be nice to know :D

noobmonkey 2010-02-19 13:03

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
anyone know a way to list all repo's and determine enabled v disabled?

hartti 2010-02-19 16:55

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
let's wait for qwerty12 to answer :-)

Hartti

fatalsaint 2010-02-19 17:19

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Well.. this probably won't work and is certainly overly complicated.. but I don't know of a way to list repo's directly from apt. This makes use of tricks with find and grep, both of which are probably bastardized versions on the N900 and will probably not work.

Code:

#!/usr/bin/python                                                             
import commands                                                               
                                                                               
enabled = commands.getoutput('find /etc/apt -name *.list -exec grep -v "^#" {} \
; | grep -v "^$"')                                                             
disabled = commands.getoutput('find /etc/apt -name *.list -exec grep "^#" {} \;
| grep -Ev "^#\W*$"')                                                         
                                                                               
print "Enabled Repositories \n\n" + enabled                                   
                                                                               
print "\n\nDisabled Repositories \n\n" + disabled

Fortunately.. you could totally python-ify this which would work on the N900... just search for all *.list files in /etc/apt and open them, then look for a # at the beginning of the line. Those with a # are disabled, those without are enabled.

fatalsaint 2010-02-19 17:24

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Code:

apt-cache policy
Will show active repo's it appears..

qwerty12 2010-02-19 17:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 536505)
anyone know a way to list all repo's and determine enabled v disabled?

If you mean disabled in the sense that it's been unticked (well, the "disabled" button for a particular catalogue ticked) in the Application Manager, you can look in the file /etc/hildon-application-manager/catalogues and disabled catalogues will have an <disabled/> element.

fatalsaint 2010-02-19 17:29

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 536920)
If you mean disabled in the sense that it's been unticked in the Application Manager, you can look in the file /etc/hildon-application-manager/catalogues and disabled catalogues will have an <disabled/> element.

That's kind of cool... will that show repo's that are in the normal sources.list as well as hildon-application-manager.list (or whatever that one was called)? Or just those that HAM controls? (I would assume the latter.. but never know.)

qwerty12 2010-02-19 17:31

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 536922)
That's kind of cool... will that show repo's that are in the normal sources.list as well as hildon-application-manager.list (or whatever that one was called)? Or just those that HAM controls? (I would assume the latter.. but never know.)

Pretty sure it's the latter, AFAIK.


All times are GMT. The time now is 19:07.

vBulletin® Version 3.8.8