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.

Files changed (28) hide show
  1. {bcmd-0.0.57 → bcmd-0.0.58}/PKG-INFO +1 -1
  2. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/__init__.py +1 -0
  3. bcmd-0.0.58/bcmd/tasks/download.py +34 -0
  4. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/pwd.py +1 -1
  5. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/venv.py +15 -4
  6. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/PKG-INFO +1 -1
  7. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/SOURCES.txt +1 -0
  8. {bcmd-0.0.57 → bcmd-0.0.58}/pyproject.toml +1 -1
  9. {bcmd-0.0.57 → bcmd-0.0.58}/MANIFEST.in +0 -0
  10. {bcmd-0.0.57 → bcmd-0.0.58}/README.md +0 -0
  11. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/__init__.py +0 -0
  12. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/common/__init__.py +0 -0
  13. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/common/password.py +0 -0
  14. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/main.py +0 -0
  15. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/bin.py +0 -0
  16. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/json.py +0 -0
  17. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/lib.py +0 -0
  18. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/math.py +0 -0
  19. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/mirror.py +0 -0
  20. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/proxy.py +0 -0
  21. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/task.py +0 -0
  22. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/temp.py +0 -0
  23. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd/tasks/time.py +0 -0
  24. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/dependency_links.txt +0 -0
  25. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/entry_points.txt +0 -0
  26. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/requires.txt +0 -0
  27. {bcmd-0.0.57 → bcmd-0.0.58}/bcmd.egg-info/top_level.txt +0 -0
  28. {bcmd-0.0.57 → bcmd-0.0.58}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.57
3
+ Version: 0.0.58
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -1,5 +1,6 @@
1
1
  # type: ignore
2
2
  from . import bin
3
+ from . import download
3
4
  from . import json
4
5
  from . import lib
5
6
  from . import math
@@ -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')
@@ -9,7 +9,7 @@ from beni import bcolor, btask
9
9
  from beni.bfunc import magicSequence, syncCall
10
10
  from rich.console import Console
11
11
 
12
- app: Final = btask.newSubApp('lib 工具')
12
+ app: Final = btask.newSubApp('密钥')
13
13
 
14
14
 
15
15
  _KEY_SALT = '_salt_@#%@#xafDGAz.nq'
@@ -23,7 +23,11 @@ async def venv(
23
23
  quiet: bool = typer.Option(False, '--quiet', '-q', help='是否安静模式'),
24
24
  ):
25
25
  'python 虚拟环境配置'
26
- await password.getQiniu()
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=path / 'bin',
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bcmd
3
- Version: 0.0.57
3
+ Version: 0.0.58
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -13,6 +13,7 @@ bcmd/common/__init__.py
13
13
  bcmd/common/password.py
14
14
  bcmd/tasks/__init__.py
15
15
  bcmd/tasks/bin.py
16
+ bcmd/tasks/download.py
16
17
  bcmd/tasks/json.py
17
18
  bcmd/tasks/lib.py
18
19
  bcmd/tasks/math.py
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.0.57'
6
+ version = '0.0.58'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
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