Changeset View
Changeset View
Standalone View
Standalone View
bin/Packager/CollectionPackagerBase.py
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | 77 | class CollectionPackagerBase(PackagerBase): | |||
---|---|---|---|---|---|
193 | 193 | | |||
194 | def _filterQtBuildType(self, filename): | 194 | def _filterQtBuildType(self, filename): | ||
195 | if not self.__deployQtSdk: | 195 | if not self.__deployQtSdk: | ||
196 | return True | 196 | return True | ||
197 | filename = OsUtils.toNativePath(filename) | 197 | filename = OsUtils.toNativePath(filename) | ||
198 | if self.__qtSdkDir not in filename: | 198 | if self.__qtSdkDir not in filename: | ||
199 | return True | 199 | return True | ||
200 | 200 | | |||
201 | if self.isBinary(filename): | 201 | if utils.isBinary(filename): | ||
202 | if not CraftCore.cache.findApplication("dependencies"): | 202 | if not CraftCore.cache.findApplication("dependencies"): | ||
203 | raise BlueprintException("Deploying a QtSdk depends on dev-util/dependencies", CraftPackageObject.get("dev-util/dependencies")) | 203 | raise BlueprintException("Deploying a QtSdk depends on dev-util/dependencies", CraftPackageObject.get("dev-util/dependencies")) | ||
204 | _, imports = CraftCore.cache.getCommandOutput("dependencies", f"-imports {filename}") | 204 | _, imports = CraftCore.cache.getCommandOutput("dependencies", f"-imports {filename}") | ||
205 | rt = CollectionPackagerBase.reMsvcDebugRt.findall(imports) | 205 | rt = CollectionPackagerBase.reMsvcDebugRt.findall(imports) | ||
206 | out = False | 206 | out = False | ||
207 | if self.buildType() == "Debug": | 207 | if self.buildType() == "Debug": | ||
208 | out = rt is not [] | 208 | out = rt is not [] | ||
209 | else: | 209 | else: | ||
210 | out = not rt | 210 | out = not rt | ||
211 | if not out: | 211 | if not out: | ||
212 | CraftCore.log.debug(f"Skipp {filename} as it has the wrong build type: {rt}") | 212 | CraftCore.log.debug(f"Skipp {filename} as it has the wrong build type: {rt}") | ||
213 | return out | 213 | return out | ||
214 | return True | 214 | return True | ||
215 | 215 | | |||
216 | def isBinary(self, fileName): | | |||
217 | if os.path.islink(fileName): | | |||
218 | return False | | |||
219 | _, ext = os.path.splitext(fileName) | | |||
220 | if CraftCore.compiler.isWindows: | | |||
221 | if ext in {".dll", ".exe"}: | | |||
222 | return True | | |||
223 | else: | | |||
224 | if ext in {".so", ".dylib"} or os.access(fileName, os.X_OK): | | |||
225 | return True | | |||
226 | return False | | |||
227 | | ||||
228 | def traverse(self, root, whitelist=lambda f: True, blacklist=lambda g: False): | 216 | def traverse(self, root, whitelist=lambda f: True, blacklist=lambda g: False): | ||
229 | """ | 217 | """ | ||
230 | Traverse through a directory tree and return every | 218 | Traverse through a directory tree and return every | ||
231 | filename that the function whitelist returns as true and | 219 | filename that the function whitelist returns as true and | ||
232 | which do not match blacklist entries | 220 | which do not match blacklist entries | ||
233 | """ | 221 | """ | ||
234 | dirs = [root] | 222 | dirs = [root] | ||
235 | while dirs: | 223 | while dirs: | ||
Show All 20 Lines | 239 | def copyFiles(self, srcDir, destDir, dontStrip) -> bool: | |||
256 | CraftCore.log.debug("Copying %s -> %s" % (srcDir, destDir)) | 244 | CraftCore.log.debug("Copying %s -> %s" % (srcDir, destDir)) | ||
257 | 245 | | |||
258 | doSign = CraftCore.compiler.isWindows and CraftCore.settings.getboolean("CodeSigning", "Enabled", False) | 246 | doSign = CraftCore.compiler.isWindows and CraftCore.settings.getboolean("CodeSigning", "Enabled", False) | ||
259 | 247 | | |||
260 | for entry in self.traverse(srcDir, self.whitelisted, self.blacklisted): | 248 | for entry in self.traverse(srcDir, self.whitelisted, self.blacklisted): | ||
261 | entry_target = os.path.join(destDir, os.path.relpath(entry, srcDir)) | 249 | entry_target = os.path.join(destDir, os.path.relpath(entry, srcDir)) | ||
262 | if not utils.copyFile(entry, entry_target, linkOnly=False): | 250 | if not utils.copyFile(entry, entry_target, linkOnly=False): | ||
263 | return False | 251 | return False | ||
264 | if self.isBinary(entry_target): | 252 | if utils.isBinary(entry_target): | ||
265 | if CraftCore.compiler.isGCCLike() and not dontStrip: | 253 | if CraftCore.compiler.isGCCLike() and not dontStrip: | ||
266 | self.strip(entry_target) | 254 | self.strip(entry_target) | ||
267 | if doSign: | 255 | if doSign: | ||
268 | utils.sign([entry_target]) | 256 | utils.sign([entry_target]) | ||
269 | return True | 257 | return True | ||
270 | 258 | | |||
271 | def internalCreatePackage(self, seperateSymbolFiles=False) -> bool: | 259 | def internalCreatePackage(self, seperateSymbolFiles=False) -> bool: | ||
272 | """ create a package """ | 260 | """ create a package """ | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |