Skip to content

Commit 596de09

Browse files
committed
Build wheel distribution
1 parent ce0c3c6 commit 596de09

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

pdm_build.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import subprocess
2+
import sysconfig
3+
4+
5+
def pdm_build_hook_enabled(context):
6+
return context.target != "sdist"
7+
8+
9+
def pdm_build_initialize(context):
10+
context.ensure_build_dir()
11+
target = context.root / "scripts" / "bids-validator-deno"
12+
13+
try:
14+
subprocess.run(
15+
[
16+
"deno",
17+
"compile",
18+
"-ERNW",
19+
"--allow-run",
20+
"-o",
21+
str(target),
22+
"src/bids-validator.ts",
23+
],
24+
check=True,
25+
)
26+
except FileNotFoundError:
27+
raise OSError("Deno is not installed or not in PATH")
28+
29+
platform_tag = sysconfig.get_platform().replace("-", "_").replace(".", "_")
30+
context.config_settings["--plat-name"] = platform_tag

pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[project]
2+
name = "bids-validator-deno"
3+
description = "Default template for PDM package"
4+
authors = [
5+
{name = "Christopher J. Markiewicz", email = "[email protected]"},
6+
]
7+
dependencies = []
8+
requires-python = ">=3.9"
9+
readme = "README.md"
10+
license = {text = "MIT"}
11+
dynamic = ["version"]
12+
13+
[build-system]
14+
requires = ["pdm-backend"]
15+
build-backend = "pdm.backend"
16+
17+
[tool.pdm]
18+
distribution = true
19+
20+
[tool.pdm.build]
21+
source-includes = ["src/", "deno.json"]
22+
excludes = [".*"]
23+
24+
[tool.pdm.build.wheel-data]
25+
scripts = ["scripts/*"]
26+
27+
[tool.pdm.version]
28+
source = "scm"

0 commit comments

Comments
 (0)