kunapi 1.15__tar.gz → 1.17__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.17/PKG-INFO +30 -0
  2. {kunapi-1.15 → kunapi-1.17}/kunapi/__init__.py +1 -1
  3. {kunapi-1.15 → kunapi-1.17}/kunapi/common/autoload.py +15 -3
  4. {kunapi-1.15 → kunapi-1.17}/kunapi/kunapi.py +34 -36
  5. kunapi-1.17/kunapi.egg-info/PKG-INFO +30 -0
  6. {kunapi-1.15 → kunapi-1.17}/setup.py +1 -1
  7. kunapi-1.15/PKG-INFO +0 -13
  8. kunapi-1.15/kunapi.egg-info/PKG-INFO +0 -13
  9. {kunapi-1.15 → kunapi-1.17}/kunapi/Events.py +0 -0
  10. {kunapi-1.15 → kunapi-1.17}/kunapi/app.py +0 -0
  11. {kunapi-1.15 → kunapi-1.17}/kunapi/common/__init__.py +0 -0
  12. {kunapi-1.15 → kunapi-1.17}/kunapi/common/globals.py +0 -0
  13. {kunapi-1.15 → kunapi-1.17}/kunapi/common/request.py +0 -0
  14. {kunapi-1.15 → kunapi-1.17}/kunapi/config/__init__.py +0 -0
  15. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/__init__.py +0 -0
  16. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/common/__init__.py +0 -0
  17. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/common/autoload.py +0 -0
  18. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/common/model.py +0 -0
  19. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/config/__init__.py +0 -0
  20. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/config/app.py +0 -0
  21. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/__init__.py +0 -0
  22. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/common/__init__.py +0 -0
  23. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/common/autoload.py +0 -0
  24. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/__init__.py +0 -0
  25. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/index/__init__.py +0 -0
  26. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/index/common/__init__.py +0 -0
  27. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/index/common/autoload.py +0 -0
  28. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/index/common/model.py +0 -0
  29. {kunapi-1.15 → kunapi-1.17}/kunapi/tempfile/kunapi/app/index/controller/index/index.py +0 -0
  30. {kunapi-1.15 → kunapi-1.17}/kunapi.egg-info/SOURCES.txt +0 -0
  31. {kunapi-1.15 → kunapi-1.17}/kunapi.egg-info/dependency_links.txt +0 -0
  32. {kunapi-1.15 → kunapi-1.17}/kunapi.egg-info/entry_points.txt +0 -0
  33. {kunapi-1.15 → kunapi-1.17}/kunapi.egg-info/requires.txt +0 -0
  34. {kunapi-1.15 → kunapi-1.17}/kunapi.egg-info/top_level.txt +0 -0
  35. {kunapi-1.15 → kunapi-1.17}/setup.cfg +0 -0
kunapi-1.17/PKG-INFO ADDED
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: kunapi
3
+ Version: 1.17
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.17
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,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = '1.15'
2
+ __version__ = '1.17'
3
3
  try:
4
4
  from .app import web
5
5
  except:pass
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
- import time,hashlib,json,re,os,platform,shutil,requests,importlib,traceback,tarfile,zipfile,signal,psutil,random
2
+ import time,json,re,os,sys,platform,shutil,requests,importlib,traceback,psutil,random
3
3
  from kunapi import config
4
4
  from . import globals
5
5
  import subprocess
@@ -139,6 +139,7 @@ def md5(strs):
139
139
 
140
140
  return String类型
141
141
  """
142
+ import hashlib
142
143
  m = hashlib.md5()
143
144
  b = strs.encode(encoding='utf-8')
144
145
  m.update(b)
@@ -191,7 +192,8 @@ def get_pid_info(pid,types='pid'):
191
192
  types info表示获取进程信息 否则判断进程号是否存在
192
193
  """
193
194
  if pid:
194
- pid=int(pid)
195
+ try:pid=int(pid)
196
+ except:return False
195
197
  try:
196
198
  if types=='info':
197
199
  p = psutil.Process(pid)
@@ -234,6 +236,7 @@ def kill_pid(pid,retry=60):
234
236
  pid 进程号
