32 lines
726 B
Python
32 lines
726 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Lit install_linux_packages.py et génère un fichier .txt avec les paquets
|
|
Debian/Ubuntu à installer.
|
|
"""
|
|
import re
|
|
import sys
|
|
|
|
READER="install_linux_packages.py"
|
|
OUT="packages.txt"
|
|
|
|
|
|
def main():
|
|
with open(READER, "r", encoding="utf-8") as f:
|
|
content = f.read()
|
|
|
|
# Cherche toutes les lignes du type: DISTRO_ID_DEBIAN: "nom-du-paquet"
|
|
packages = re.findall(r'DISTRO_ID_DEBIAN:\s*"([^"]+)"', content)
|
|
|
|
# Enlève les doublons, trie
|
|
packages = sorted(set(packages))
|
|
|
|
with open(OUT, "w", encoding="utf-8") as f:
|
|
for pkg in packages:
|
|
f.write(pkg + "\n")
|
|
|
|
print(f"{len(packages)} paquets écrits dans {OUT}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|