bcmd 0.0.65__py3-none-any.whl → 0.0.67__py3-none-any.whl

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.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

bcmd/tasks/__init__.py CHANGED
@@ -1,5 +1,7 @@
1
1
  # type: ignore
2
2
  from . import bin
3
+ from . import crypto
4
+ from . import debian
3
5
  from . import download
4
6
  from . import json
5
7
  from . import jwt
@@ -7,7 +9,6 @@ from . import lib
7
9
  from . import math
8
10
  from . import mirror
9
11
  from . import proxy
10
- from . import crypto
11
12
  from . import task
12
13
  from . import temp
13
14
  from . import time
bcmd/tasks/debian.py ADDED
@@ -0,0 +1,78 @@
1
+ import os
2
+ from typing import Final
3
+
4
+ from beni import bcolor, bfile, bpath, btask, binput
5
+ from beni.bfunc import syncCall
6
+
7
+ app: Final = btask.newSubApp('Debian 系统管理')
8
+
9
+
10
+ @app.command()
11
+ @syncCall
12
+ async def install_python():
13
+ '安装python脚本'
14
+ pythonZipFile = ''
15
+ pythonName = ''
16
+ pythonVersion = ''
17
+ bcolor.printYellow(f'官网地址:https://www.python.org/downloads/source/')
18
+ bcolor.printYellow(f'先从官网上下载 python 源码压缩包(.tar.xz)')
19
+ while True:
20
+ pythonZipFile = input('输入python压缩文件名(如:Python-3.12.1.tar.xz):').strip()
21
+ if pythonZipFile.endswith('.tar.xz'):
22
+ pythonName = pythonZipFile.replace('.tar.xz', '')
23
+ pythonVersion = '.'.join(pythonName.split('-')[-1].split('.')[:-1])
24
+ break
25
+ else:
26
+ print('输入有误,请重新输入')
27
+ cmdList: list[str] = [
28
+ f'apt update',
29
+ f'apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev -y',
30
+ f'tar -xf {pythonZipFile}',
31
+ f'cd {pythonName}',
32
+ f'./configure --enable-optimizations', # 配置编译选项
33
+ f'make -j `nproc`', # 编译源代码,`nproc` 会利用所有可用的 CPU 核心加快编译速度
34
+ f'make altinstall', # 安装 Python,altinstall 避免替换默认的 python 命令
35
+ f'cd ..',
36
+ f'rm -rf {pythonName}',
37
+ f'rm -rf /usr/local/bin/python',
38
+ f'ln -s /usr/local/bin/python{pythonVersion} /usr/local/bin/python',
39
+ f'rm -rf /usr/local/bin/pip',
40
+ f'ln -s /usr/local/bin/pip{pythonVersion} /usr/local/bin/pip',
41
+ f'python --version',
42
+ f'pip --version',
43
+ f'pip install pipx',
44
+ f'pipx install bcmd',
45
+ ]
46
+ shFile = bpath.desktop(f'install-python-{pythonName}.sh')
47
+ await bfile.writeText(shFile, '\n'.join(cmdList))
48
+ bcolor.printGreen(f'将以下两个文件拷贝到服务器上,然后执行 sh {shFile.name} 即可安装 python')
49
+ print(pythonZipFile)
50
+ print(shFile)
51
+
52
+
53
+ @app.command()
54
+ @syncCall
55
+ async def install_software():
56
+ '安装常用软件'
57
+ await binput.confirm('即将安装这些软件(7z nginx mariadb),是否确认?')
58
+ cmdList: list[str] = [
59
+ f'echo 更新软件包列表',
60
+ f'apt update',
61
+ f'echo 安装 7z',
62
+ f'apt install p7zip-full -y',
63
+ f'echo 安装 nginx',
64
+ f'apt install nginx -y',
65
+ f'systemctl start nginx',
66
+ f'systemctl enable nginx',
67
+ f'systemctl status nginx',
68
+ f'echo 安装 MariaDB',
69
+ f'apt install mariadb-server -y',
70
+ f'systemctl start mariadb',
71
+ f'systemctl enable mariadb',
72
+ f"sed -i 's/bind-address/# bind-address/' /etc/mysql/mariadb.conf.d/50-server.cnf"
73
+ f'systemctl restart mariadb',
74
+ f'systemctl status mariadb',
75
+
76
+ ]
77
+ for cmd in cmdList:
78
+ os.system(cmd)
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.65
3
+ Version: 0.0.67
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
7
7
  Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
