From 5442e3340bd8407da0b9d49dedb6bc779c09e278 Mon Sep 17 00:00:00 2001 From: Folltoshe Date: Sun, 17 Nov 2024 20:57:11 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 14 +++++++------- poetry_run.py | 23 ----------------------- run.py | 21 +++++++++++++++++++++ setup.py | 16 ++++++++-------- 4 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 poetry_run.py create mode 100644 run.py diff --git a/package.json b/package.json index 15300fc..a2fdc8e 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "2.0.0.beta-12", "description": "一个适配 LX Music 的 API 后端实现", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "dev": "poetry run python poetry_run.py development", - "prod": "poetry run python poetry_run.py production", - "development": "poetry run python poetry_run.py development", - "production": "poetry run python poetry_run.py production", - "install": "poetry install" + "dev": "python run.py development", + "prod": "python run.py production", + "install": "pip install -r requirements.txt", + "poetry:install": "poetry install", + "poetry:development": "poetry run python run.py development", + "poetry:production": "poetry run python run.py production" } -} \ No newline at end of file +} diff --git a/poetry_run.py b/poetry_run.py deleted file mode 100644 index 87460ae..0000000 --- a/poetry_run.py +++ /dev/null @@ -1,23 +0,0 @@ -import os -import argparse -import subprocess - -def main_production(): - os.environ['CURRENT_ENV'] = 'production' - subprocess.run(["python", "main.py"]) - -def main_development(): - os.environ['CURRENT_ENV'] = 'development' - subprocess.run(["python", "main.py"]) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description="Script to set environment variables and run different environments.") - parser.add_argument("environment", choices=["production", "development"], help="Specify the environment to run.") - args = parser.parse_args() - try: - if args.environment == "production": - main_production() - elif args.environment == "development": - main_development() - except KeyboardInterrupt: - pass diff --git a/run.py b/run.py new file mode 100644 index 0000000..50d840c --- /dev/null +++ b/run.py @@ -0,0 +1,21 @@ +import os +import argparse +import subprocess + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(escription="Script to set environment variables and run different environments.") + parser.add_argument( + "environment", + choices=["production", "development"], + nargs="?", + default="production", + help="Specify the environment to run.", + ) + args = parser.parse_args() + try: + if args.environment: + os.environ["CURRENT_ENV"] = args.environment + subprocess.run(["python", "main.py"]) + except KeyboardInterrupt: + pass diff --git a/setup.py b/setup.py index db29cc6..3ef29ce 100644 --- a/setup.py +++ b/setup.py @@ -9,16 +9,16 @@ except Exception: description = "Description not available" setup( - name='lx_music_api_server_setup', + name="lx_music_api_server_setup", version=version, - scripts=['poetry_run.py'], - author='helloplhm-qwq', - author_email='helloplhm-qwq@outlook.com', + scripts=["run.py"], + author="helloplhm-qwq", + author_email="helloplhm-qwq@outlook.com", description=description, - url='https://github.com/helloplhm-qwq/lx-music-api-server', + url="https://github.com/helloplhm-qwq/lx-music-api-server", classifiers=[ - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", ], )