Skip to content

Commit 99ada5e

Browse files
committed
Build wheel distribution
1 parent ce0c3c6 commit 99ada5e

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

pdm_build.py

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