-
Notifications
You must be signed in to change notification settings - Fork 1
/
init
executable file
·37 lines (27 loc) · 1.28 KB
/
init
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
37
#!/usr/bin/env python3
import subprocess
import os
print("Initializing...")
subprocess.run("rm -rf /work/indexes/".split())
github=False
version="5.2-SNAPSHOT"
if github:
#Download terrier from git and change commit version
subprocess.run("git clone https://github.com/terrier-org/terrier-core".split())
curr_dir = os.getcwd()
os.chdir("{}/terrier-core".format(curr_dir))
#install using mvn
subprocess.run("mvn -DskipTests -Dmaven.javadoc.skip=true clean install".split())
else:
#Download terrier, bypass "I Agree form"
import requests
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Referer': "http://terrier.org/download/agree.shtml?terrier-project-{0}-bin.tar".format(version),
'Accept-Encoding': 'gzip, deflate',
}
response = requests.get("http://terrier.org/download/files/terrier-project-{0}-bin.tar".format(version), headers=headers)
open("terrier-project-{0}-bin.tar".format(version), 'wb').write(response.content)
subprocess.run("tar -xf /work/terrier-project-{0}-bin.tar -C /work".format(version).split())
subprocess.run("ln -s /work/terrier-project-{0}/ /work/terrier-core".format(version).split())
subprocess.run("/work/terrier-core/bin/terrier")