235
237
  """
236
238
  if pid:
239
+ import signal
237
240
  for i in range(retry):
238
241
  if 'Linux' in get_sysinfo()['platform']:
239
242
  # os.system("kill -9 "+str(pid))
@@ -323,6 +326,7 @@ class kcwszip:
323
326
  return filename
324
327
  def packzip(src,dst):
325
328
  "压缩"
329
+ import zipfile
326
330
  filelist = []
327
331
  if os.path.isfile(src):
328
332
  filelist.append(src)
@@ -336,6 +340,7 @@ class kcwszip:
336
340
  zf.close()
337
341
  def unzip_file(dst, src,all=True):
338
342
  "解压"
343
+ import zipfile
339
344
  if all:
340
345
  zf = zipfile.ZipFile(dst)
341
346
  zf.extractall(src)
@@ -347,6 +352,7 @@ class kcwszip:
347
352
  zip_ref.close()
348
353
  def unzip(filename):
349
354
  "解压到文件所在目录"
355
+ import zipfile
350
356
  diswjj=''
351
357
  tarr=filename.split('.')
352
358
  i=0
@@ -456,6 +462,7 @@ class kcwstar:
456
462
  :param dst: 压缩文件名
457
463
  :return: bool
458
464
  """
465
+ import tarfile
459
466
  with tarfile.open(dst, "w:gz") as tar:
460
467
  tar.add(src, arcname=os.path.basename(src))
461
468
  return True
@@ -466,6 +473,7 @@ class kcwstar:
466
473
  :param src: 解压后的存放路径
467
474
  :return: bool
468
475
  """
476
+ import tarfile
469
477
  try:
470
478
  t = tarfile.open(dst)
471
479
  t.extractall(path = src)
@@ -649,7 +657,7 @@ class create:
649
657
 
650
658
  plug 插件名
651
659
  """
652
- import pip
660
+ import pip,zipfile
653
661
  plug=str(plug)
654
662
  if os.path.exists(self.project+self.appname+"/"+self.modular+"/controller/"+plug) and not mandatory:
655
663
  return False,"该插件已存在"
@@ -718,6 +726,8 @@ class create:
718
726
  if len(install_requires):
719
727
  try:
720
728
  install_requires.insert(0,"install")
729
+ install_requires.append('-i')
730
+ install_requires.append('https://mirrors.aliyun.com/pypi/simple/')
721
731
  if 0 != pip.main(install_requires):
722
732
  shutil.rmtree(self.project+self.appname+"/"+self.modular+"/controller/"+plug)
723
733
  return False,"依赖包安装错误"
@@ -914,6 +924,8 @@ class create:
914
924
  if len(install_requires):
915
925
  try:
916
926
  install_requires.insert(0,"install")
927
+ install_requires.append('-i')
928
+ install_requires.append('https://mirrors.aliyun.com/pypi/simple/')
917
929
  if 0 != pip.main(install_requires):
918
930
  shutil.rmtree(self.project+self.appname+"/"+self.modular)
919
931
  return False,"模块依赖包安装错误"
@@ -129,8 +129,6 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
129
129
  print("\033[1;31;40m有关"+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+"命令的详细信息,请键入 "+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+" help",e)
130
130
  return False
131
131
  else:
132
- if not path:
133
- path=os.getcwd()
134
132
  cmd_par={
135
133
  'server':server,
136
134
  'update':update,
@@ -140,43 +138,45 @@ def get_cmd_par(fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr=''):
140
138
  }
141
139
  if cmd_par['cmd']:
142
140
  if '&&' in cmd_par['cmd']:
143
- if os.name == 'posix' and cmd_par['daemonyun']:
144
- with daemon.DaemonContext():
145
- os.chdir(cmd_par['path'])
146
- for cmds in cmd_par['cmd'].split('&&'):
147
- print('执行命令',cmds.strip())
148
- if cmds[0:3] == 'cd ':
149
- print('已切换工作目录',cmds[3:])
150
- os.chdir(cmds[3:].strip())
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())
151
152
  else:
152
153
  os.system(cmds.strip())
153
- else:
154
- if os.name == 'posix' and cmd_par['daemonyun']:
155
- with daemon.DaemonContext():
156
- os.chdir(cmd_par['path'])
157
- for cmds in cmd_par['cmd'].split('&&'):
158
- print('执行命令',cmds.strip())
159
- if cmds[0:3] == 'cd ':
160
- print('已切换工作目录',cmds[3:])
161
- os.chdir(cmds[3:].strip())
162
- else:
163
- os.system(cmds.strip())
154
+ else:
155
+ 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:])
164
162
  else:
165
- for cmds in cmd_par['cmd'].split('&&'):
166
- print('执行命令',cmds.strip())
167
- if cmds[0:3] == 'cd ':
168
- print('已切换工作目录',cmds[3:])
169
- os.chdir(cmds[3:].strip())
163
+ if os.name == 'posix':
164
+ if cmd_par['daemonyun']:
165
+ with daemon.DaemonContext():
166
+ os.system(cmds)
170
167
  else:
171
- os.system(cmds.strip())
168
+ os.system(cmds)
169
+ else:
170
+ os.system(cmds)
172
171
  else:
173
- if os.name == 'posix' and cmd_par['daemonyun']:
174
- with daemon.DaemonContext():
175
- os.chdir(cmd_par['path'])
176
- print('执行命令',cmd_par['cmd'].strip())
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:
177
178
  os.system(cmd_par['cmd'].strip())
178
179
  else:
179
- print('执行命令',cmd_par['cmd'].strip())
180
180
  os.system(cmd_par['cmd'].strip())
181
181
 
182
182
  return cmd_par
@@ -358,12 +358,10 @@ def cllfunction():
358
358
  else:
359
359
  save_route_cli_pid('pid/'+fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1+'_server_pid')
360
360
  from gunicorn.app.wsgiapp import run
361
- import re
362
361
  sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$','',sys.argv[0])
363
362
  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
363
  if cmd_par['daemonyun']:
365
364
  with daemon.DaemonContext():
366
- os.chdir(cmd_par['path'])
367
365
  sys.exit(run())
368
366
  exit()
369
367
  else:
@@ -475,6 +473,7 @@ def cllfunction():
475
473
  elif cmd_par['cmd']:
476
474
  pass
477
475
  elif cmd_par['cli']:#通过命令行执行控制器的方法
476
+ config.app['cli']=True
478
477
  try:
479
478
  obj=importlib.import_module(cmd_par['appname']+'.common')
480
479
  if obj.config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr!=fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1:
@@ -507,13 +506,13 @@ def cllfunction():
507
506
  if os.name == 'posix':
508
507
  if cmd_par['daemonyun']:
509
508
  with daemon.DaemonContext():
510
- os.chdir(cmd_par['path'])
511
509
  app.cli(RAW_URI)
512
510
  else:
513
511
  app.cli(RAW_URI)
514
512
  else:
515
513
  app.cli(RAW_URI)
516
514
  else:#通过命令行执行控制器的方法
515
+ config.app['cli']=True
517
516
  try:
518
517
  obj=importlib.import_module(cmd_par['appname']+'.common')
519
518
  if obj.config.fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr!=fdgrsgrsegsrsgrsbsdbftbrsbfdrtrtbdfsrsgr1:
@@ -546,7 +545,6 @@ def cllfunction():
546
545
  if os.name == 'posix':
547
546
  if cmd_par['daemonyun']:
548
547
  with daemon.DaemonContext():
549
- os.chdir(cmd_par['path'])
550
548
  app.cli(RAW_URI)
551
549
  else:
552
550
  app.cli(RAW_URI)
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.4
2
+ Name: kunapi
3
+ Version: 1.17
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.17
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
@@ -3,7 +3,7 @@
3
3
  # 上传 twine upload dist/*
4
4
 
5
5
 
6
- # 安装 python setup.py install
6
+ # 安装 python setup.py sdist install
7
7
  import os,sys
8
8
  from setuptools import setup
9
9
  from kunapi import kcwsinfo
kunapi-1.15/PKG-INFO DELETED
@@ -1,13 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: kunapi
3
- Version: 1.15
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.15
12
-
13
- kunapi
@@ -1,13 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: kunapi
3
- Version: 1.15
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.15
12
-
13
- 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