[+] Rust launcher
This commit is contained in:
parent
89cced9950
commit
a0db219ba3
2 changed files with 28 additions and 3 deletions
|
|
@ -1,9 +1,31 @@
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from . import main
|
from . import main
|
||||||
from .color_util import printc
|
from .color_util import printc
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
def run_py():
|
||||||
try:
|
try:
|
||||||
main.run()
|
main.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
printc('&cThe program is interrupted by ^C, exiting...')
|
printc('&cThe program is interrupted by ^C, exiting...')
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
def run_rust():
|
||||||
|
# Find the rust executable
|
||||||
|
pd = Path(__file__).parent.joinpath('rust')
|
||||||
|
pd = pd.joinpath('hyfetch.exe' if platform.system() == 'Windows' else 'hyfetch')
|
||||||
|
if not pd.exists():
|
||||||
|
printc('&cThe rust executable is not found, falling back to python...')
|
||||||
|
run_py()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Run the rust executable
|
||||||
|
os.system(str(pd))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
run_py()
|
||||||
|
|
|
||||||
5
setup.py
5
setup.py
|
|
@ -6,6 +6,7 @@ from setuptools import setup, find_namespace_packages
|
||||||
HERE = Path(__file__).parent
|
HERE = Path(__file__).parent
|
||||||
|
|
||||||
# Load version without importing it (see issue #192 if you are confused)
|
# Load version without importing it (see issue #192 if you are confused)
|
||||||
|
VERSION = ""
|
||||||
for l in (HERE / 'hyfetch' / '__version__.py').read_text().strip().splitlines():
|
for l in (HERE / 'hyfetch' / '__version__.py').read_text().strip().splitlines():
|
||||||
exec(l)
|
exec(l)
|
||||||
|
|
||||||
|
|
@ -32,6 +33,7 @@ setup(
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
],
|
],
|
||||||
packages=find_namespace_packages(exclude=("tools", "tools.*")),
|
packages=find_namespace_packages(exclude=("tools", "tools.*")),
|
||||||
package_data={'hyfetch': ['hyfetch/*']},
|
package_data={'hyfetch': ['hyfetch/*']},
|
||||||
|
|
@ -46,7 +48,8 @@ setup(
|
||||||
],
|
],
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"hyfetch=hyfetch.main:run",
|
"hyfetch.py=hyfetch:run_py",
|
||||||
|
"hyfetch=hyfetch:run_rust",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
scripts=['hyfetch/scripts/neowofetch']
|
scripts=['hyfetch/scripts/neowofetch']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue