diff --git a/.gitignore b/.gitignore index 20edcef..58d60cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ old/ -probe.py +VoidServiceControl/main.py __pycache__ .idea +.venv +probe.py diff --git a/VoidServiceControl/classes.py b/VoidServiceControl/classes.py index 0ce440f..d2bbd99 100644 --- a/VoidServiceControl/classes.py +++ b/VoidServiceControl/classes.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import importlib.resources import json from enum import Enum from os import listdir as ls @@ -6,6 +7,7 @@ from subprocess import run as execute from subprocess import PIPE from sys import argv + from VoidServiceControl.env import * @@ -164,10 +166,10 @@ class Translate(object): @property def __translation(self): try: - with open(f"VoidServiceControl/languages/{self.lang}.json", "r", encoding="utf-8") as json_file: + with importlib.resources.open_text(__package__, f"{self.lang}.json", "utf-8") as json_file: return json.loads(json_file.read()) except FileNotFoundError: - with open(f"VoidServiceControl/languages/en_US.json", "r", encoding="utf-8") as json_file: + with importlib.resources.open_text(__package__, f"en_US.json", "utf-8") as json_file: return json.loads(json_file.read()) diff --git a/VoidServiceControl/languages/en_US.json b/VoidServiceControl/en_US.json similarity index 100% rename from VoidServiceControl/languages/en_US.json rename to VoidServiceControl/en_US.json diff --git a/VoidServiceControl/languages/ru_RU.json b/VoidServiceControl/ru_RU.json similarity index 100% rename from VoidServiceControl/languages/ru_RU.json rename to VoidServiceControl/ru_RU.json diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f716069 --- /dev/null +++ b/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup( + name='VoidServiceControl', + version='0.2', + url='https://git.orudo.ru/trueold89/void-service-control', + author='trueold89', + author_email='trueold89@orudo.ru', + description="A simple script that will allow you to manage runit services in Void Linux", + packages=['VoidServiceControl'], + long_description=open('README.md').read(), + entry_points={ + "console_scripts": ["vsc = VoidServiceControl.main:main"] + }, + package_data={ + 'VoidServiceControl': ['*.json'], + }, +)