This commit is contained in:
Auric Vente 2024-07-20 09:26:40 -06:00
parent 0ad23a8d7d
commit bdd287976e
3 changed files with 79 additions and 0 deletions

View File

@ -44,6 +44,8 @@ Then a random number between 1 and 10 is picked.
For each number an action happens to produce an update.
The top score is calculated as (Triumph - Hits).
## Technology
This is made with python + qt (pyside6)

8
cromulant/manifest.json Normal file
View File

@ -0,0 +1,8 @@
{
"version": "1.0.0",
"title": "Cromulant",
"program": "cromulant",
"author": "madprops",
"repo": "github.com/madprops/cromulant",
"description": "Toy game about ants"
}

69
setup.py Normal file
View File

@ -0,0 +1,69 @@
from setuptools import setup, find_packages
from pathlib import Path
import shutil
import json
import platform
with open("cromulant/manifest.json", "r") as file:
manifest = json.load(file)
title = manifest["title"]
program = manifest["program"]
version = manifest["version"]
def _post_install():
system = platform.system()
if system == "Linux":
try:
_copy_icon_file()
_create_desktop_file()
except Exception as e:
print(f"Error during post install: {e}")
def _copy_icon_file():
source = Path(f"{program}/img/icon_1.jpg").expanduser().resolve()
destination = Path(f"~/.local/share/icons/{program}.png").expanduser().resolve()
shutil.copy2(source, destination)
def _create_desktop_file():
content = f"""[Desktop Entry]
Version=1.0
Name={title}
Exec={Path(f"~/.local/bin/{program}").expanduser().resolve()}
Icon={Path(f"~/.local/share/icons/{program}.png").expanduser().resolve()}
Terminal=false
Type=Application
Categories=Utility;
"""
file_path = Path(f"~/.local/share/applications/{program}.desktop").expanduser().resolve()
with open(file_path, 'w') as f:
f.write(content)
with open("requirements.txt") as f:
requirements = f.read().splitlines()
package_data = {}
package_data[program] = ["*.png", "*.jpg", "*.json", "*.mp3"]
setup(
name=title,
version=version,
install_requires=requirements,
packages=find_packages(where="."),
package_dir={"": "."},
package_data=package_data,
entry_points={
"console_scripts": [
f"{program}={program}.main:main",
],
},
)
_post_install()