Skip to content

Commit

Permalink
Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shashank40 committed Jun 20, 2024
1 parent fa4a33a commit 869d88e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions build_scripts/get_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
import requests
import json

APP_VERSION_URL = "https://api.github.com/repos/OpenAdaptAI/OpenAdapt/releases?per_page=10&page=1"
APP_VERSION_URL = (
"https://api.github.com/repos/OpenAdaptAI/OpenAdapt/releases?per_page=10&page=1"
)


def get_version() -> str:
"""Get the version of the package."""
return importlib.metadata.version("openadapt")


def get_latest_version() -> str:
response = requests.get(APP_VERSION_URL, stream=True)
data = json.loads(response.text)
return data[0]['tag_name'].replace('v', '')
return data[0]["tag_name"].replace("v", "")


if __name__ == "__main__":
print(get_version())
2 changes: 1 addition & 1 deletion openadapt/app/tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def download_latest_version(self, base_url: str, latest_version: str) -> None:
for data in response.iter_content(block_size):
if CANCEL_APP_DOWNLOAD:
CANCEL_APP_DOWNLOAD = False
break
return
file.write(data)
progress_bar.update(len(data))
unzip_file(local_filename)
Expand Down
3 changes: 3 additions & 0 deletions openadapt/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
import sys
import shutil


def set_permissions(path):
for root, dirs, files in os.walk(path):
for dir in dirs:
os.chmod(os.path.join(root, dir), 0o755)
for file in files:
os.chmod(os.path.join(root, file), 0o755)


def unzip_file(file_path: str) -> None:
if os.path.exists(file_path):
shutil.unpack_archive(file_path, os.path.dirname(file_path))
set_permissions(os.path.dirname(file_path))
print("Unzipped")


def get_root_dir_path() -> pathlib.Path:
"""Get the path to the project root directory."""
if not is_running_from_executable():
Expand Down

0 comments on commit 869d88e

Please sign in to comment.