Skip to content

Commit f7f41b8

Browse files
committed
Improve support for SourceForge URLs in url2purl #139
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent ca1e7e3 commit f7f41b8

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
0.13.4 (2024-01-08)
5+
-------------------
6+
7+
- Improve support for SourceForge URLs in `url2purl`.
8+
https://github.com/package-url/packageurl-python/issues/139
9+
410
0.13.3 (2024-01-04)
511
-------------------
612

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = packageurl-python
3-
version = 0.13.3
3+
version = 0.13.4
44
license = MIT
55
description = A purl aka. Package URL parser and builder
66
long_description = file:README.rst

src/packageurl/contrib/url2purl.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,18 @@ def build_pypi_purl(uri):
361361
register_pattern("sourceforge", sourceforge_download_pattern)
362362

363363

364+
# https://sourceforge.net/projects/spacesniffer/files/spacesniffer_1_3_0_2.zip/download
365+
sourceforge_download_pattern_bis = (
366+
r"^https?://.*sourceforge.net/projects/"
367+
r"(?P<name>.+)/"
368+
r"files/"
369+
r"(?i:(?P=name))_*(?P<version>[0-9_]+).*"
370+
r"(/download)$" # ending with "/download"
371+
)
372+
373+
register_pattern("sourceforge", sourceforge_download_pattern_bis)
374+
375+
364376
@purl_router.route("https?://.*sourceforge.net/project/.*")
365377
def build_sourceforge_purl(uri):
366378
# We use a more general route pattern instead of using `sourceforge_pattern`

tests/contrib/data/url2purl.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
"https://sourceforge.net/projects/turbovnc/files/3.1/turbovnc-3.1.tar.gz/download": "pkg:sourceforge/turbovnc@3.1",
176176
"https://sourceforge.net/projects/ventoy/files/v1.0.96/Ventoy%201.0.96%20release%20source%20code.tar.gz/download": "pkg:sourceforge/ventoy@1.0.96",
177177
"https://sourceforge.net/projects/geoserver/files/GeoServer/2.23.4/geoserver-2.23.4-war.zip/download": "pkg:sourceforge/geoserver@2.23.4",
178+
"https://sourceforge.net/projects/spacesniffer/files/spacesniffer_1_3_0_2.zip/download": "pkg:sourceforge/spacesniffer@1_3_0_2",
178179
"https://crates.io/api/v1/crates/rand/0.7.2/download": "pkg:cargo/rand@0.7.2",
179180
"https://crates.io/api/v1/crates/clap/2.33.0/download": "pkg:cargo/clap@2.33.0",
180181
"https://crates.io/api/v1/crates/structopt/0.3.11/download": "pkg:cargo/structopt@0.3.11",

0 commit comments

Comments
 (0)