void (@Nullable ProjectSettingsStepBase<T> step, @NotNull ProjectGeneratorPeer<T> projectGeneratorPeer) { if (!(step instanceof ProjectSpecificSettingsStep settingsStep)) return; if (step instanceof PythonProjectSpecificSettingsStep) { // has to be set before project generation boolean welcomeScript = PropertiesComponent.getInstance().getBoolean("PyCharm.NewProject.Welcome", false); PyWelcomeSettings.getInstance().setCreateWelcomeScriptForEmptyProject(welcomeScript); } final DirectoryProjectGenerator generator = settingsStep.getProjectGenerator(); Sdk sdk = settingsStep.getSdk(); if (generator instanceof PythonProjectGenerator) { final BooleanFunction<PythonProjectGenerator> beforeProjectGenerated = ((PythonProjectGenerator<?>)generator).beforeProjectGenerated(sdk); if (beforeProjectGenerated != null) { final boolean result = beforeProjectGenerated.fun((PythonProjectGenerator)generator); if (!result) { Messages.showWarningDialog(PyBundle.message("project.cannot.be.generated"), PyBundle.message("error.in.project.generation")); return; } } } final Object settings = computeProjectSettings(generator, settingsStep, projectGeneratorPeer); final Project newProject = generateProject(settingsStep, settings); if (settings instanceof PyNewProjectSettings) { sdk = ((PyNewProjectSettings)settings).getSdk(); } if (generator instanceof PythonProjectGenerator && sdk == null && newProject != null) { final PyNewProjectSettings newSettings = (PyNewProjectSettings)((PythonProjectGenerator<?>)generator).getProjectSettings(); ((PythonProjectGenerator<?>)generator).createAndAddVirtualEnv(newProject, newSettings); sdk = newSettings.getSdk(); } if (newProject != null && generator instanceof PythonProjectGenerator) { SdkConfigurationUtil.setDirectoryProjectSdk(newProject, sdk); ((PythonProjectGenerator<?>)generator).afterProjectGenerated(newProject); } if (step instanceof PythonProjectSpecificSettingsStep newStep) { // init git repostory if (PropertiesComponent.getInstance().getBoolean("PyCharm.NewProject.Git", false)) { ModuleManager moduleManager = ModuleManager.getInstance(newProject); Optional<Module> module = Arrays.stream(moduleManager.getModules()).findFirst(); module.ifPresent((value -> { ModuleRootManager rootManager = ModuleRootManager.getInstance(value); Arrays.stream(rootManager.getContentRoots()).findFirst().ifPresent(root -> { PythonProjectSpecificSettingsStep.initializeGit(newProject, root); }); })); } } }