Skip to content

Commit 9b1844d

Browse files
Nugetpackage tag conversion temporary fix
1 parent 095bcb8 commit 9b1844d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packaging/nuget/nugetpackage.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
import tempfile
88
import shutil
99
import subprocess
10+
import re
11+
1012
from packaging import Package, Mapping
1113

14+
SEMVER_PREFIX = re.compile(r"^\d+.\d+.\d+")
1215

1316
class NugetPackage (Package):
1417
""" All platforms, archs, et.al, are bundled into one set of
@@ -253,9 +256,9 @@ class NugetPackage (Package):
253256
def __init__(self, version, arts):
254257
if version.startswith('v'):
255258
version = version[1:] # Strip v prefix
256-
# PR-only workaround: if version doesn't start with a digit,
257-
# turn it into a prerelease of 0.0.0 so NuGet accepts it.
258-
if not version[0].isdigit():
259+
# PR-only workaround: if it's not a normal semver like 1.2.3...,
260+
# wrap it as 0.0.0-<tag>
261+
if not SEMVER_PREFIX.match(version):
259262
version = f"0.0.0-{version}"
260263
super(NugetPackage, self).__init__(version, arts)
261264

0 commit comments

Comments
 (0)