(xml_path, info)
| 126 | |
| 127 | |
| 128 | def modify_xml(xml_path, info): |
| 129 | # See |
| 130 | # http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html#//apple_ref/doc/uid/TP40005370-CH100-SW20 |
| 131 | # for all the options you can put here. |
| 132 | |
| 133 | tree = ET.parse(xml_path) |
| 134 | root = tree.getroot() |
| 135 | |
| 136 | title = ET.Element("title") |
| 137 | title.text = f"{info['name']} {info['version']}" |
| 138 | root.append(title) |
| 139 | |
| 140 | license = ET.Element("license", file=info.get("license_file", "No license")) |
| 141 | root.append(license) |
| 142 | |
| 143 | # -- BACKGROUND -- # |
| 144 | # Default setting for the background was using Anaconda's logo |
| 145 | # located at ./osx/MacInstaller.png. If `welcome_image` or |
| 146 | # `welcome_image_text` are not provided, this will still happen. |
| 147 | # However, if the user provides one of those, we will use that instead. |
| 148 | # If no background is desired, set `welcome_image` to None |
| 149 | if "welcome_image" in info: |
| 150 | if not info["welcome_image"]: |
| 151 | background_path = None |
| 152 | else: |
| 153 | write_images(info, PACKAGES_DIR, installer_type="pkg") |
| 154 | background_path = os.path.join(PACKAGES_DIR, "welcome.png") |
| 155 | elif "welcome_image_text" in info: |
| 156 | write_images(info, PACKAGES_DIR, installer_type="pkg") |
| 157 | background_path = os.path.join(PACKAGES_DIR, "welcome.png") |
| 158 | else: |
| 159 | # Default to Anaconda's logo if the keys above were not specified |
| 160 | background_path = join(OSX_DIR, "MacInstaller.png") |
| 161 | |
| 162 | if background_path: |
| 163 | logger.info("Using background image: %s", background_path) |
| 164 | for key in ("background", "background-darkAqua"): |
| 165 | background = ET.Element( |
| 166 | key, file=background_path, scaling="proportional", alignment="center" |
| 167 | ) |
| 168 | root.append(background) |
| 169 | |
| 170 | # -- WELCOME -- # |
| 171 | # The endswith .nsi is for windows specifically. The nsi script will add in |
| 172 | # welcome pages if added. |
| 173 | if "welcome_file" in info and not info["welcome_file"].endswith(".nsi"): |
| 174 | welcome_path = info["welcome_file"] |
| 175 | elif "welcome_text" in info and info["welcome_text"]: |
| 176 | welcome_path = join(PACKAGES_DIR, "welcome.txt") |
| 177 | with open(welcome_path, "w") as f: |
| 178 | f.write(info["welcome_text"]) |
| 179 | else: |
| 180 | welcome_path = None |
| 181 | if info.get("welcome_file", "").endswith(".nsi"): |
| 182 | logger.info("Warning: NSI welcome_file, %s, is ignored.", info["welcome_file"]) |
| 183 | |
| 184 | if welcome_path: |
| 185 | welcome = ET.Element( |
no test coverage detected