Active Topics

 


Reply
Thread Tools
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#51
Originally Posted by hartti View Post
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
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 77 | Thanked: 52 times | Joined on Sep 2009 @ US
#52
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
 

The Following User Says Thank You to hartti For This Useful Post:
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#53
Originally Posted by hartti View Post
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
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#54
anyone know a way to list all repo's and determine enabled v disabled?
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 
Posts: 77 | Thanked: 52 times | Joined on Sep 2009 @ US
#55
let's wait for qwerty12 to answer :-)

Hartti
 

The Following User Says Thank You to hartti For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#56
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.
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following 2 Users Say Thank You to fatalsaint For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#57
Code:
apt-cache policy
Will show active repo's it appears..
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following 3 Users Say Thank You to fatalsaint For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#58
Originally Posted by noobmonkey View Post
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.
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
Posts: 3,428 | Thanked: 2,856 times | Joined on Jul 2008
#59
Originally Posted by qwerty12 View Post
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.)
__________________
If I've helped you or you use any of my packages feel free to help me out.
-----------------------------------------------------------------------------------
Maintaining:
pyRadio - Pandora Radio on your N900, N810 or N800!
 

The Following User Says Thank You to fatalsaint For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#60
Originally Posted by fatalsaint View Post
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.
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
Reply

Tags
code, health check, n900, python


 
Forum Jump


All times are GMT. The time now is 12:24.