Skip to content

Commit 2bf6a16

Browse files
committed
pyproject.toml updated, hatch_build.py updated
1 parent f2be78a commit 2bf6a16

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

hatch_build.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,20 @@ def initialize(self, version, build_data):
6060
lua_version = "5.4.8"
6161
lua_src = f"lua-{lua_version}.tar.gz"
6262
lua_checksum = f"lua-{lua_version}.sha256"
63-
root_dir = os.path.dirname(__file__)
64-
package_dir = os.path.join(root_dir, "python_lua_helper")
63+
package_dir = "python_lua_helper"
64+
build_dir = "build"
6565
if current_os == "linux":
6666
print("Linux detected - building Lua from source...")
67-
# Change to root directory
68-
os.chdir(root_dir)
67+
print(f"PWD={os.curdir}")
6968
# Clean/create build directory
70-
build_dir = os.path.join(root_dir, "build")
7169
if os.path.exists(build_dir):
7270
shutil.rmtree(build_dir)
7371
os.makedirs(build_dir, exist_ok=False)
7472
# Download Lua source if it doesn't exist
7573
if not os.path.exists(lua_src):
7674
print(f"Downloading {lua_src}")
7775
self.run(
78-
root_dir,
76+
os.curdir,
7977
"curl",
8078
"-s",
8179
"-L",
@@ -85,15 +83,13 @@ def initialize(self, version, build_data):
8583
)
8684
# Check checksum
8785
print(f"Checking {lua_src}")
88-
self.check_sha256(lua_src, os.path.join(root_dir, lua_checksum))
86+
self.check_sha256(lua_src, lua_checksum)
8987
# Extract archive
9088
shutil.unpack_archive(lua_src, build_dir)
91-
# Change to extracted Lua source directory
9289
lua_build_dir = os.path.join(build_dir, f"lua-{lua_version}")
93-
os.chdir(lua_build_dir)
9490
# Apply patch
9591
print("Applying build patch...")
96-
patch_file = os.path.join(root_dir, "build.patch")
92+
patch_file = os.path.join("..", "..", "build.patch")
9793
self.run(lua_build_dir, "patch", "-p1", "-i", patch_file)
9894
# Build Lua with optimization flags
9995
print("Building Lua...")
@@ -118,9 +114,9 @@ def initialize(self, version, build_data):
118114
)
119115
target_binary = os.path.join(package_dir, "lua.exe")
120116
if arch in ["x86_64", "amd64"]:
121-
source_binary = os.path.join(root_dir, "lua-windows-x86_64")
117+
source_binary = "lua-windows-x86_64"
122118
elif arch in ["i386", "i586", "i686", "x86"]:
123-
source_binary = os.path.join(root_dir, "lua-windows-i686")
119+
source_binary = "lua-windows-i686"
124120
else:
125121
print(
126122
f"Warning: Unsupported Windows architecture '{arch}' - no Lua binary available"

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ source = "vcs"
2323
[tool.hatch.build.targets.sdist]
2424
packages = ["python_lua_helper"]
2525
include = [
26-
"build-mingw.sh",
27-
"*.patch",
28-
"*.sha256",
29-
"lua-windows-*",
26+
"/build-mingw.sh",
27+
"/*.patch",
28+
"/*.sha256",
29+
"/lua-windows-*",
3030
]
3131

3232
[tool.hatch.build.targets.wheel]

0 commit comments

Comments
 (0)