pyscreeps-arena 0.2.1__tar.gz → 0.2.2__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: 2.1
2
2
  Name: pyscreeps-arena
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python api|interface to play game: Screeps: Arena.
5
5
  Author-email: 2229066748@qq.com
6
6
  Maintainer: Eagle'sBaby
@@ -215,7 +215,6 @@ class Compiler:
215
215
  _pre_define_ = {} # define
216
216
  _js_replace_, _insert_id_ = {}, 0 # insert
217
217
 
218
-
219
218
  # ----------------------------------- IMPORT ----------------------------------- #
220
219
  # 获取所有.py文件中的所有import的内容,并记录下来fname:[imp1, imp2, ...]
221
220
  for i, fpath in enumerate(py_fpath):
@@ -241,7 +240,7 @@ class Compiler:
241
240
  f.write(new_content)
242
241
 
243
242
  # ------------------------------------ SORT ------------------------------------ #
244
- # 获取所有.py文件中的所有# sort的内容,并记录下来(不存在则默认为65535)
243
+ # 获取所有.py文件中的所有# sort的内容,并记录下来(不存在则默认为2^32-1)
245
244
  for i, fpath in enumerate(py_fpath):
246
245
  fname = py_names[i][:-3] + '.js'
247
246
  content = self.auto_read(fpath)
@@ -250,11 +249,11 @@ class Compiler:
250
249
  try:
251
250
  sort_num = int(m.group(1))
252
251
  except ValueError:
253
- print(Fore.YELLOW + '[Warn] ' + Fore.RESET + f'sort number error: "{m.group(1)}", use 65535 instead.')
254
- sort_num = 65535
252
+ print(Fore.YELLOW + '[Warn] ' + Fore.RESET + f'sort number error: "{m.group(1)}", use 2^32-1 instead.')
253
+ sort_num = 4294967295
255
254
  _pre_sort_[fname] = sort_num
256
255
  else:
257
- _pre_sort_[fname] = 65535
256
+ _pre_sort_[fname] = 4294967295
258
257
 
259
258
  # ------------------------------------ DEFINE ------------------------------------ #
260
259
  # 扫描所有# define的内容,然后在.py中移除这些行,并记录下来
@@ -471,15 +470,21 @@ class Compiler:
471
470
  f_sorts[self.JS_VM] = -1
472
471
 
473
472
  err_flag = False
474
- for module in usr_modules:
473
+ for i, module in enumerate(usr_modules):
475
474
  if module[2:] not in f_sorts:
476
- print(Fore.RED + '\n[Error] ' + Fore.RESET + f'"{module[2:-3]}.py" is not a user module.')
477
- imp_detail = t_imps.get(module, None)
478
- if imp_detail:
479
- print("\t\t-- May be imported by user in: %s" % imp_detail)
475
+ if module[2:6] == 'src.' and module[6:] in f_sorts:
476
+ f_sorts[module[2:]] = f_sorts[module[6:]]
477
+ # 为了解决这样的问题:
478
+ # > import src.creeps.basic
479
+ # import src.creeps.basic
480
480
  else:
481
- print("\t\t-- Please move this file into the 'src' directory.")
482
- err_flag = True
481
+ print(Fore.RED + '\n[Error] ' + Fore.RESET + f'"{module[2:-3]}.py" is not a user module.')
482
+ imp_detail = t_imps.get(module, None)
483
+ if imp_detail:
484
+ print("\t\t-- May be imported by user in: %s" % imp_detail)
485
+ else:
486
+ print("\t\t-- Please move this file into the 'src' directory.")
487
+ err_flag = True
483
488
  if err_flag:
484
489
  sys.exit(1)
485
490
  for i in range(len(usr_modules)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyscreeps-arena
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Python api|interface to play game: Screeps: Arena.
5
5
  Author-email: 2229066748@qq.com
6
6
  Maintainer: Eagle'sBaby
@@ -7,7 +7,7 @@ with open(r"T:\New_PC\Import_Project\uploads\pyscreeps-arena_upload\pyscreeps-ar
7
7
  long_description = f.read()
8
8
  setup(
9
9
  name='pyscreeps-arena',
10
- version='0.2.1',
10
+ version='0.2.2',
11
11
  description='Python api|interface to play game: Screeps: Arena.',
12
12
  long_description=long_description,
13
13
  long_description_content_type='text/markdown',