bcmd 0.0.57__tar.gz → 0.0.58__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.
Potentially problematic release.
This version of bcmd might be problematic. Click here for more details.
- {bcmd-0.0.57 → bcmd-0.0.58}/PKG-INFO +1 -1
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/__init__.py +1 -0
- bcmd-0.0.58/bcmd/tasks/download.py +34 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/pwd.py +1 -1
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/venv.py +15 -4
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/PKG-INFO +1 -1
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/SOURCES.txt +1 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/pyproject.toml +1 -1
- {bcmd-0.0.57 → bcmd-0.0.58}/MANIFEST.in +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/README.md +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/__init__.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/common/__init__.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/common/password.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/main.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/bin.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/json.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/lib.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/math.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/mirror.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/proxy.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/task.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/temp.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/time.py +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/dependency_links.txt +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/entry_points.txt +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/requires.txt +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/top_level.txt +0 -0
- {bcmd-0.0.57 → bcmd-0.0.58}/setup.cfg +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Final
|
|
5
|
+
|
|
6
|
+
import pyperclip
|
|
7
|
+
import typer
|
|
8
|
+
from beni import bcolor, bhttp, bpath, btask
|
|
9
|
+
from beni.bfunc import syncCall
|
|
10
|
+
|
|
11
|
+
app: Final = btask.newSubApp('下载')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@app.command()
|
|
15
|
+
@syncCall
|
|
16
|
+
async def urls(
|
|
17
|
+
path: Path = typer.Option(None, '--path', '-p', help='指定路径,默认当前目录'),
|
|
18
|
+
):
|
|
19
|
+
'下载文件'
|
|
20
|
+
path = path or Path(os.getcwd())
|
|
21
|
+
content = pyperclip.paste()
|
|
22
|
+
urlSet = set([x.strip() for x in content.strip().split('\n') if x.strip()])
|
|
23
|
+
|
|
24
|
+
async def download(url: str):
|
|
25
|
+
file = bpath.get(path, '/'.join([x for x in url.replace('://', '/').split('/') if x]))
|
|
26
|
+
try:
|
|
27
|
+
bcolor.printGreen(url)
|
|
28
|
+
await bhttp.download(url, file)
|
|
29
|
+
except:
|
|
30
|
+
bcolor.printRed(url)
|
|
31
|
+
|
|
32
|
+
await asyncio.gather(*[download(x) for x in urlSet])
|
|
33
|
+
|
|
34
|
+
bcolor.printYellow('Done')
|
|
@@ -23,7 +23,11 @@ async def venv(
|
|
|
23
23
|
quiet: bool = typer.Option(False, '--quiet', '-q', help='是否安静模式'),
|
|
24
24
|
):
|
|
25
25
|
'python 虚拟环境配置'
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
path = path or Path(os.getcwd())
|
|
28
|
+
binPath = path / 'bin'
|
|
29
|
+
binListFile = bpath.get(path, 'bin.list')
|
|
30
|
+
await _inputQiniuPassword(binListFile, binPath)
|
|
27
31
|
packages = packages or []
|
|
28
32
|
for i in range(len(packages)):
|
|
29
33
|
package = packages[i]
|
|
@@ -35,7 +39,6 @@ async def venv(
|
|
|
35
39
|
if disabled_mirror and pipIniFile.is_file():
|
|
36
40
|
bpath.move(pipIniFile, tempFile)
|
|
37
41
|
try:
|
|
38
|
-
path = path or Path(os.getcwd())
|
|
39
42
|
venvPath = bpath.get(path, 'venv')
|
|
40
43
|
assertPath(venvPath)
|
|
41
44
|
if not venvPath.exists() and not quiet:
|
|
@@ -59,12 +62,11 @@ async def venv(
|
|
|
59
62
|
await bexecute.run(f'{pip} freeze > {venvLockFile}')
|
|
60
63
|
|
|
61
64
|
# 下载 bin 文件
|
|
62
|
-
binListFile = bpath.get(path, 'bin.list')
|
|
63
65
|
if binListFile.exists():
|
|
64
66
|
bin.download(
|
|
65
67
|
names=Null,
|
|
66
68
|
file=binListFile,
|
|
67
|
-
output=
|
|
69
|
+
output=binPath,
|
|
68
70
|
)
|
|
69
71
|
|
|
70
72
|
finally:
|
|
@@ -111,3 +113,12 @@ async def _getPackageLatestVersion(package: str):
|
|
|
111
113
|
f'https://pypi.org/pypi/{package}/json'
|
|
112
114
|
)
|
|
113
115
|
return data['info']['version']
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
async def _inputQiniuPassword(binListFile: Path, binPath: Path) -> None:
|
|
119
|
+
'根据需要输入七牛云密码'
|
|
120
|
+
if binListFile.exists():
|
|
121
|
+
aaSet = set([x.strip() for x in (await bfile.readText(binListFile)).strip().split('\n') if x.strip()])
|
|
122
|
+
bbSet = set([x.name for x in bpath.listFile(binPath)])
|
|
123
|
+
if aaSet != bbSet:
|
|
124
|
+
await password.getQiniu()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|