修复初始化

This commit is contained in:
root 2024-04-03 03:08:06 +08:00
parent 0a5b040a57
commit 8d47fae37f
5 changed files with 29 additions and 27 deletions

1
.gitignore vendored
View File

@ -5,4 +5,5 @@ pmpt.egg-info/
*.tar.g *.tar.g
*.pyc *.pyc
*.whl *.whl
venv/
__pycache__/ __pycache__/

View File

@ -10,10 +10,11 @@ from . import search as searchs
import datetime import datetime
import webbrowser import webbrowser
import time import time
util.init()
@click.group() @click.group()
def cli(): def cli():
today = datetime.datetime.today() 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/') webbrowser.open('https://ys.mihoyo.com/')
util.console.print('[green]Genshinactivate[/green]') util.console.print('[green]Genshinactivate[/green]')
time.sleep(0.7) time.sleep(0.7)

View File

@ -49,7 +49,14 @@ def init():
os.makedirs(os.path.join(dirs.user_data_dir,'Index'),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_config_dir,exist_ok=True)
os.makedirs(dirs.user_cache_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): def bubbleSort(arr):
for i in range(1,len(arr)): for i in range(1,len(arr)):
for j in range(0, len(arr)-i): for j in range(0, len(arr)-i):

View File

@ -1,8 +1,18 @@
platformdirs certifi==2024.2.2
requests charset-normalizer==3.3.2
moyanlib click==8.1.7
click dill==0.3.8
dill idna==3.6
tqdm loguru==0.7.2
rich markdown-it-py==3.0.0
loguru 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

View File

@ -1,20 +1,6 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from setuptools.command.install import install
import os
from pmpt import util 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( setup(
name='pmpt', # 包的名称 name='pmpt', # 包的名称
version=util.__version__, # 版本号 version=util.__version__, # 版本号
@ -39,8 +25,5 @@ setup(
'console_scripts': [ 'console_scripts': [
'pmpt=pmpt:cli', 'pmpt=pmpt:cli',
], ],
},
cmdclass={
'install': CustomInstallCommand,
} }
) )