Skip to content

Commit

Permalink
[Test] Use sysconfig get_platform instead of distlib
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Feb 2, 2025
1 parent 7b1d0c3 commit d43351a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import hashlib
import os
import platform
import re
import shutil
import sys
Expand All @@ -26,7 +27,6 @@

import jinja2
import nox
from distlib.util import get_platform

if sys.version_info < (3, 8):
import distutils.sysconfig as dist_sysconfig
Expand All @@ -44,6 +44,12 @@
purity = {"namespace-project-b": True}


def get_platform():
if platform.system() == "Darwin":
return "macosx"
return dist_sysconfig.get_platform()


def get_contents_subs(ext_suffix: str):
if ext_suffix.endswith(".pyd"):
dbg_suffix = ".pdb"
Expand Down Expand Up @@ -74,7 +80,8 @@ def check_pkg_contents(
d = project_dir / "tests" / "expected_contents" / name
template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(d))
normname = re.sub(r"[-_.]+", "_", name).lower()
plat = "none" if pure else get_platform().replace(".", "_").replace("-", "_")
plat = get_platform().replace(".", "_").replace("-", "_")
plat = "none" if pure else plat
subs = get_contents_subs(ext_suffix)
# Compare sdist contents
sdist = Path(f"dist-nox/{normname}-{version}.tar.gz")
Expand Down

0 comments on commit d43351a

Please sign in to comment.