|
18 | 18 | EOSFACTORY_DIR = "eosfactory/" |
19 | 19 | TMP = "/tmp/eosfactory/" |
20 | 20 | SETUPTOOLS_NAME = "eosfactory_tokenika" |
| 21 | +VERSION_PATTERN = r".+/eosio\.cdt/(\d\.\d\.\d)/.*$" |
21 | 22 |
|
22 | 23 | LOCALHOST_HTTP_ADDRESS = "127.0.0.1:8888" |
23 | 24 | DEFAULT_TEMPLATE = "hello_world" |
|
58 | 59 | eosio_cpp_ = ("EOSIO_CPP", |
59 | 60 | ["eosio-cpp", "/usr/bin/eosio-cpp", "/usr/local/bin/eosio-cpp"]) |
60 | 61 | eosio_cdt_root_ = ("EOSIO_CDT_ROOT", |
61 | | - ["/usr/opt/eosio.cdt/0.0.0/", "/usr/local/Cellar/eosio.cdt/0.0.0"]) |
| 62 | + ["/usr/opt/eosio.cdt/0.0.0/", "/usr/local/Cellar/eosio.cdt/0.0.0/opt/eosio.cdt/"]) |
62 | 63 | eosio_cpp_includes_ = ( |
63 | 64 | "EOSIO_CPP_INCLUDES", |
64 | 65 | [["include", "include/libcxx", "include/eosiolib/core", \ |
@@ -606,7 +607,7 @@ def eosio_cdt_root(): |
606 | 607 | 'eosio-cpp' does not response. |
607 | 608 | ''') |
608 | 609 |
|
609 | | - version_pattern = re.compile(".+/eosio\.cdt/(\d\.\d\.\d)/$") |
| 610 | + version_pattern = re.compile(VERSION_PATTERN) |
610 | 611 | tested = [] |
611 | 612 | for path in eosio_cdt_root_[1]: |
612 | 613 | tested.append(path) |
@@ -1065,16 +1066,17 @@ def wasm_file(contract_dir_hint): |
1065 | 1066 | contract_file(contract_dir_hint, ".wasm"), contract_dir_hint) |
1066 | 1067 |
|
1067 | 1068 |
|
1068 | | -def update_eosio_cpp_includes(c_cpp_properties_path, root=""): |
| 1069 | +def update_eosio_cpp_includes(c_cpp_properties_path): |
1069 | 1070 | c_cpp_properties_path = utils.wslMapWindowsLinux(c_cpp_properties_path) |
1070 | 1071 | with open(c_cpp_properties_path) as f: |
1071 | 1072 | c_cpp_properties = f.read() |
1072 | | - dir_pattern = re.compile( |
1073 | | - '^.+\"{}(/.+/eosio\.cdt/\d\.\d\.\d/).+'.format(root), re.M) |
| 1073 | + |
| 1074 | + version_pattern = re.compile(VERSION_PATTERN) |
| 1075 | + |
| 1076 | + if re.findall(version_pattern, c_cpp_properties): |
| 1077 | + new = c_cpp_properties.replace( |
| 1078 | + re.findall(version_pattern, c_cpp_properties)[0], eosio_cpp_version()[0]) |
1074 | 1079 |
|
1075 | | - if re.findall(dir_pattern, c_cpp_properties): |
1076 | | - new = c_cpp_properties.replace(re.findall( |
1077 | | - dir_pattern, c_cpp_properties)[0], eosio_cdt_root()) |
1078 | 1080 | if not new == c_cpp_properties: |
1079 | 1081 | with open(c_cpp_properties_path,'w') as f: |
1080 | 1082 | f.write(new) |
|
0 commit comments