Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
c2e35392ae Adding popen 2024-01-16 19:30:20 +03:00

View file

@ -25,32 +25,58 @@ Handler = MyHttpRequestHandler
def compile_and_deploy_contract():
password = 'one'
# User
user_compile_command = "neo-go contract compile -i User/user.go -c User/user.yml -m User/user.json"
subprocess.run(user_compile_command, shell=True, check=True)
subprocess.run(user_compile_command, shell=True, check=False)
user_deploy_command = "neo-go contract deploy -i User/user.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m User/user.json"
subprocess.run(user_deploy_command, shell=True, check=True)
result_user = subprocess.check_output(password, shell=True, text=True).stdout[-40:]
print(result_user)
user_deploy_command = "neo-go contract deploy -i User/user.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m User/user.json --force"
user_proc = subprocess.Popen(user_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
user_out_list = []
while True:
line = user_proc.stdout.readline()
if not line:
break
user_out_list.append(line.rstrip())
user_hash = str(user_out_list[-1]).replace("Contract: ", "")
print(user_hash)
# Post
post_compile_command = "neo-go contract compile -i Post/post_contract.go -c Post/post_contract.yml -m Post/post_contract.json"
subprocess.run(post_compile_command, shell=True, check=True)
post_deploy_command = "neo-go contract deploy -i Post/post_contract.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m Post/post_contract.json"
subprocess.run(post_deploy_command, shell=True, check=True)
result_post = subprocess.check_output(password, shell=True, text=True).stdout[-40:]
print(result_post)
post_proc = subprocess.Popen(post_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
post_out_list = []
while True:
line = post_proc.stdout.readline()
if not line:
break
post_out_list.append(line.rstrip())
post_hash = str(post_out_list[-1]).replace("Contract: ", "")
print(post_hash)
# Comment
comment_compile_command = "neo-go contract compile -i Comment/comment.go -c Comment/comment.yml -m Comment/comment.json"
subprocess.run(comment_compile_command, shell=True, check=True)
comment_deploy_command = "neo-go contract deploy -i Comment/comment.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m Comment/comment.json"
subprocess.run(comment_deploy_command, shell=True, check=True)
result_comment = subprocess.check_output(password, shell=True, text=True).stdout[-40:]
print(result_comment)
comment_proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
comment_out_list = []
while True:
line = comment_proc.stdout.readline()
if not line:
break
comment_out_list.append(line.rstrip())
comment_hash = str(comment_out_list[-1]).replace("Contract: ", "")
print(comment_hash)
if __name__ == "__main__":
compile_and_deploy_contract()