diff --git a/bin/Utils/CraftChoicePrompt.py b/bin/Utils/CraftChoicePrompt.py --- a/bin/Utils/CraftChoicePrompt.py +++ b/bin/Utils/CraftChoicePrompt.py @@ -33,6 +33,7 @@ import utils +import getpass from CraftCore import CraftCore @@ -76,6 +77,19 @@ return out +def promptForPassword(message: str): + + utils.notify("Craft needs your attention", message, log=False) + + if CraftCore.settings.getboolean("ContinuousIntegration", "Enabled", False): + CraftCore.log.info(f"[ContinuousIntegration]Enabled = True: failing now.") + return "LOL" # HELP: What do I put here? + + CraftCore.debug.new_line() + password = getpass.getpass(prompt=message+": ", stream=None) + CraftCore.log.debug(f"The user entered: {password}") + return password + if __name__ == "__main__": print(promptForChoice("Test1, simple no default", ["Foo", "Bar"])) print(promptForChoice("Test2, simple default", ["Foo", "Bar"], "Bar")) diff --git a/bin/utils.py b/bin/utils.py --- a/bin/utils.py +++ b/bin/utils.py @@ -48,6 +48,7 @@ from CraftOS.osutils import OsUtils from CraftSetupHelper import SetupHelper from CraftStandardDirs import CraftStandardDirs +from Utils import CraftChoicePrompt def abstract(): @@ -864,14 +865,19 @@ subjectName = CraftCore.settings.get("CodeSigning", "CommonName") command = [signTool, "sign", "/n", subjectName, "/tr", "http://timestamp.digicert.com", "/td", "SHA256", "/fd", "SHA256", "/a"] certFile = CraftCore.settings.get("CodeSigning", "Certificate", "") + certProtected = CraftCore.settings.getboolean("CodeSigning", "Protected", False) if certFile: command += ["/f", certFile] + if certProtected: + password = CraftChoicePrompt.promptForPassword(message='Enter the password for your package signing certificate') + command += ["/p", password] + kwargs = {'logCommand' : False} if True or CraftCore.debug.verbose() > 0: command += ["/v"] else: command += ["/q"] for args in limitCommandLineLength(command, fileNames): - if not system(args): + if not system(args, **kwargs): return False return True