Skip to content

Commit 624990d

Browse files
Add support for macOS in build and extraction process (#2)
The code has been updated to include support for macOS in the build and extraction process of the project. A new section is added to perform build and compression for macOS, in addition to existing mechanisms for Windows and Linux. The extraction method in engines.py is also modified to handle macOS specific binaries.
1 parent 660bae3 commit 624990d

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

build_differ.py

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ def main():
5252
print("Building for Windows...")
5353
run_command('dotnet publish ./csproj -c Release -r win-x64 --self-contained')
5454

55+
# Build for macOS
56+
print("Building for macOS...")
57+
run_command('dotnet publish ./csproj -c Release -r osx-x64 --self-contained')
58+
5559
# Compress the Linux build
5660
linux_build_dir = './csproj/bin/Release/net8.0/linux-x64'
5761
compress_files(linux_build_dir, f"./dist/linux-x64-{version}.tar.gz")
@@ -60,6 +64,10 @@ def main():
6064
windows_build_dir = './csproj/bin/Release/net8.0/win-x64'
6165
compress_files(windows_build_dir, f"./dist/win-x64-{version}.zip")
6266

67+
# Compress the macOS build
68+
macos_build_dir = './csproj/bin/Release/net8.0/osx-x64'
69+
compress_files(macos_build_dir, f"./dist/osx-x64-{version}.tar.gz")
70+
6371
print("Build and compression complete.")
6472

6573

dist/linux-x64-0.0.1.tar.gz

-36.6 KB
Binary file not shown.

dist/osx-x64-0.0.1.tar.gz

64.7 MB
Binary file not shown.

dist/win-x64-0.0.1.zip

-36 KB
Binary file not shown.

src/python_redlines/engines.py

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ def _unzip_binary(self):
4444
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
4545
zip_ref.extractall(target_path)
4646

47+
elif os_name == 'darwin':
48+
zip_name = f"osx-{arch}-{__version__}.tar.gz"
49+
binary_name = 'osx-x64/redlines'
50+
zip_path = os.path.join(binaries_path, zip_name)
51+
if not os.path.exists(zip_path):
52+
with tarfile.open(zip_path, 'r:gz') as tar_ref:
53+
tar_ref.extractall(target_path)
54+
4755
else:
4856
raise EnvironmentError("Unsupported OS")
4957

0 commit comments

Comments
 (0)