Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carrotsword/42bd308247d76e1f7e5e0e917df90445 to your computer and use it in GitHub Desktop.
Save carrotsword/42bd308247d76e1f7e5e0e917df90445 to your computer and use it in GitHub Desktop.
Xcodeでios appをビルドした結果のmanifest.plistからバンドルバージョンを切り出す。なんかXPathで一発とうわけにいかない(Python 2.7)
#!/usr/bin/python
import xml.etree.ElementTree as ET
import sys
if len(sys.argv) <2 :
sys.exit(1)
def getVersion():
etree = ET.parse(sys.argv[1])
root = etree.getroot()
iter = root.find('dict/array/dict/dict').iter()
for target in iter:
if target.text == 'bundle-version' :
return iter.next().text
return None
print(getVersion())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment