Skip to content

Commit 37b2f27

Browse files
committed
Get mscl build to wheel working locally...
1 parent 01aa7f5 commit 37b2f27

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ wheels/
1515
# Exclude local .deb and .zip files from mscl:
1616
mscl_release_assets/*.zip
1717
mscl_release_assets/*.deb
18+
19+
# VSCode:
20+
.vscode/
21+
22+
# Exclude build downloaded mscl files:
23+
src/mscl/mscl.py
24+
src/mscl/_mscl.so

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#python-mscl
1+
# python-mscl
22

33
Unofficial Python bindings for the [Microstrain Communication Library](https://www.microstrain.com/developers/microstrain-communication-library).
44

hatch_build.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Specifies a hatch build hook to create the wheel for mscl."""
22

33
import platform
4+
import subprocess
45
import sys
56
from pathlib import Path
67

@@ -65,12 +66,22 @@ def initialize(self, version, build_data):
6566
folder_name = f"mscl-{arch}-{py_version}-{mscl_ver}"
6667

6768
# b) Use PyGithub to download the files from the folder:
68-
self.app.display_info(f"Downloading files for {folder_name}...")
69+
self.app.display_waiting(f"Downloading files for {folder_name}...")
6970

7071
gh = GithubDownloader()
7172
gh.download_assets_from_folder(
7273
tag=mscl_ver,
7374
folder_name=f"mscl_release_assets/{folder_name}",
7475
)
7576

76-
self.display_info("Downloaded files successfully. Building the wheel...")
77+
self.app.display_success("Downloaded files successfully.")
78+
build_data["artifacts"] = ["_mscl.so", "mscl.py"]
79+
80+
# Show all files in the current directory:
81+
# self.app.display_info(f"Files in {Path().cwd()}: {list(Path().cwd().iterdir())}")
82+
83+
# --- STEP 3: Copy the files ("_mscl.so" & "mscl.py") to the src/mscl/ directory: ---
84+
# Move from root (i.e. cwd) to src/mscl
85+
subprocess.run(["mv", "mscl.py", "src/mscl/"], check=True) # noqa: S603, S607
86+
subprocess.run(["mv", "_mscl.so", "src/mscl/"], check=True) # noqa: S603, S607
87+
self.app.display_success("Moved files to src/mscl/ successfully. Building wheel...")

src/mscl/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
def hello() -> str:
2-
return "Hello from mscl!"
1+
from . import mscl
2+
3+
# So user can do `import mscl` instead of `import mscl.mscl`
4+
__all__ = ["mscl"]

0 commit comments

Comments
 (0)