kunapi 1.18__tar.gz → 1.20__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.
Files changed (35) hide show
  1. kunapi-1.20/PKG-INFO +13 -0
  2. {kunapi-1.18 → kunapi-1.20}/kunapi/__init__.py +1 -1
  3. {kunapi-1.18 → kunapi-1.20}/kunapi/app.py +7 -2
  4. {kunapi-1.18 → kunapi-1.20}/kunapi/config/__init__.py +3 -0
  5. {kunapi-1.18 → kunapi-1.20}/kunapi/kunapi.py +31 -98
  6. kunapi-1.20/kunapi.egg-info/PKG-INFO +13 -0
  7. kunapi-1.18/PKG-INFO +0 -30
  8. kunapi-1.18/kunapi.egg-info/PKG-INFO +0 -30
  9. {kunapi-1.18 → kunapi-1.20}/kunapi/Events.py +0 -0
  10. {kunapi-1.18 → kunapi-1.20}/kunapi/common/__init__.py +0 -0
  11. {kunapi-1.18 → kunapi-1.20}/kunapi/common/autoload.py +0 -0
  12. {kunapi-1.18 → kunapi-1.20}/kunapi/common/globals.py +0 -0
  13. {kunapi-1.18 → kunapi-1.20}/kunapi/common/request.py +0 -0
  14. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/__init__.py +0 -0
  15. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/common/__init__.py +0 -0
  16. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/common/autoload.py +0 -0
  17. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/common/model.py +0 -0
  18. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/config/__init__.py +0 -0
  19. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/config/app.py +0 -0
  20. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/__init__.py +0 -0
  21. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/common/__init__.py +0 -0
  22. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/common/autoload.py +0 -0
  23. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/__init__.py +0 -0
  24. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/index/__init__.py +0 -0
  25. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py +0 -0
  26. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py +0 -0
  27. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/index/common/model.py +0 -0
  28. {kunapi-1.18 → kunapi-1.20}/kunapi/tempfile/kunapi/app/index/controller/index/index.py +0 -0
  29. {kunapi-1.18 → kunapi-1.20}/kunapi.egg-info/SOURCES.txt +0 -0
  30. {kunapi-1.18 → kunapi-1.20}/kunapi.egg-info/dependency_links.txt +0 -0
  31. {kunapi-1.18 → kunapi-1.20}/kunapi.egg-info/entry_points.txt +0 -0
  32. {kunapi-1.18 → kunapi-1.20}/kunapi.egg-info/requires.txt +0 -0
  33. {kunapi-1.18 → kunapi-1.20}/kunapi.egg-info/top_level.txt +0 -0
  34. {kunapi-1.18 → kunapi-1.20}/setup.cfg +0 -0
  35. {kunapi-1.18 → kunapi-1.20}/setup.py +0 -0
kunapi-1.20/PKG-INFO ADDED
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: kunapi
3
+ Version: 1.20
4
+ Summary: kunapi
5
+ Home-page: https://docs.kwebapp.cn/index/index/2
6
+ Author: 百里-坤坤
7
+ Author-email: fengkun01@qq.com
8
+ Maintainer: 坤坤
9
+ Maintainer-email: fengkun01@qq.com
10
+ License: MIT License
11
+ Keywords: kunapi1.20
12
+
13
+ kunapi
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = '1.18'
2
+ __version__ = '1.20'
3
3
  try:
4
4
  from .app import web
5
5
  except:pass
@@ -793,8 +793,13 @@ class web:
793
793
  print('\033[37m* 调试器:开启')
794
794
  else:
795
795
  print('\033[37m* 调试器:已关闭')
796
- from waitress import serve
797
- serve(self.__application, host=host, port=port,threads=1,channel_timeout=3600) #框架不支持多线程 所以 threads设为1
796
+ try:
797
+ from waitress import serve
798
+ serve(self.__application, host=host, port=port,threads=1,_quiet=False,channel_timeout=3600) #框架不支持多线程 所以 threads设为1
799
+ except:
800
+ from wsgiref.simple_server import make_server
801
+ self.__httpd = make_server(host, int(port), self.__application)
802
+ self.__httpd.serve_forever()
798
803
  def __http_wsgi(self,host,port,filename):
799
804
  "http——wsgi测试服务 windows建议使用Waitress‌"
800
805
  from wsgiref.simple_server import make_server
@@ -12,6 +12,9 @@ app['cli']=False
12
12
  app['save_cli_pid']=False #是否开启cli运行时保存pid
13
13
  app['temp_folder']='app/runtime/temp' #是否开启cli运行时保存pid
14
14
 
15
+ app['run_cmd']={ #运行命令 b不可修改该出手
16
+ 'server':False
17
+ }
15
18
 
16
19
  #路由配置
17
20
  route={}
@@ -9,10 +9,6 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
9
9
  global fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1
10
10
  if fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr:
11
11
  fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1=fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr
12
- # python_version=platform.python_version()
13
- # if python_version[0:3]!='3.8':
14
- # print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"依赖python3.8,与你现在的python"+python_version+"不兼容")
15
- # exit()
16
12
  if os.name == 'posix' or os.name == 'nt':pass
17
13
  else:
18
14
  print("\033[1;31;40m "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"不支持当前操作系统 在linux或windows系统下运行")
@@ -129,6 +125,8 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
129
125
  print("\033[1;31;40m有关"+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"命令的详细信息,请键入 "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+" help",e)
130
126
  return False
131
127
  else:
128
+ if not path:
129
+ path=os.getcwd()
132
130
  cmd_par={
133
131
  'server':server,
134
132
  'update':update,
@@ -138,46 +136,34 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
138
136
  }
139
137
  if cmd_par['cmd']:
140
138
  if '&&' in cmd_par['cmd']:
141
- for cmds in cmd_par['cmd'].split('&&'):
142
- print('执行命令',cmds.strip())
143
- if cmds[0:3] == 'cd ':
144
- # os.system(cmds)
145
- print('已切换工作目录',cmds[3:])
146
- os.chdir(cmds[3:].strip())
147
- else:
148
- if os.name == 'posix':
149
- if cmd_par['daemonyun']:
150
- with daemon.DaemonContext():
151
- os.system(cmds.strip())
139
+ if os.name == 'posix' and cmd_par['daemonyun']:
140
+ with daemon.DaemonContext():
141
+ os.chdir(cmd_par['path'])
142
+ for cmds in cmd_par['cmd'].split('&&'):
143
+ print('执行命令',cmds.strip())
144
+ if cmds[0:3] == 'cd ':
145
+ print('已切换工作目录',cmds[3:])
146
+ os.chdir(cmds[3:].strip())
152
147
  else:
153
148
  os.system(cmds.strip())
149
+ else:
150
+ for cmds in cmd_par['cmd'].split('&&'):
151
+ print('执行命令',cmds.strip())
152
+ if cmds[0:3] == 'cd ':
153
+ print('已切换工作目录',cmds[3:])
154
+ os.chdir(cmds[3:].strip())
154
155
  else:
155
156
  os.system(cmds.strip())
156
- elif '||' in cmd_par['cmd']:
157
- for cmds in cmd_par['cmd'].split('||'):
158
- print('执行命令',cmds)
159
- if cmds[0:3] == 'cd ':
160
- print('已切换工作目录',cmds[3:])
161
- os.chdir(cmds[3:])
162
- else:
163
- if os.name == 'posix':
164
- if cmd_par['daemonyun']:
165
- with daemon.DaemonContext():
166
- os.system(cmds)
167
- else:
168
- os.system(cmds)
169
- else:
170
- os.system(cmds)
171
157
  else:
172
- print('执行命令',cmd_par['cmd'].strip())
173
- if os.name == 'posix':
174
- if cmd_par['daemonyun']:
175
- with daemon.DaemonContext():
176
- os.system(cmd_par['cmd'].strip())
177
- else:
158
+ if os.name == 'posix' and cmd_par['daemonyun']:
159
+ with daemon.DaemonContext():
160
+ os.chdir(cmd_par['path'])
161
+ print('执行命令',cmd_par['cmd'].strip())
178
162
  os.system(cmd_par['cmd'].strip())
