Skip to content

Commit 0ec0f0a

Browse files
committed
fix deploy target
1 parent a9e38ee commit 0ec0f0a

File tree

2 files changed

+39
-13
lines changed

2 files changed

+39
-13
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ jobs:
115115
if: runner.os == 'Windows'
116116
run: |
117117
uv venv .test-venv
118-
.test-venv\Scripts\activate
119-
uv pip install rtc-wheel\*.whl .\livekit-api .\livekit-protocol
118+
.test-venv\Scripts\Activate.ps1
119+
$wheel = (Get-ChildItem rtc-wheel\*.whl)[0].FullName
120+
uv pip install $wheel .\livekit-api .\livekit-protocol
120121
uv pip install pytest pytest-asyncio numpy matplotlib
121122
shell: pwsh
122123

@@ -137,7 +138,7 @@ jobs:
137138
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
138139
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
139140
run: |
140-
.test-venv\Scripts\activate
141+
.test-venv\Scripts\Activate.ps1
141142
pytest tests/
142143
shell: pwsh
143144

livekit-rtc/hatch_build.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
16+
import platform
1517
import sys
1618

1719
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
@@ -29,17 +31,40 @@ def initialize(self, version, build_data):
2931
build_data["pure_python"] = False
3032
build_data["infer_tag"] = False
3133

32-
# Get the platform tag using hatchling's logic (handles MACOSX_DEPLOYMENT_TARGET, etc.)
33-
from packaging.tags import sys_tags
34+
if sys.platform == "darwin":
35+
plat_tag = self._get_macos_platform_tag()
36+
else:
37+
from packaging.tags import sys_tags
3438

35-
tag = next(
36-
t for t in sys_tags() if "manylinux" not in t.platform and "musllinux" not in t.platform
37-
)
38-
platform = tag.platform
39+
tag = next(
40+
t
41+
for t in sys_tags()
42+
if "manylinux" not in t.platform and "musllinux" not in t.platform
43+
)
44+
plat_tag = tag.platform
3945

40-
if sys.platform == "darwin":
41-
from hatchling.builders.macos import process_macos_plat_tag
46+
build_data["tag"] = f"py3-none-{plat_tag}"
47+
48+
def _get_macos_platform_tag(self):
49+
"""Build macOS platform tag from MACOSX_DEPLOYMENT_TARGET env var."""
50+
deployment_target = os.environ.get("MACOSX_DEPLOYMENT_TARGET")
51+
if not deployment_target:
52+
# Fall back to current macOS version
53+
deployment_target = platform.mac_ver()[0]
54+
# Use only major.minor
55+
parts = deployment_target.split(".")
56+
deployment_target = f"{parts[0]}.{parts[1] if len(parts) > 1 else '0'}"
57+
58+
# Convert version to wheel tag format (e.g., "11.0" -> "11_0")
59+
version_tag = deployment_target.replace(".", "_")
4260

43-
platform = process_macos_plat_tag(platform, compat=True)
61+
# Get architecture
62+
machine = platform.machine()
63+
if machine == "x86_64":
64+
arch = "x86_64"
65+
elif machine == "arm64":
66+
arch = "arm64"
67+
else:
68+
arch = machine
4469

45-
build_data["tag"] = f"py3-none-{platform}"
70+
return f"macosx_{version_tag}_{arch}"

0 commit comments

Comments
 (0)