-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
44 lines (39 loc) · 1.74 KB
/
setup.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
37
38
39
40
41
42
43
44
from setuptools import setup, find_packages
import os
if os.name == 'nt':
install_packages = ['sgfmill','pandas','python3-wget','gputil','requests','scipy','progressbar2','wexpect']
else:
install_packages = ['sgfmill','pandas','python3-wget','gputil','requests','scipy','progressbar2','pexpect']
setup(
name="goaidet",
version="0.2",
packages=find_packages(),
install_requires=[install_packages]
)
# Download and extract the Leela release
# Also checks if the computer has one or more GPUs to determine which release to download
import GPUtil
from zipfile import ZipFile
import os, wget, gzip, shutil, wget, requests
if "leela-zero-0.17" not in os.listdir():
if "elfv2" not in os.listdir():
data = requests.get("https://zero.sjeng.org/best-network")
with open("saved_file.gz", "wb") as cur_file:
cur_file.write(data.content)
with gzip.open("saved_file.gz", 'rb') as f_in:
with open('elfv2', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
os.remove("saved_file.gz")
if os.name == 'nt':
if GPUtil.getGPUs():
file = wget.download("https://github.com/leela-zero/leela-zero/releases/download/v0.17/leela-zero-0.17-win64.zip")
else:
file = wget.download("https://github.com/leela-zero/leela-zero/releases/download/v0.17/leela-zero-0.17-cpuonly-win64.zip")
with ZipFile(file, 'r') as zipObj:
zipObj.extractall()
cur_folder = file[:-4]
os.rename(cur_folder,"leela-zero-0.17")
elif os.name == 'posix':
with ZipFile("leela_zero_0.17_linux.zip", 'r') as zipObj:
zipObj.extractall()
os.replace("./elfv2", "./leela-zero-0.17/elfv2")