Skip to content

Commit 37d2e36

Browse files
committed
pyproject.toml updated, hatch_build.py updated
1 parent e949237 commit 37d2e36

2 files changed

Lines changed: 24 additions & 37 deletions

File tree

hatch_build.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def initialize(self, version, build_data):
5555
current_os = platform.system().lower()
5656
arch = platform.machine().lower()
5757
print(f"OS: {current_os}, arch: {arch}")
58-
lua_dir = os.path.join(os.path.dirname(__file__), "lua")
58+
lua_dir = os.path.join(os.path.dirname(__file__), "python_lua_helper", "lua")
5959
# Build lua for linux
6060
lua_version = "5.4.8"
6161
lua_src = f"lua-{lua_version}.tar.gz"
@@ -115,25 +115,18 @@ def initialize(self, version, build_data):
115115
print(
116116
f"Windows detected (architecture: {arch}) - selecting pre-built Lua binary..."
117117
)
118-
try:
119-
if arch in ["x86_64", "amd64"]:
120-
source_binary = os.path.join(lua_dir, "lua-windows-x86_64")
121-
target_binary = os.path.join(lua_dir, "lua.exe")
122-
elif arch in ["i686", "x86"]:
123-
source_binary = os.path.join(lua_dir, "lua-windows-i686")
124-
target_binary = os.path.join(lua_dir, "lua.exe")
125-
else:
126-
print(
127-
f"Warning: Unsupported Windows architecture '{arch}' - no Lua binary available"
128-
)
129-
return
130-
if os.path.exists(source_binary):
131-
shutil.copy2(source_binary, target_binary)
132-
print(f"Copied {source_binary} to {target_binary}")
133-
else:
134-
print(f"Warning: Source binary not found at {source_binary}")
135-
except Exception as e:
136-
print(f"Error copying Lua binary: {e}")
118+
target_binary = os.path.join(lua_dir, "lua.exe")
119+
if arch in ["x86_64", "amd64"]:
120+
source_binary = os.path.join(lua_dir, "lua-windows-x86_64")
121+
elif arch in ["i386", "i586", "i686", "x86"]:
122+
source_binary = os.path.join(lua_dir, "lua-windows-i686")
123+
else:
124+
print(
125+
f"Warning: Unsupported Windows architecture '{arch}' - no Lua binary available"
126+
)
127+
return
128+
shutil.copy2(source_binary, target_binary)
129+
print(f"Copied {source_binary} to {target_binary}")
137130
else:
138131
print(
139132
f"Warning: Unsupported operating system '{current_os}' - no Lua binary available"

pyproject.toml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,23 @@ Repository = "https://github.com/DarkCaster/Perpetual.git"
2020
[tool.hatch.version]
2121
source = "vcs"
2222

23-
[tool.hatch.build]
24-
include = ["py_lua_helper.py", "test_example.py"]
25-
2623
[tool.hatch.build.targets.sdist]
2724
include = [
28-
"py_lua_helper.py",
29-
"test_example.py",
30-
"loader.lua",
31-
"/test_example",
32-
"/lua/*.sh",
33-
"/lua/*.patch",
34-
"/lua/*.sha256",
35-
"/lua/lua-windows-*",
25+
"python_lua_helper/*.lua",
26+
"python_lua_helper/*.sh",
27+
"python_lua_helper/*.patch",
28+
"python_lua_helper/*.sha256",
29+
"python_lua_helper/lua/lua-windows-*",
3630
]
3731

3832
[tool.hatch.build.targets.wheel]
3933
include = [
40-
"py_lua_helper.py",
41-
"test_example.py",
42-
"loader.lua",
43-
"/test_example",
44-
"/lua/lua.exe",
45-
"/lua/lua",
34+
"python_lua_helper/*.lua",
35+
"python_lua_helper/*.sh",
36+
"python_lua_helper/*.patch",
37+
"python_lua_helper/*.sha256",
38+
"python_lua_helper/lua/lua.exe",
39+
"python_lua_helper/lua/lua",
4640
]
4741

4842
[tool.hatch.build.targets.wheel.hooks.custom]

0 commit comments

Comments
 (0)