Photonium Masse atomique : 0 uma | Bonsoir,
Juste parce que je voulais m'amuser avec python, j'ai fait ceci. Code :
- #!/usr/bin/python
- """ Allow to list all packages which are in non-free or contrib
- """
- import os
- #version=0.2
- def listNonFree():
- "list all non-free installed packages"
- allFree=1
- notInstall=0
- status=""
- section=""
- f=open("/var/lib/dpkg/status",'r')
- for line in f:
- if line.split("Package: ",1)[0] == '':
- pkg = line.split("Package: ",1)[1]
- pkg = pkg[:len(pkg)-1]
- notInstall=0
-
- if notInstall:
- continue
-
- if line.split("Status: ",1)[0] == '':
- status = line.split("Status: ",1)[1]
- if status.split("install ok installed",1)[0] == '':
- notInstall=0
- else:
- notInstall=1
- if line.split("Section: ",1)[0] == '':
- section = line.split("Section: ",1)[1]
- if section.split("non-free",1)[0] == '' and not notInstall:
- print pkg + " is non-free"
- allFree=0
- if allFree:
- print "Hey Max, you're free"
- def listContrib():
- "list all installed packages from contrib"
- noContrib=1
- notInstall=0
- status=""
- section=""
- f=open("/var/lib/dpkg/status",'r')
- for line in f:
- if line.split("Package: ",1)[0] == '':
- pkg = line.split("Package: " )[1]
- pkg = pkg[:len(pkg)-1]
- notInstall=0
-
- if notInstall:
- continue
-
- if line.split("Status: ",1)[0] == '':
- status = line.split("Status: ",1)[1]
- if status.split("install ok installed",1)[0] == '':
- notInstall=0
- else:
- notInstall=1
- if line.split("Section: ",1)[0] == '':
- section = line.split("Section: ",1)[1]
- if section.split("contrib",1)[0] == '' and not notInstall:
- print pkg + " is in contrib"
- noContrib=0
- if noContrib:
- print "Hey Max, you have no packages from contrib. Very Well!"
-
- if __name__ == "__main__":
- listNonFree()
- listContrib()
|
Evidemment, je suis pas clean (même si je travaille çà ).
Code :
- sl-modem-modules-2.6.16 is non-free
- sl-modem-source is non-free
- sl-modem-daemon is non-free
- sun-j2sdk1.5 is non-free
- azureus is in contrib
- flashplugin-nonfree is in contrib
|
Ca donne quoi chez vous ? Message édité par Photonium le 04-05-2006 à 00:03:04 ---------------
A savoir : la dimension de Hausdorff du chou-fleur a été calculée et vaut 2.33
|