Skip to content

Commit ad0c48c

Browse files
committed
chore: Add configuration for sdist and wheels
1 parent ce0c3c6 commit ad0c48c

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

pdm_build.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import shutil
2+
import subprocess
3+
import sysconfig
4+
5+
6+
def pdm_build_hook_enabled(context):
7+
# Disable hooks for sdist builds
8+
return context.target != "sdist"
9+
10+
11+
def pdm_build_initialize(context):
12+
context.ensure_build_dir()
13+
# Inject compiled binary into scripts/, so it will be picked up to install
14+
target = context.root / "scripts" / "bids-validator-deno"
15+
16+
deno = shutil.which("deno")
17+
if deno is None:
18+
raise OSError("Deno is not installed or not in PATH")
19+
20+
subprocess.run(
21+
[
22+
deno,
23+
"compile",
24+
"-ERNW",
25+
"--allow-run",
26+
"-o",
27+
str(target),
28+
"src/bids-validator.ts",
29+
],
30+
check=True,
31+
)
32+
33+
# Add the current platform tag so the wheel is specific to the OS/architecture
34+
platform_tag = sysconfig.get_platform().replace("-", "_").replace(".", "_")
35+
context.config_settings["--plat-name"] = platform_tag

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[project]
2+
name = "bids-validator-deno"
3+
description = "Typescript implementation of the BIDS validator"
4+
authors = [
5+
{name = "bids-standard developers"},
6+
]
7+
dependencies = []
8+
readme = "README.md"
9+
license = {text = "MIT"}
10+
classifiers = [
11+
"Development Status :: 5 - Production/Stable",
12+
"Intended Audience :: Science/Research",
13+
"Topic :: Scientific/Engineering :: Bio-Informatics",
14+
"License :: OSI Approved :: MIT License",
15+
"Programming Language :: JavaScript",
16+
]
17+
keywords = ["BIDS", "BIDS validator"]
18+
dynamic = ["version"]
19+
20+
[project.urls]
21+
Documentation = "https://bids-validator.readthedocs.io/"
22+
"Source code" = "https://github.com/bids-standard/bids-validator"
23+
Issues = "https://github.com/bids-standard/bids-validator/issues"
24+
25+
[build-system]
26+
requires = ["pdm-backend"]
27+
build-backend = "pdm.backend"
28+
29+
[tool.pdm]
30+
distribution = true
31+
32+
[tool.pdm.build]
33+
source-includes = ["src/", "deno.json"]
34+
excludes = [".*"]
35+
36+
[tool.pdm.build.wheel-data]
37+
scripts = ["scripts/*"]
38+
39+
[tool.pdm.version]
40+
source = "scm"

0 commit comments

Comments
 (0)