修复初始化

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
*.pyc
*.whl
venv/
__pycache__/

View File

@ -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]Genshinactivate[/green]')
time.sleep(0.7)

View File

@ -49,6 +49,13 @@ 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)):

View File

@ -1,8 +1,18 @@
platformdirs
requests
moyanlib
click
dill
tqdm
rich
loguru
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

View File

@ -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,
}
)