Skip to content

Commit bde69bd

Browse files
update mac
1 parent 6c044df commit bde69bd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

eosfactory/core/config.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
EOSFACTORY_DIR = "eosfactory/"
1919
TMP = "/tmp/eosfactory/"
2020
SETUPTOOLS_NAME = "eosfactory_tokenika"
21+
VERSION_PATTERN = r".+/eosio\.cdt/(\d\.\d\.\d)/.*$"
2122

2223
LOCALHOST_HTTP_ADDRESS = "127.0.0.1:8888"
2324
DEFAULT_TEMPLATE = "hello_world"
@@ -58,7 +59,7 @@
5859
eosio_cpp_ = ("EOSIO_CPP",
5960
["eosio-cpp", "/usr/bin/eosio-cpp", "/usr/local/bin/eosio-cpp"])
6061
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/"])
6263
eosio_cpp_includes_ = (
6364
"EOSIO_CPP_INCLUDES",
6465
[["include", "include/libcxx", "include/eosiolib/core", \
@@ -606,7 +607,7 @@ def eosio_cdt_root():
606607
'eosio-cpp' does not response.
607608
''')
608609

609-
version_pattern = re.compile(".+/eosio\.cdt/(\d\.\d\.\d)/$")
610+
version_pattern = re.compile(VERSION_PATTERN)
610611
tested = []
611612
for path in eosio_cdt_root_[1]:
612613
tested.append(path)
@@ -1065,16 +1066,17 @@ def wasm_file(contract_dir_hint):
10651066
contract_file(contract_dir_hint, ".wasm"), contract_dir_hint)
10661067

10671068

1068-
def update_eosio_cpp_includes(c_cpp_properties_path, root=""):
1069+
def update_eosio_cpp_includes(c_cpp_properties_path):
10691070
c_cpp_properties_path = utils.wslMapWindowsLinux(c_cpp_properties_path)
10701071
with open(c_cpp_properties_path) as f:
10711072
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])
10741079

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())
10781080
if not new == c_cpp_properties:
10791081
with open(c_cpp_properties_path,'w') as f:
10801082
f.write(new)

eosfactory/core/vscode.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,15 @@ def c_cpp_properties():
208208
return retval
209209

210210

211-
def main(c_cpp_properties_path=None, root=None):
211+
def main(c_cpp_properties_path=None):
212212
if c_cpp_properties_path:
213-
config.update_eosio_cpp_includes(c_cpp_properties_path, root)
213+
config.update_eosio_cpp_includes(c_cpp_properties_path)
214214
else:
215215
print(c_cpp_properties())
216216

217217

218218
if __name__ == '__main__':
219219
parser = argparse.ArgumentParser()
220220
parser.add_argument("--c_cpp_prop_path", default="")
221-
parser.add_argument("--root", default="")
222221
args = parser.parse_args()
223-
main(args.c_cpp_prop_path, args.root)
222+
main(args.c_cpp_prop_path)

0 commit comments

Comments
 (0)