diff --git a/.gitignore b/.gitignore index 51d302c..bb3d601 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ pmpt.egg-info/ *.tar.g *.pyc *.whl +venv/ __pycache__/ \ No newline at end of file diff --git a/pmpt/__init__.py b/pmpt/__init__.py index 12c37ba..a19a3a6 100644 --- a/pmpt/__init__.py +++ b/pmpt/__init__.py @@ -10,10 +10,11 @@ from . import search as searchs import datetime import webbrowser import time +util.init() @click.group() def cli(): today = datetime.datetime.today() - if today.month == 4 and today.day == 2: + if today.month == 9 and today.day == 28: webbrowser.open('https://ys.mihoyo.com/') util.console.print('[green]Genshin!activate![/green]') time.sleep(0.7) diff --git a/pmpt/util.py b/pmpt/util.py index 783267d..552bdd4 100644 --- a/pmpt/util.py +++ b/pmpt/util.py @@ -49,7 +49,14 @@ def init(): os.makedirs(os.path.join(dirs.user_data_dir,'Index'),exist_ok=True) os.makedirs(dirs.user_config_dir,exist_ok=True) os.makedirs(dirs.user_cache_dir,exist_ok=True) - + if not os.path.exists(os.path.join(dirs.user_config_dir,'Source.json')): + open(os.path.join(dirs.user_config_dir,'Source.json'),'w').write('[]') + from . import source + source.add("https://pypi.org/simple",1) + + if not os.path.exists(os.path.join(dirs.user_config_dir,'api.url')): + open(os.path.join(dirs.user_config_dir,'api.url'),'w').write('https://pypi.org/pypi/{}/json') + def bubbleSort(arr): for i in range(1,len(arr)): for j in range(0, len(arr)-i): diff --git a/requirements.txt b/requirements.txt index 3c17a59..8f39f60 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,18 @@ -platformdirs -requests -moyanlib -click -dill -tqdm -rich -loguru \ No newline at end of file +certifi==2024.2.2 +charset-normalizer==3.3.2 +click==8.1.7 +dill==0.3.8 +idna==3.6 +loguru==0.7.2 +markdown-it-py==3.0.0 +mdurl==0.1.2 +moyanlib==1.5.1712028240 +platformdirs==4.2.0 +psutil==5.9.8 +pyasn1==0.6.0 +Pygments==2.17.2 +requests==2.31.0 +rich==13.7.1 +rsa==4.9 +tqdm==4.66.2 +urllib3==2.2.1 diff --git a/setup.py b/setup.py index befda45..280e872 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,6 @@ from setuptools import setup, find_packages -from setuptools.command.install import install -import os from pmpt import util -class CustomInstallCommand(install): - def run(self): - install.run(self) # 在安装过程中执行你想要的代码 - dirs = util.dirs - os.makedirs(dirs.user_data_dir,exist_ok=True) - os.makedirs(os.path.join(dirs.user_data_dir,'Index'),exist_ok=True) - os.makedirs(dirs.user_config_dir,exist_ok=True) - os.makedirs(dirs.user_cache_dir,exist_ok=True) - open(os.path.join(dirs.user_config_dir,'Source.json'),'w').write('["https://pypi.org/simple/"]') - open(os.path.join(dirs.user_config_dir,'api.url'),'w').write('https://pypi.org/pypi/{}/json') - - setup( name='pmpt', # 包的名称 version=util.__version__, # 版本号 @@ -39,8 +25,5 @@ setup( 'console_scripts': [ 'pmpt=pmpt:cli', ], - }, - cmdclass={ - 'install': CustomInstallCommand, } )