sycommon-python-lib 0.2.2a8__py3-none-any.whl → 0.2.2a10__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.
nexus/__init__.py CHANGED
@@ -1,83 +1,21 @@
1
- import aiohttp
2
- import asyncio
3
- import random
4
- import argparse
1
+ import subprocess
5
2
  import sys
6
3
  import os
7
4
  import glob
5
+ import argparse
8
6
 
9
7
 
10
8
  NEXUS_URL = "http://192.168.2.174:8081"
11
- USERNAME = "T3N1bGNvZGUueGlhbw=="
12
- PASSWORD = "T3N1bGNvZGUueGlhb0AxMjM="
9
+ USERNAME = "Osulcode.xiao"
10
+ PASSWORD = "Osulcode.xiao@123"
13
11
  REPOSITORY = "shengye"
14
12
 
15
13
 
16
- async def upload(file_path: str, nexus_url: str = NEXUS_URL,
17
- username: str = USERNAME, password: str = PASSWORD,
18
- repository: str = REPOSITORY) -> bool:
19
- if not os.path.exists(file_path):
20
- print(f"File not found: {file_path}")
21
- return False
22
-
23
- jar = aiohttp.CookieJar(unsafe=True)
24
- async with aiohttp.ClientSession(cookie_jar=jar) as session:
25
- async with session.get(f"{nexus_url}/") as resp:
26
- resp.raise_for_status()
27
-
28
- async with session.post(
29
- f"{nexus_url}/service/rapture/session",
30
- data={"username": username, "password": password},
31
- ) as resp:
32
- resp.raise_for_status()
33
-
34
- csrf_token = str(random.random())
35
- session.cookie_jar.update_cookies(
36
- {"NX-ANTI-CSRF-TOKEN": csrf_token},
37
- response_url=aiohttp.client.URL(nexus_url),
38
- )
39
-
40
- filename = os.path.basename(file_path)
41
- data = aiohttp.FormData()
42
- data.add_field("NX-ANTI-CSRF-TOKEN", csrf_token)
43
- data.add_field(
44
- "asset0", open(file_path, "rb"),
45
- filename=filename, content_type="application/octet-stream",
46
- )
47
-
48
- async with session.post(
49
- f"{nexus_url}/service/rest/internal/ui/upload/{repository}",
50
- data=data,
51
- ) as resp:
52
- status = resp.status
53
- text = await resp.text()
54
-
55
- if status in (200, 204):
56
- print(f"Upload successful: {filename} -> {repository}")
57
- return True
58
- else:
59
- print(f"Upload failed ({status}): {text}")
60
- return False
61
-
62
-
63
14
  def main():
64
- parser = argparse.ArgumentParser(
65
- prog="nexus-upload",
66
- description="上传 whl 包到 Nexus 仓库",
67
- )
68
- parser.add_argument(
69
- "file", nargs="?", default=None,
70
- help="whl 文件路径 (默认: dist/*.whl 中最新的)",
71
- )
72
- parser.add_argument(
73
- "--url", default=NEXUS_URL,
74
- help=f"Nexus 地址 (默认: {NEXUS_URL})",
75
- )
76
- parser.add_argument(
77
- "-r", "--repository", default=REPOSITORY,
78
- help=f"仓库名称 (默认: {REPOSITORY})",
79
- )
80
-
15
+ parser = argparse.ArgumentParser(prog="sypublish", description="上传 whl 到 Nexus")
16
+ parser.add_argument("file", nargs="?", help="whl 文件路径 (默认: dist/*.whl 中最新的)")
17
+ parser.add_argument("--url", default=NEXUS_URL, help=f"Nexus 地址 (默认: {NEXUS_URL})")
18
+ parser.add_argument("-r", "--repository", default=REPOSITORY, help=f"仓库名称 (默认: {REPOSITORY})")
81
19
  args = parser.parse_args()
82
20
 
83
21
  if args.file:
@@ -89,8 +27,13 @@ def main():
89
27
  sys.exit(1)
90
28
  file_path = dist_files[-1]
91
29
 
92
- ok = asyncio.run(upload(file_path, nexus_url=args.url, repository=args.repository))
93
- sys.exit(0 if ok else 1)
30
+ if not os.path.exists(file_path):
31
+ print(f"File not found: {file_path}")
32
+ sys.exit(1)
33
+
34
+ repo_url = f"{args.url}/repository/{args.repository}/"
35
+ cmd = ["twine", "upload", "--repository-url", repo_url, file_path, "-u", USERNAME, "-p", PASSWORD]
36
+ sys.exit(subprocess.call(cmd))
94
37
 
95
38
 
96
39
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sycommon-python-lib
3
- Version: 0.2.2a8
3
+ Version: 0.2.2a10
4
4
  Summary: Add your description here
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -22,7 +22,7 @@ Requires-Dist: langgraph>=1.1.9
22
22
  Requires-Dist: langgraph-checkpoint-redis>=0.4.1
23
23
  Requires-Dist: ldap3>=2.9.1
24
24
  Requires-Dist: loguru>=0.7.3
25
- Requires-Dist: mysql-connector-python>=9.7.0
25
+ Requires-Dist: mysql-connector-python>=9.6.0
26
26
  Requires-Dist: nacos-sdk-python<3.0,>=2.0.11
27
27
  Requires-Dist: psutil>=7.2.2
28
28
  Requires-Dist: pyxxl>=0.4.6
@@ -37,6 +37,7 @@ Requires-Dist: starlette[full]>=1.0.0
37
37
  Requires-Dist: tiktoken>=0.12.0
38
38
  Requires-Dist: uvicorn>=0.46.0
39
39
  Requires-Dist: wecom-aibot-python-sdk>=1.0.2
40
+ Requires-Dist: twine>=6.2.0
40
41
 
41
42
  # sycommon-python-lib
42
43
 
@@ -58,7 +58,7 @@ command/templates/web/client/__init__.py.tpl,sha256=m9P-4q99LnDPLX5npZCmHL4LClPo
58
58
  command/templates/web/model/__init__.py.tpl,sha256=So9EvAU5fSd3Y6uMNwdVJ37kP9xXUiux6m8SQE03HyE,21
59
59
  command/templates/web/tools/__init__.py.tpl,sha256=A_YW5Gb8wmc9FwtRi7lkiCz8otVgwQgSqdtzkNrmkHs,27
60
60
  command/templates/web/tools/mq.py.tpl,sha256=FQpV_dXpDzC-b7kWtSLylhqBCLgUN6GyRhrD9l7CQqw,653
61
- nexus/__init__.py,sha256=sJu1BSSovRMcJ5eBxLFMLAkYajWNSXAeev5gg0yJ80M,2826
61
+ nexus/__init__.py,sha256=MDZdgwMEFUSPvQ2ovibj7GE-4X4JX6ihNAB6GwVPa9g,1225
62
62
  sycli/__init__.py,sha256=mKtD5rrPbg4cF_FrYku5KJrcovLjVdJHvOPW8dit3zY,81
63
63
  sycli/__main__.py,sha256=sYL4dyeRvAN2ef71s2_K8plLCzlaVcuYo7_y6VGz9Tg,115
64
64
  sycli/cli.py,sha256=Uk0y6I8IK1PlPkwW6rqC93yOkgaCZnj7f39C-sv18d0,21642
@@ -253,8 +253,8 @@ sycommon/tools/syemail.py,sha256=BDFhgf7WDOQeTcjxJEQdu0dQhnHFPO_p3eI0-Ni3LhQ,561
253
253
  sycommon/tools/timing.py,sha256=OiiE7P07lRoMzX9kzb8sZU9cDb0zNnqIlY5pWqHcnkY,2064
254
254
  sycommon/xxljob/__init__.py,sha256=7eoBlQxv-B39IfRSCY2bkqdGYs1QRe1umAWd88VMEEM,86
255
255
  sycommon/xxljob/xxljob_service.py,sha256=JIEJaGXhqrTLcyxlyynSrsHg9bBnDNzX-D4qIWLRPUE,6815
256
- sycommon_python_lib-0.2.2a8.dist-info/METADATA,sha256=0j9efeGI4sLV1DXn0zVz8JrH3mfLMknFVhsmuEK6sU0,7683
257
- sycommon_python_lib-0.2.2a8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
258
- sycommon_python_lib-0.2.2a8.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
259
- sycommon_python_lib-0.2.2a8.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
260
- sycommon_python_lib-0.2.2a8.dist-info/RECORD,,
256
+ sycommon_python_lib-0.2.2a10.dist-info/METADATA,sha256=Ep2xpmnvXei707kWroc94RD1cDIye01iLwhQwNvINus,7712
257
+ sycommon_python_lib-0.2.2a10.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
258
+ sycommon_python_lib-0.2.2a10.dist-info/entry_points.txt,sha256=gsR4SssKxDWjRU8ggidzNcdMXDPRSKRS7UaGyNP84Qg,92
259
+ sycommon_python_lib-0.2.2a10.dist-info/top_level.txt,sha256=RgphKrg7nJyZ7irJqbxFr-5H2LUYTvI7ivoWZH2hcD0,29
260
+ sycommon_python_lib-0.2.2a10.dist-info/RECORD,,