Created
January 11, 2017 12:30
-
-
Save MuhammetDilmac/27c2c68effcfd62fbc700e85c888722b to your computer and use it in GitHub Desktop.
Pisi pspec.xml dosyasından build dependency'leri çekip ekrana yazan python scripti
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
import xml.etree.ElementTree as ET | |
# Argüman kontrolü | |
if not len(sys.argv) == 2: | |
print("[!] Argüman sayısı uyumsuz. Uygulamaya argüman olarak dosya yolunu vermelisiniz.") | |
print("[+] Kullanımı: python3 %s pspec.xml" % sys.argv[0]) | |
sys.exit() | |
# Dosya kontrolü | |
file = sys.argv[1] | |
if not os.path.isfile(file): | |
print("[!] %s Bir Dosya Değil!" % file) | |
sys.exit() | |
# Parse | |
try: | |
xml = ET.parse(file) | |
root = xml.getroot() | |
build_dependencies = root.findall('Source/BuildDependencies/Dependency') | |
print("[+] Bulunan Kurulum Bağımlılığı Sayısı: %s" % len(build_dependencies)) | |
print("[+] Bağımlılıklar:") | |
for dependency in build_dependencies: | |
print(" %s" % dependency.text) | |
except: | |
print("[!] Dosya parse edilemedi!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment