kcws 1.6__tar.gz → 1.8__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: 1.2
2
2
  Name: kcws
3
- Version: 1.6
3
+ Version: 1.8
4
4
  Summary: 超轻量级http框架
5
5
  Home-page: https://docs.kwebapp.cn/index/index/1
6
6
  Author: 百里-坤坤
@@ -9,5 +9,5 @@ Maintainer: 坤坤
9
9
  Maintainer-email: fk1402936534@qq.com
10
10
  License: MIT License
11
11
  Description: kcws是一个由kcwebs抽象出来的超轻量级http框架
12
- Keywords: kcws1.6
12
+ Keywords: kcws1.8
13
13
  Platform: UNKNOWN
@@ -2,6 +2,22 @@
2
2
  import time,hashlib,json,re,os,sys,platform,shutil,requests,importlib,traceback,pip,tarfile,zipfile,signal,psutil,filetype
3
3
  from kcws import config
4
4
  from . import globals
5
+ import subprocess
6
+ def get_pid_by_port(port):
7
+ """获取使用指定端口使用的进程号pid"""
8
+ pid=[]
9
+ strs=subprocess.check_output(f'ss -tulnp | grep '+str(port), shell=True, text=True)
10
+ if strs:
11
+ if '-bash: ss' in strs:
12
+ raise Exception(strs)
13
+ arr=strs.split('pid=')
14
+ if len(arr)>1:
15
+ del arr[0]
16
+ for k in arr:
17
+ pid.append(int(k.split(',')[0]))
18
+ else:
19
+ raise Exception(strs)
20
+ return pid
5
21
  class kcwszip:
6
22
  def __clean_filename(filename):
7
23
  # 移除或替换非法字符
@@ -66,6 +82,30 @@ class kcwszip:
66
82
  elif '[Errno 2] No such file or directory: ' in stre:
67
83
  print('不是有效文件',stre)
68
84
  pass
85
+ elif '[WinError 3] 系统找不到指定的路径' in stre:
86
+ print('系统找不到指定的路径',stre)
87
+ pass
88
+ elif '文件名或扩展名太长' in stre:
89
+ if os.path.exists(diswjj):
90
+ try:
91
+ shutil.rmtree(diswjj)
92
+ except:pass
93
+ try:
94
+ zip_ref.close()
95
+ except:pass
96
+ if os.name == 'nt':
97
+ if not os.path.exists("c:/temp"):
98
+ os.makedirs("c:/temp", exist_ok=True)
99
+ newspath="c:/temp/"+md5(filename)
100
+ print('文件名或扩展名太长,正在复制到 '+newspath+' 重试')
101
+ tempname=newspath+'.zip'
102
+ if not os.path.exists(newspath):
103
+ os.makedirs(newspath, exist_ok=True)
104
+ shutil.copy(filename, tempname)
105
+ return kcwszip.unzip(tempname)
106
+ else:
107
+ print('stre',stre,filename)
108
+ raise Exception(e)
69
109
  else:
70
110
  if os.path.exists(diswjj):
71
111
  try:
@@ -74,6 +114,7 @@ class kcwszip:
74
114
  try:
75
115
  zip_ref.close()
76
116
  except:pass
117
+ print('stre',stre,filename)
77
118
  raise Exception(e)
78
119
  zip_ref.close()
79
120
  except Exception as e:
@@ -27,7 +27,7 @@ route['children']=[]
27
27
 
28
28
  kcws={}
29
29
  kcws['name']='kcws' #项目的名称
30
- kcws['version']='1.6' #项目版本
30
+ kcws['version']='1.8' #项目版本
31
31
  kcws['description']='超轻量级http框架' #项目的简单描述
32
32
  kcws['long_description']='kcws是一个由kcwebs抽象出来的超轻量级http框架' #项目详细描述
33
33
  kcws['license']='MIT License' #开源协议 mit开源
@@ -284,6 +284,12 @@ def cllfunction():
284
284
  # except:pass
285
285
  if __name__ == 'kcws.kcws':
286
286
  kill_route_cli('pid/'+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+'_server_pid')
287
+ try:
288
+ allpid=get_pid_by_port(cmd_par['port'])
289
+ except:pass
290
+ else:
291
+ for kpid in allpid:
292
+ kill_pid(kpid)
287
293
  if types=='-stop':
288
294
  pass
289
295
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: kcws
3
- Version: 1.6
3
+ Version: 1.8
4
4
  Summary: 超轻量级http框架
5
5
  Home-page: https://docs.kwebapp.cn/index/index/1
6
6
  Author: 百里-坤坤
@@ -9,5 +9,5 @@ Maintainer: 坤坤
9
9
  Maintainer-email: fk1402936534@qq.com
10
10
  License: MIT License
11
11
  Description: kcws是一个由kcwebs抽象出来的超轻量级http框架
12
- Keywords: kcws1.6
12
+ Keywords: kcws1.8
13
13
  Platform: UNKNOWN
@@ -10,7 +10,7 @@ from setuptools import setup, find_packages,Extension
10
10
  class setupconfig:
11
11
  kcws={}
12
12
  kcws['name']='kcws' #项目的名称
13
- kcws['version']='1.6' #项目版本
13
+ kcws['version']='1.8' #项目版本
14
14
  kcws['description']='超轻量级http框架' #项目的简单描述
15
15
  kcws['long_description']='kcws是一个由kcwebs抽象出来的超轻量级http框架' #项目详细描述
16
16
  kcws['license']='MIT License' #开源协议 mit开源
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