-
-
Save gngrwzrd/6628214 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python | |
#original script by Rob Napier <[email protected]> | |
#updates by github.com/gngrwzrd | |
#Script to link in all your old SDKs every time you upgrade Xcode | |
#Create a directory somewhere to store older SDKs in | |
#Under it, put all the platform directories: | |
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform | |
#Under those, store the SDKs: | |
# MacOSX10.6.sdk MacOSX10.7.sdk MacOSX10.8.sdk iPhoneOS6.1.sdk iPhoneSimulator6.1.sdk etc | |
#run this script like: | |
#python fix-xcode.py --xcode=/Applications/Xcode.app --platforms=/SDKs | |
import argparse,subprocess,os,re | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--xcode',help='path to Xcode',nargs="?") | |
parser.add_argument("--platforms",help="path to platform folders with SDKs",nargs="?") | |
args = parser.parse_args() | |
source_path = args.platforms | |
if re.search("~",source_path): source_path = os.path.expanduser(source_path) | |
source_path = os.path.abspath(source_path) | |
if args.xcode: dest_path = args.xcode | |
else: dest_path = subprocess.check_output(["xcode-select", "--print-path"]).rstrip() | |
if not dest_path.endswith("/Contents/Developer"): dest_path += "/Contents/Developer" | |
for platform in os.listdir(source_path): | |
if re.search("platform",platform) == None: | |
continue | |
#print platform | |
#print "command:" | |
print "ln -sf %(source_path)s/%(platform)s/* %(dest_path)s/Platforms/%(platform)s/Developer/SDKs" % locals() | |
subprocess.call("ln -sf %(source_path)s/%(platform)s/* %(dest_path)s/Platforms/%(platform)s/Developer/SDKs" % locals(), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment