Skip to content

Commit 8ccb178

Browse files
committed
Add get_execution_mode()
1 parent f1e3fcd commit 8ccb178

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

StreamingCommunity/Upload/update.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ async def async_github_requests():
4646
]
4747
return await asyncio.gather(*tasks)
4848

49+
def get_execution_mode():
50+
"""
51+
Determine how the application is being executed.
52+
"""
53+
if getattr(sys, 'frozen', False):
54+
return 'exe'
55+
56+
try:
57+
importlib.metadata.version(__title__)
58+
return 'pip'
59+
except importlib.metadata.PackageNotFoundError:
60+
return 'python'
61+
4962
def update():
5063
"""
5164
Check for updates on GitHub and display relevant information.
@@ -82,6 +95,9 @@ def update():
8295
except importlib.metadata.PackageNotFoundError:
8396
current_version = source_code_version
8497

98+
# Get execution mode
99+
execution_mode = get_execution_mode()
100+
85101
# Get commit details
86102
latest_commit = response_commits[0] if response_commits else None
87103
if latest_commit:
@@ -93,7 +109,7 @@ def update():
93109
console.print(f"\n[cyan]New version available: [yellow]{last_version}")
94110

95111
console.print(f"\n[red]{__title__} has been downloaded [yellow]{total_download_count} [red]times, but only [yellow]{percentual_stars}% [red]of users have starred it.\n\
96-
[green]Current installed version: [yellow]{current_version} [green]last commit: [white]'[yellow]{latest_commit_message.splitlines()[0]}[white]'\n\
112+
[purple]{execution_mode} [yellow]- [green]Current installed version: [yellow]{current_version} [green]last commit: [white]'[yellow]{latest_commit_message.splitlines()[0]}[white]'\n\
97113
[cyan]Help the repository grow today by leaving a [yellow]star [cyan]and [yellow]sharing [cyan]it with others online!")
98114

99115
time.sleep(1)

0 commit comments

Comments
 (0)