Skip to content

Commit e7660d0

Browse files
committed
Make version variable
1 parent f41a81d commit e7660d0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

_msbuild.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import os
2+
import sys
23
from pymsbuild import *
34
from pymsbuild.dllpack import *
45

56

6-
DLL_NAME = "python314"
7-
EMBED_URL = "https://www.python.org/ftp/python/3.14.3/python-3.14.5-embed-amd64.zip"
7+
DLL_NAME = "python{0.major}{0.minor}".format(sys.version_info)
8+
VER_NUM = "{0.major}.{0.minor}.{0.micro}".format(sys.version_info)
9+
EMBED_URL = f"https://www.python.org/ftp/python/{VER_NUM}/python-{VER_NUM}-embed-amd64.zip"
810

911
def can_embed(tag):
1012
"""Return False if tag doesn't match DLL_NAME and EMBED_URL.
1113
This is used for validation at build time, we don't currently handle
1214
requesting a different build target."""
13-
return tag == "cp314-cp314-win_amd64"
15+
return tag == "cp{0.major}{0.minor}-cp{0.major}{0.minor}-win_amd64".format(
16+
sys.version_info
17+
)
1418

1519

1620
METADATA = {
@@ -454,6 +458,7 @@ def init_PACKAGE(tag=None):
454458
from zipfile import ZipFile
455459
package = tmpdir / tag / "package.zip"
456460
package.parent.mkdir(exist_ok=True, parents=True)
461+
print("Downloading", EMBED_URL)
457462
urlretrieve(EMBED_URL, package)
458463
with ZipFile(package) as zf:
459464
for f in [*embed_files, *runtime_files]:

0 commit comments

Comments
 (0)