Skip to content

Fix typos #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/python_redlines/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import platform
import zipfile
import tarfile
from pathlib import Path
from typing import Union, Tuple, Optional

Expand All @@ -28,25 +29,24 @@ def _unzip_binary(self):
arch = 'x64' # Assuming x64 architecture

if os_name == 'linux':
zip_name = f"linux-{arch}-{__version__}.zip"
binary_name = 'linux-64/redlines'
zip_name = f"linux-{arch}-{__version__}.tar.gz"
binary_name = 'linux-x64/redlines'
zip_path = os.path.join(binaries_path, zip_name)
if not os.path.exists(zip_path):
with tarfile.open(zip_path, 'r:gz') as tar_ref:
tar_ref.extractall(target_path)

elif os_name == 'windows':
zip_name = f"win-{arch}-{__version__}.zip"
binary_name = 'win-x64/redlines.exe'
zip_path = os.path.join(binaries_path, zip_name)
if not os.path.exists(zip_path):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(target_path)

else:
raise EnvironmentError("Unsupported OS")

full_binary_path = os.path.join(target_path, binary_name)

if not os.path.exists(full_binary_path):

zip_path = os.path.join(binaries_path, zip_name)

with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(target_path)

return os.path.join(target_path, binary_name)

def run_redline(self, author_tag: str, original: Union[bytes, Path], modified: Union[bytes, Path]) \
Expand Down