179
163
  else:
164
+ print('执行命令',cmd_par['cmd'].strip())
180
165
  os.system(cmd_par['cmd'].strip())
166
+
181
167
 
182
168
  return cmd_par
183
169
  def temp_get_file(folder='./',lists=[]):
@@ -238,68 +224,10 @@ def cllfunction():
238
224
  print("\033[32m"+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+" --modular api --uninstall 卸载app/api模块")
239
225
  print("\033[32m"+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+" --modular api --plug plug1 --uninstall 卸载app/api/plug1插件\n")
240
226
  else:
241
- import requests,shutil,importlib,traceback
242
- from .common import create,kcwszip,config,kill_route_cli,save_route_cli_pid,get_pid_by_port,kill_pid
243
- if cmd_par['update']:#更新kunapi包:
244
- # print(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1)
245
- # exit()
246
- serall=['kunapi','kwebs','kwebsp']
247
- if fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1 not in serall:
248
- print('不支持该命令')
249
- exit()
250
- for bs in serall:
251
- if 'kunapi'==bs:
252
- response=requests.get("https://gitee.com/open_source_official_website/pypi/raw/master/kunapi.zip")
253
- elif 'kwebs'==bs:
254
- response=requests.get("https://gitee.com/open_source_official_website/pypi/raw/master/kwebs.zip")
255
- elif 'kwebsp'==bs:
256
- response=requests.get("https://gitee.com/open_source_official_website/pypi/raw/master/kwebsp.zip")
257
- f=open(bs+'.zip',"wb")
258
- f.write(response.content)
259
- f.close()
260
- kcwszip.unzip_file(bs+'.zip','')
261
- os.remove(bs+'.zip')
262
- if os.name == 'nt': #windows
263
- os.system("pip uninstall "+bs+" -y")
264
- os.system("python setup.py sdist install")
265
- try:
266
- shutil.rmtree('__pycache__')
267
- except:pass
268
- shutil.rmtree('build')
269
- shutil.rmtree('dist')
270
- shutil.rmtree(bs)
271
- shutil.rmtree(bs+'.egg-info')
272
- os.remove('setup.py')
273
- elif os.name == 'posix': #linux
274
- os.system("pip3.8 uninstall "+bs+" -y")
275
- os.system("python3.8 setup.py sdist install")
276
- try:
277
- shutil.rmtree('__pycache__')
278
- except:pass
279
- shutil.rmtree('build')
280
- shutil.rmtree('dist')
281
- shutil.rmtree(bs)
282
- shutil.rmtree(bs+'.egg-info')
283
- os.remove('setup.py')
284
- # os.system("pip3 uninstall "+bs+" -y")
285
- # sys.argv=['setup.py', 'sdist', 'install']
286
- # import setup
287
- # importlib.reload(setup)
288
- # setup.start()
289
-
290
- # try:
291
- # shutil.rmtree('__pycache__')
292
- # except:pass
293
- # shutil.rmtree('build')
294
- # shutil.rmtree('dist')
295
- # shutil.rmtree(bs)
296
- # shutil.rmtree(bs+'.egg-info')
297
- # os.remove('setup.py')
298
- else:
299
- print("该操作系统不支持更新"+bs)
300
- if bs==fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1:
301
- break
302
- elif cmd_par['server']:#启动web服务
227
+ import shutil,importlib,traceback #requests
228
+ from .common import create,config,kill_route_cli,save_route_cli_pid,get_pid_by_port,kill_pid #kcwszip
229
+ config.app['run_cmd']=cmd_par
230
+ if cmd_par['server']:#启动web服务
303
231
 
304
232
  try:
305
233
 
@@ -363,11 +291,13 @@ def cllfunction():
363
291
  sys.argv=[sys.argv[0], '-w', str(cmd_par['processcount']), '-b', cmd_par['host']+':'+str(cmd_par['port']),'-t',cmd_par['timeout'], 'server:'+cmd_par['appname']]
364
292
  if cmd_par['daemonyun']:
365
293
  with daemon.DaemonContext():
294
+ os.chdir(cmd_par['path'])
366
295
  sys.exit(run())
367
296
  exit()
368
297
  else:
369
298
  sys.exit(run())
370
299
  exit()
300
+
371
301
  else:
372
302
  raise Exception('不支持该操作系统')
373
303
  elif cmd_par['install'] or cmd_par['pack'] or cmd_par['upload'] or cmd_par['uninstall']:
@@ -507,11 +437,13 @@ def cllfunction():
507
437
  if os.name == 'posix':
508
438
  if cmd_par['daemonyun']:
509
439
  with daemon.DaemonContext():
440
+ os.chdir(cmd_par['path'])
510
441
  app.cli(RAW_URI)
511
442
  else:
512
443
  app.cli(RAW_URI)
513
444
  else:
514
445
  app.cli(RAW_URI)
446
+
515
447
  else:#通过命令行执行控制器的方法
516
448
  config.app['cli']=True
517
449
  try:
@@ -546,6 +478,7 @@ def cllfunction():
546
478
  if os.name == 'posix':
547
479
  if cmd_par['daemonyun']:
548
480
  with daemon.DaemonContext():
481
+ os.chdir(cmd_par['path'])
549
482
  app.cli(RAW_URI)
550
483
  else:
551
484
  app.cli(RAW_URI)
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: kunapi
3
+ Version: 1.20
4
+ Summary: kunapi
5
+ Home-page: https://docs.kwebapp.cn/index/index/2
6
+ Author: 百里-坤坤
7
+ Author-email: fengkun01@qq.com
8
+ Maintainer: 坤坤
9
+ Maintainer-email: fengkun01@qq.com
10
+ License: MIT License
11
+ Keywords: kunapi1.20
12
+
13
+ kunapi
kunapi-1.18/PKG-INFO DELETED
@@ -1,30 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: kunapi
3
- Version: 1.18
4
- Summary: kunapi
5
- Home-page: https://docs.kwebapp.cn/index/index/2
6
- Author: 百里-坤坤
7
- Author-email: fengkun01@qq.com
8
- Maintainer: 坤坤
9
- Maintainer-email: fengkun01@qq.com
10
- License: MIT License
11
- Keywords: kunapi1.18
12
- Requires-Dist: gunicorn==20.0.4
13
- Requires-Dist: waitress==3.0.0
14
- Requires-Dist: watchdog==4.0.0
15
- Requires-Dist: filetype==1.2.0
16
- Requires-Dist: psutil==5.9.4
17
- Requires-Dist: requests==2.32.4
18
- Requires-Dist: python-daemon==3.1.2
19
- Dynamic: author
20
- Dynamic: author-email
21
- Dynamic: description
22
- Dynamic: home-page
23
- Dynamic: keywords
24
- Dynamic: license
25
- Dynamic: maintainer
26
- Dynamic: maintainer-email
27
- Dynamic: requires-dist
28
- Dynamic: summary
29
-
30
- kunapi
@@ -1,30 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: kunapi
3
- Version: 1.18
4
- Summary: kunapi
5
- Home-page: https://docs.kwebapp.cn/index/index/2
6
- Author: 百里-坤坤
7
- Author-email: fengkun01@qq.com
8
- Maintainer: 坤坤
9
- Maintainer-email: fengkun01@qq.com
10
- License: MIT License
11
- Keywords: kunapi1.18
12
- Requires-Dist: gunicorn==20.0.4
13
- Requires-Dist: waitress==3.0.0
14
- Requires-Dist: watchdog==4.0.0
15
- Requires-Dist: filetype==1.2.0
16
- Requires-Dist: psutil==5.9.4
17
- Requires-Dist: requests==2.32.4
18
- Requires-Dist: python-daemon==3.1.2
19
- Dynamic: author
20
- Dynamic: author-email
21
- Dynamic: description
22
- Dynamic: home-page
23
- Dynamic: keywords
24
- Dynamic: license
25
- Dynamic: maintainer
26
- Dynamic: maintainer-email
27
- Dynamic: requires-dist
28
- Dynamic: summary
29
-
30
- kunapi
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes