in Legacy/PlaygroundLogger/build.py [0:0]
def parse(self, args):
self.buildStyle = BuildStyle.fromString(args.build_style)
self.swiftCompiler = os.path.abspath(args.swiftc)
if args.foundation:
self.foundation = os.path.abspath(args.foundation)
else:
X = os.path.split(os.path.abspath(os.path.join(os.path.dirname(self.swiftCompiler),"..")))
self.foundation = os.path.join(X[0],X[1].replace('swift-','foundation-'),'Foundation')
note('foundation defaulted to "%s" based on compiler path' % self.foundation)
if args.build_dir:
self.buildDir = os.path.abspath(args.build_dir)
else:
self.buildDir = "/tmp"
note('build-dir defaulted to /tmp')
if args.swift_build_dir:
self.swiftBuildDir = os.path.abspath(args.swift_build_dir)
else:
self.swiftBuildDir = os.path.abspath(os.path.join(os.path.dirname(self.swiftCompiler),'..'))
note('swift-build-dir defaulted to "%s" based on compiler path' % self.swiftBuildDir)
self.swiftAutolinkExtractPath = os.path.abspath(os.path.join(self.swiftBuildDir,'bin','swift-autolink-extract'))
if args.module_path:
self.moduleInstallPath = os.path.abspath(args.module_path)
else:
self.moduleInstallPath = None
if args.lib_path:
self.libraryInstallPath = os.path.abspath(args.lib_path)
else:
self.libraryInstallPath = None
if not os.path.exists(self.swiftCompiler):
error('%s not a valid compiler path' % self.swiftCompiler)
sys.exit(1)
if not os.path.exists(self.foundation):
error('%s not a valid Foundation path' % self.foundation)
sys.exit(1)
if not os.path.exists(self.swiftBuildDir):
error('%s not a valid swift build path' % self.swiftBuildDir)
sys.exit(1)
if (self.moduleInstallPath and not self.libraryInstallPath) or (self.libraryInstallPath and not self.moduleInstallPath):
warning('both module and lib path required for installation - not installing')