-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_expander.py
36 lines (29 loc) · 940 Bytes
/
run_expander.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys, subprocess, os, platform
args = sys.argv
file_name = args[1]
ext = os.path.splitext(file_name)[1]
combined_file_name = "combined" + ext
home_dir = "~/"
if ext == '.cpp':
expander_path = home_dir + "/git/ac-library/expander.py"
lib_path = home_dir + "/git/ac-library/"
elif ext == '.nim':
expander_path = home_dir + "/git/Nim-ACL/expander.py"
lib_path = home_dir + "/git/Nim-ACL/"
else:
print("Undefined Extension")
exit(1)
os.system("python3 {} {} -s --compress --directory --lib {}".format(expander_path, file_name, lib_path))
# ubuntu(linux)
s = platform.system()
if s == 'Linux':
os.system("cat {} | xsel --clipboard --input".format(combined_file_name))
elif s == 'Darwin':
os.system("cat {} | pbcopy".format(combined_file_name))
elif s == 'Windows':
pass
else:
print("不明なplatform")
os.system("rm {}".format(combined_file_name))