in Xcode/AppleDataGatherer.py [0:0]
def main(self):
"""Store the login data file."""
appleIDstring = "appleId={}&".format(quote(self.env["apple_id"]))
appIDKeystring = "appIdKey={}&".format(self.env["appID_key"])
if not self.env.get("password") and not self.env.get("password_file"):
raise ProcessorError(
"You must provide either a password, or a password_file argument."
)
password = self.env.get("password")
if self.env.get("password_file"):
with open(self.env["password_file"]) as f:
password = f.read()
passwordstring = "accountPassword={}".format(password)
login_data = appleIDstring + appIDKeystring + passwordstring
download_dir = os.path.join(self.env["RECIPE_CACHE_DIR"], "downloads")
filename = "login_data"
# create download_dir if needed
if not os.path.exists(download_dir):
try:
os.makedirs(download_dir)
except OSError as err:
raise ProcessorError(
"Can't create %s: %s" % (download_dir, err.strerror)
)
self.output("Writing data to file")
self.env["data_pathname"] = os.path.join(download_dir, filename)
with open(self.env["data_pathname"], "w") as f:
f.write(login_data)