From 94b8f9a301cd334f6eceff9563e03ffdc7f1159b Mon Sep 17 00:00:00 2001 From: Tim Bess Date: Sat, 3 Aug 2024 20:48:40 -0400 Subject: [PATCH] Fix data directory name for qualified versions Signed-off-by: Andrew Stein --- tools/perspective-scripts/repack_wheel.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/perspective-scripts/repack_wheel.mjs b/tools/perspective-scripts/repack_wheel.mjs index 62e5b8ce31..2229a39429 100644 --- a/tools/perspective-scripts/repack_wheel.mjs +++ b/tools/perspective-scripts/repack_wheel.mjs @@ -12,14 +12,20 @@ import { execSync } from "node:child_process"; import * as fs from "node:fs"; +import * as path from "node:path"; +import pkg from "../../package.json" assert { type: "json" }; + +const __dirname = new URL(".", import.meta.url).pathname; const wheel_file = fs.readdirSync(".").filter((x) => x.endsWith(".whl"))[0]; const pkg_name = wheel_file.split("-").slice(0, 2).join("-"); execSync(`wheel unpack ${wheel_file}`); fs.cpSync( - "rust/perspective-python/perspective.data", - `${pkg_name}/perspective.data`, + path.join(__dirname, "../../rust/perspective-python/perspective.data"), + `${pkg_name}/perspective_python-${pkg.version.replace(/-rc\.\d+/, (x) => + x.replace("-", "").replace(".", "") + )}.data`, { recursive: true } );