@@ -86,35 +86,39 @@ def get_app_data_dir():
86
86
return app_data_dir
87
87
88
88
raise errors .Error ('''
89
- Cannot determine the directory of application data. Tried:
90
- '{}',
91
- '{}',
92
- '{}'.
93
- The chosen path is
94
- '{}',
95
- but it does not exist, seemingly.
89
+ Cannot determine the directory of application data. Tried:
90
+ {}
91
+ {}
92
+ {}
93
+ The path '__file__' is
94
+ {}
95
+ The chosen path is
96
+ {}
97
+ but it does not exist, seemingly.
96
98
''' .format (
97
99
APP_DATA_DIR_SUDO [0 ], APP_DATA_DIR_USER [0 ], eosf_dir (),
100
+ __file__ ,
98
101
app_data_dir ),
99
102
translate = False )
100
103
101
104
102
105
def is_linked_package ():
103
106
is_linked = os .path .exists (os .path .join (eosf_dir (), CONFIG_DIR ))
104
- is_copied = not is_linked and get_app_data_dir ()
105
- if (not is_linked ) and (not is_copied ):
107
+ is_installed_package = not is_linked and get_app_data_dir ()
108
+
109
+ if (not is_linked ) and (not is_installed_package ):
106
110
raise errors .Error ('''
107
- Cannot determine the configuration directory.
108
- {}
109
- {}
110
- {}
111
+ Cannot determine the configuration directory.
112
+ {}
113
+ {}
114
+ {}
111
115
''' .format (
112
116
os .path .join (eosf_dir (), CONFIG_DIR ),
113
117
os .path .join (APP_DATA_DIR_USER [0 ], CONFIG_DIR ),
114
118
os .path .join (APP_DATA_DIR_SUDO [0 ], CONFIG_DIR )
115
119
), translate = False )
116
120
117
- if is_linked and is_copied :
121
+ if is_linked and is_installed_package :
118
122
is_linked = True
119
123
120
124
return is_linked
@@ -154,11 +158,11 @@ def set(contract_workspace_dir):
154
158
contract_workspace_dir = os .path .join (APP_CWD_DIR , CONTRACTS_DIR )
155
159
156
160
new_dir = tilde (input (utils .heredoc ('''
157
- Where do you prefer to keep your smart-contract projects?
158
- The current location of the is:
159
- '{}'
160
- Otherwise, input another existing directory path, or nothing to
161
- keep the current one:
161
+ Where do you prefer to keep your smart-contract projects?
162
+ The current location of the is:
163
+ {}
164
+ Otherwise, input another existing directory path, or nothing to
165
+ keep the current one:
162
166
''' .format (
163
167
colored (contract_workspace_dir , current_path_color )
164
168
)
@@ -172,9 +176,9 @@ def set(contract_workspace_dir):
172
176
break
173
177
else :
174
178
print ("\n " + utils .heredoc ('''
175
- The path you entered:
176
- {}
177
- doesn't seem to exist!
179
+ The path you entered:
180
+ {}
181
+ doesn't seem to exist!
178
182
''' ).format (colored (new_dir , error_path_color )) + "\n " )
179
183
180
184
@@ -262,9 +266,9 @@ def contract_workspace_dir(dont_set_workspace=False):
262
266
return path
263
267
else :
264
268
raise errors .Error ('''
265
- The path
266
- '{}',
267
- set as the contract workspace directory, does not exist.
269
+ The path
270
+ '{}',
271
+ set as the contract workspace directory, does not exist.
268
272
''' .format (path ), translate = False )
269
273
else :
270
274
if is_linked_package ():
@@ -278,9 +282,9 @@ def contract_workspace_dir(dont_set_workspace=False):
278
282
return path
279
283
else :
280
284
raise errors .Error ('''
281
- The path
282
- '{}'
283
- resolved as the contract workspace directory directory does not exist.
285
+ The path
286
+ '{}'
287
+ resolved as the contract workspace directory directory does not exist.
284
288
''' .format (workspace_dir , translate = False )
285
289
)
286
290
return path
@@ -303,18 +307,25 @@ def abi_file(contract_dir_hint):
303
307
def eosf_dir ():
304
308
'''The absolute directory of the EOSFactory installation.
305
309
'''
306
- path = os .path .realpath (os .path .join (
310
+ try :
311
+ path = os .path .realpath (os .path .join (
307
312
os .path .realpath (__file__ ), FROM_HERE_TO_EOSF_DIR ))
313
+ except Exception as e :
314
+ raise errors .Error ('''
315
+ Impossible error: __file__ path cannot be determined. The message is
316
+ {}
317
+ ''' .format (str (e )))
318
+
308
319
if os .path .exists (path ):
309
320
return path
310
321
311
322
raise errors .Error ('''
312
- Cannot determine the root directory of EOSFactory.
313
- The path to the file 'config.py' is
314
- '{}'.
315
- The expected path to the installation, which is
316
- '{}',
317
- is reported as non-existent.
323
+ Cannot determine the root directory of EOSFactory.
324
+ The path to the file 'config.py' is
325
+ '{}'.
326
+ The expected installation path , which is
327
+ '{}',
328
+ is reported as non-existent.
318
329
''' .format (__file__ , path ), translate = False )
319
330
320
331
@@ -380,9 +391,9 @@ def genesis_json():
380
391
path = os .path .join (config_dir (), "genesis.json" )
381
392
if not os .path .exists (path ):
382
393
raise errors .Error ('''
383
- Cannot find any path for '{}'.
384
- Tried:
385
- {}
394
+ Cannot find any path for '{}'.
395
+ Tried:
396
+ {}
386
397
''' .format (genesis_json_ [0 ], genesis_json_ [1 ]), translate = False )
387
398
388
399
return path
@@ -621,9 +632,9 @@ def keosd_wallet_dir(raise_error=True):
621
632
if not path :
622
633
if raise_error :
623
634
raise errors .Error ('''
624
- Cannot find any path for '{}'.
625
- Tried:
626
- {}
635
+ Cannot find any path for '{}'.
636
+ Tried:
637
+ {}
627
638
''' .format (keosd_wallet_dir_ [0 ], keosd_wallet_dir_ [1 ]),
628
639
translate = False )
629
640
@@ -777,9 +788,9 @@ def first_valid_which(config_list, find_file=None, raise_error=True):
777
788
if raise_error :
778
789
config_values (config_list )
779
790
raise errors .Error ('''
780
- Cannot find any path for '{}'.
781
- Tried:
782
- {}
791
+ Cannot find any path for '{}'.
792
+ Tried:
793
+ {}
783
794
''' .format (config_list [0 ], config_list [1 ]), translate = False )
784
795
else :
785
796
return None
@@ -831,9 +842,9 @@ def first_valid_path(config_list, find_file=None, raise_error=True):
831
842
832
843
if raise_error :
833
844
raise errors .Error ('''
834
- Cannot find any path for '{}'.
835
- Tried:
836
- {}
845
+ Cannot find any path for '{}'.
846
+ Tried:
847
+ {}
837
848
''' .format (config_list [0 ], config_list [1 ]), translate = False )
838
849
else :
839
850
return None
@@ -880,9 +891,9 @@ def contract_dir(contract_dir_hint):
880
891
return os .path .realpath (contract_dir_ )
881
892
882
893
raise errors .Error ('''
883
- Cannot determine the contract directory.
884
- Tried:
885
- {}
894
+ Cannot determine the contract directory.
895
+ Tried:
896
+ {}
886
897
''' .format (trace ), translate = False )
887
898
888
899
@@ -925,9 +936,9 @@ def contract_source_files(contract_dir_hint):
925
936
return (source_dir , srcs )
926
937
927
938
raise errors .Error ('''
928
- Cannot find any contract source directory.
929
- Tried:
930
- {}
939
+ Cannot find any contract source directory.
940
+ Tried:
941
+ {}
931
942
''' .format (trace ), translate = False )
932
943
933
944
@@ -990,11 +1001,11 @@ def contract_file(contract_dir_hint, contract_file_hint):
990
1001
return os .path .join (build_dir , file )
991
1002
992
1003
raise errors .Error ('''
993
- Cannot determine the contract file basing on hints:
994
- contract dir hint: {}
995
- contract file hint: {}
996
- Tried:
997
- {}
1004
+ Cannot determine the contract file basing on hints:
1005
+ contract dir hint: {}
1006
+ contract file hint: {}
1007
+ Tried:
1008
+ {}
998
1009
''' .format (contract_dir_hint , contract_file_hint , trace ), translate = False )
999
1010
1000
1011
@@ -1215,7 +1226,7 @@ def config():
1215
1226
Python version {}
1216
1227
''' .format (VERSION , EOSIO_VERSION , EOSIO_CDT_VERSION , PYTHON_VERSION )
1217
1228
)
1218
-
1229
+ import pdb ; pdb . set_trace ()
1219
1230
if is_linked_package ():
1220
1231
print (
1221
1232
'''
0 commit comments