Search all packages for duplicate links to "pyfile". Duplicates are links that would overwrite "pyfile". To test on duplicity the package-folder and link-name of twolinks are compared (link.name). So this method returns a list of all links with equal
(self, pyfile)
| 45 | self.log_info(_("No duplicates found")) |
| 46 | |
| 47 | def find_duplicate(self, pyfile): |
| 48 | """Search all packages for duplicate links to "pyfile". |
| 49 | Duplicates are links that would overwrite "pyfile". |
| 50 | To test on duplicity the package-folder and link-name |
| 51 | of twolinks are compared (link.name). |
| 52 | So this method returns a list of all links with equal |
| 53 | package-folders and filenames as "pyfile", but except |
| 54 | the data for "pyfile" iotselöf. |
| 55 | It does MOT check the link's status. |
| 56 | """ |
| 57 | for pinfo in self.pyload.api.getQueue(): |
| 58 | #: Check if package-folder equals pyfile's package folder |
| 59 | if pinfo.folder != pyfile.package().folder: |
| 60 | continue |
| 61 | |
| 62 | #: Now get packaged data w/ files/links |
| 63 | pdata = self.pyload.api.getPackageData(pinfo.pid) |
| 64 | for link in pdata.links: |
| 65 | #: Check if link == "skipped" |
| 66 | if link.status != 4: |
| 67 | continue |
| 68 | |
| 69 | #: Check if link name collides with pdata's name |
| 70 | #: and at last check if it is not pyfile itself |
| 71 | if link.name == pyfile.name and link.fid != pyfile.id: |
| 72 | return link |
| 73 | |
| 74 | def _create_pyFile(self, pylink): |
| 75 | return PyFile(self.pyload.files, |
no test coverage detected