* Convert a WASM-parsed PEP 508 entry to a NormalizedRequirement.
(entry: ParsedReqEntry)
| 127 | * Convert a WASM-parsed PEP 508 entry to a NormalizedRequirement. |
| 128 | */ |
| 129 | function wasmEntryToRequirement(entry: ParsedReqEntry): NormalizedRequirement { |
| 130 | const req: NormalizedRequirement = { |
| 131 | name: entry.name || '', |
| 132 | }; |
| 133 | |
| 134 | if (entry.versionSpec) { |
| 135 | req.version = entry.versionSpec; |
| 136 | } |
| 137 | |
| 138 | if (entry.extras.length > 0) { |
| 139 | req.extras = entry.extras; |
| 140 | } |
| 141 | |
| 142 | if (entry.markers) { |
| 143 | req.markers = entry.markers; |
| 144 | } |
| 145 | |
| 146 | if (entry.url) { |
| 147 | req.url = entry.url; |
| 148 | } |
| 149 | |
| 150 | return req; |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * Parse a single PEP 508 dependency string into a NormalizedRequirement. |