- Requires-Dist: benimang ==0.5.17
9
+ Requires-Dist: benimang ==0.5.19
10
10
  Requires-Dist: pathspec
11
11
 
@@ -2,9 +2,10 @@ bcmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  bcmd/main.py,sha256=HfjQAidvC62HhmbjuR-NN3KM5pmqdTn1vaPwWsbp_ko,132
3
3
  bcmd/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  bcmd/common/password.py,sha256=25fA1h9ttZuUobnZ_nA0Ouhmk43etBfGeM40dgxJnFY,1347
5
- bcmd/tasks/__init__.py,sha256=GM2Qt251fgFSNxDPDq372RVbJgmmjL_3BX3HTqsR2WY,268
5
+ bcmd/tasks/__init__.py,sha256=jG-9PrDRlV8sAUScEaZF4RLteMEY4ieOSBUDRmQa-RE,289
6
6
  bcmd/tasks/bin.py,sha256=4O9Doak-ecOTGvyriZf6v31bhTI66s5IsIKV3wW_cu4,3082
7
7
  bcmd/tasks/crypto.py,sha256=IhWtFyfLLUb9xuVdPcvr-D5lZciLDtwxQDoz5SEL7Fg,3127
8
+ bcmd/tasks/debian.py,sha256=B9aMIIct3vNqMJr5hTr1GegXVf20H49C27FMvRRGIzI,3004
8
9
  bcmd/tasks/download.py,sha256=jx3I4sNQiqKPuzqL2rwI8PK5-fXlzpChpeXrZ-MvEso,1052
9
10
  bcmd/tasks/json.py,sha256=WWOyvcZPYaqQgp-Tkm-uIJschNMBKPKtZN3yXz_SC5s,635
10
11
  bcmd/tasks/jwt.py,sha256=NhKbCO7DHS5pFeywyt8S-xaQgRgs5jCe8EN9OOhq4VA,2407
@@ -16,8 +17,8 @@ bcmd/tasks/task.py,sha256=7AelyK8mTVTfERaagkaUUggP8Md3XC9gurgoakMYf_I,4738
16
17
  bcmd/tasks/temp.py,sha256=xLyYo2q6BX6OiaWG8NuyNmUCroVYrmtLzR2cZOUyFow,766
17
18
  bcmd/tasks/time.py,sha256=nSIVYov2LsGdxsZAtC91UKXcUtVAqR9o-JmzeuevFhA,2586
18
19
  bcmd/tasks/venv.py,sha256=aNVYAp0R52IdZ1tJi0fihjaZvy_3LH3L6pyQoS0qZqs,4127
19
- bcmd-0.0.65.dist-info/METADATA,sha256=6ibtTMxsqQC0gJdaJ40_ST6xxFHL_DqnXLmhtNVVyuc,288
20
- bcmd-0.0.65.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
21
- bcmd-0.0.65.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
22
- bcmd-0.0.65.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
23
- bcmd-0.0.65.dist-info/RECORD,,
20
+ bcmd-0.0.67.dist-info/METADATA,sha256=gUB0rROCg2AA8dnMEjXIPfQTSn5FRID_krXmPwdlrAQ,288
21
+ bcmd-0.0.67.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
22
+ bcmd-0.0.67.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
23
+ bcmd-0.0.67.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
24
+ bcmd-0.0.67.dist-info/RECORD,,
File without changes