1010from check_manifest_features import *
1111import os
1212from os .path import basename , dirname , join , normpath , relpath , splitext , isfile
13- from pathlib import PureWindowsPath
1413import glob
1514import tla_utils
1615import tree_sitter_tlaplus
1716from tree_sitter import Language , Parser
1817
19- def to_posix (path ):
20- """
21- Converts paths to normalized Posix format.
22- https://stackoverflow.com/q/75291812/2852699
23- """
24- return PureWindowsPath (normpath (path )).as_posix ()
25-
2618def get_spec_dirs (examples_root , ignored_dirs ):
2719 """
2820 Get all directories under the specifications dir, sorted alphabetically.
@@ -74,21 +66,18 @@ def generate_new_manifest(examples_root, spec_path, spec_name, parser, queries):
7466 Generate new manifest.json file for a given specification directory.
7567 """
7668 return {
77- 'path' : to_posix (spec_path ),
78- 'title' : spec_name ,
79- 'description' : '' ,
8069 'sources' : [],
8170 'authors' : [],
8271 'tags' : [],
8372 'modules' : [
8473 {
85- 'path' : to_posix (tla_path ),
74+ 'path' : tla_utils . to_posix (tla_path ),
8675 'communityDependencies' : sorted (list (get_community_module_imports (examples_root , parser , tla_path , queries ))),
8776 'tlaLanguageVersion' : 2 ,
8877 'features' : sorted (list (get_module_features (examples_root , tla_path , parser , queries ))),
8978 'models' : [
9079 {
91- 'path' : to_posix (cfg_path ),
80+ 'path' : tla_utils . to_posix (cfg_path ),
9281 'runtime' : 'unknown' ,
9382 'size' : 'unknown' ,
9483 'mode' : 'exhaustive search' ,
@@ -108,14 +97,14 @@ def get_old_manifest(spec_path):
10897 return tla_utils .load_json (old_manifest_path ) if isfile (old_manifest_path ) else None
10998
11099def integrate_spec_info (old_manifest , new_spec ):
111- fields = ['title' , 'description' , ' authors' , 'sources' , 'tags' ]
100+ fields = ['authors' , 'sources' , 'tags' ]
112101 for field in fields :
113102 new_spec [field ] = old_manifest [field ]
114103
115104def find_corresponding_module (old_module , new_spec ):
116105 modules = [
117106 module for module in new_spec ['modules' ]
118- if to_posix (module ['path' ]) == to_posix (old_module ['path' ])
107+ if tla_utils . to_posix (module ['path' ]) == tla_utils . to_posix (old_module ['path' ])
119108 ]
120109 return modules [0 ] if any (modules ) else None
121110
@@ -127,7 +116,7 @@ def integrate_module_info(old_module, new_module):
127116def find_corresponding_model (old_model , new_module ):
128117 models = [
129118 model for model in new_module ['models' ]
130- if to_posix (model ['path' ]) == to_posix (old_model ['path' ])
119+ if tla_utils . to_posix (model ['path' ]) == tla_utils . to_posix (old_model ['path' ])
131120 ]
132121 return models [0 ] if any (models ) else None
133122
0 commit comments