mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Merge commit '84ad2a289f33a43dd71276cc494f337d0fbb3ed6' into feature/update-dependencies
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import os, sys, re, stat, shutil, tarfile, zipfile, subprocess
|
||||
import requests
|
||||
import rfc6266
|
||||
import hashlib
|
||||
|
||||
j = os.path.join
|
||||
|
||||
@@ -260,3 +263,51 @@ def zipdir(path, ziph):
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
ziph.write(os.path.join(root, file))
|
||||
|
||||
def download(url):
|
||||
print "Downloading %s" % url
|
||||
response = requests.get(url)
|
||||
fname = rfc6266.parse_headers(response.headers['content-disposition']).filename_unsafe
|
||||
with open(fname, "wb") as f:
|
||||
f.write(response.content)
|
||||
return fname
|
||||
|
||||
def sha256_checksum(filename, block_size=65536):
|
||||
sha256 = hashlib.sha256()
|
||||
with open(filename, 'rb') as f:
|
||||
for block in iter(lambda: f.read(block_size), b''):
|
||||
sha256.update(block)
|
||||
return sha256.hexdigest()
|
||||
|
||||
def read_params():
|
||||
if not os.environ.get('O3'):
|
||||
sys.exit("Missing required O3 env variable")
|
||||
|
||||
params={}
|
||||
params['OVPN3'] = os.environ.get('O3').rstrip()
|
||||
if not os.environ.get('DEP_DIR'):
|
||||
params["BUILD"] = os.path.join(params['OVPN3'], "deps")
|
||||
else:
|
||||
params['BUILD'] = os.environ.get('DEP_DIR').rstrip()
|
||||
params['ARCH'] = os.environ.get('ARCH', 'amd64').rstrip()
|
||||
params['DEBUG'] = os.environ.get('DEBUG')
|
||||
params['STATIC'] = os.environ.get('STATIC')
|
||||
params['MSVC_DIR'] = os.environ.get('MSVC_DIR', 'c:\\Program Files (x86)\\Microsoft Visual Studio 14.0').rstrip()
|
||||
# Community: tap0901, Access Server: tapoas
|
||||
params['TAP_WIN_COMPONENT_ID'] = os.environ.get('TAP_WIN_COMPONENT_ID', 'tap0901')
|
||||
params['CPP_EXTRA'] = os.environ.get('CPP_EXTRA', '').rstrip()
|
||||
if os.environ.get('USE_JSONSPP'):
|
||||
params['USE_JSONCPP'] = True
|
||||
if os.environ.get('USE_JSONSPP'):
|
||||
params['CONNECT'] = True
|
||||
params['GTEST_ROOT'] = os.environ.get('GTEST_ROOT')
|
||||
|
||||
# read versions
|
||||
with open(os.path.join(params['OVPN3'], "core", "deps", "lib-versions")) as f:
|
||||
for l in [line.strip() for line in f if line.strip()]:
|
||||
name, val = l.split("=")
|
||||
if name.startswith("export"):
|
||||
name = name[6:].strip()
|
||||
params[name] = val
|
||||
|
||||
return params
|
||||
|
||||
Reference in New Issue
Block a user