devtools-hub 2.7.0__tar.gz → 2.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devtools-hub
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Home-page: https://github.com/jingjing737/devtools-hub
5
5
  Author: jingjing737
6
6
  Requires-Python: >=3.7
@@ -77,6 +77,7 @@ def main():
77
77
  bench 性能测试
78
78
  clean 清理缓存
79
79
  update 检查更新
80
+ selfupdate 一键自更新
80
81
  start 启动服务
81
82
  stop 停止服务
82
83
  """)
@@ -500,15 +501,41 @@ def main():
500
501
  try:
501
502
  latest = urllib.request.urlopen('https://pypi.org/pypi/devtools-hub/json', timeout=5)
502
503
  data = json.loads(latest.read())
503
- version = data['info']['version']
504
- print(f"PyPI 最新版本: {version}")
505
- if version != '2.7.0':
506
- print(f"📦 可更新,运行: pip install --upgrade devtools-hub")
504
+ latest_version = data['info']['version']
505
+ current_version = '2.7.0'
506
+ print(f"当前版本: {current_version}")
507
+ print(f"PyPI 最新版本: {latest_version}")
508
+ if latest_version != current_version:
509
+ print(f"📦 发现新版本 {latest_version},正在更新...")
510
+ # 执行更新
511
+ result = subprocess.run([sys.executable, '-m', 'pip', 'install', '--upgrade', 'devtools-hub'],
512
+ capture_output=True, text=True)
513
+ if result.returncode == 0:
514
+ print("✅ 更新成功!")
515
+ print("💡 运行 'source ~/.zshrc' 使 PATH 生效")
516
+ else:
517
+ print(f"❌ 更新失败: {result.stderr}")
507
518
  else:
508
519
  print("✅ 已是最新版本")
509
520
  except Exception as e:
510
521
  print(f"❌ 检查失败: {e}")
511
522
 
523
+ elif cmd == "selfupdate":
524
+ """自更新命令 - 一键更新自身"""
525
+ print("🔄 正在自更新 devtools-hub...")
526
+ try:
527
+ # 使用 pip 更新
528
+ result = subprocess.run([sys.executable, '-m', 'pip', 'install', '--upgrade', '--force-reinstall', 'devtools-hub'],
529
+ capture_output=True, text=True)
530
+ if result.returncode == 0:
531
+ print("✅ 自更新成功!")
532
+ print("💡 运行 'source ~/.zshrc' 使 PATH 生效")
533
+ else:
534
+ print(f"❌ 自更新失败:")
535
+ print(result.stderr)
536
+ except Exception as e:
537
+ print(f"❌ 自更新异常: {e}")
538
+
512
539
  elif cmd == "start":
513
540
  print("🚀 启动服务...")
514
541
  subprocess.Popen([sys.executable, "-m", "devtools_hub.server"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devtools-hub
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Home-page: https://github.com/jingjing737/devtools-hub
5
5
  Author: jingjing737
6
6
  Requires-Python: >=3.7
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devtools-hub"
7
- version = "2.7.0"
7
+ version = "2.8.0"
8
8
  dependencies = ["flask", "psutil", "requests"]
9
9
  requires-python = ">=3.7"
10
10
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="devtools-hub",
5
- version="2.7.0",
5
+ version="2.8.0",
6
6
  packages=find_packages(),
7
7
  install_requires=["flask", "psutil", "requests"],
8
8
  entry_points={
File without changes
File without changes