Make it work in Windows

This commit is contained in:
Micah Lee 2020-10-14 22:36:31 -07:00
parent 6bc085922b
commit 50e7471a49
7 changed files with 276 additions and 468 deletions

View file

@ -43,17 +43,15 @@ def main():
root_path = os.path.dirname(
os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
)
working_path = os.path.join(os.path.join(root_path, "build"), "tor")
working_path = os.path.join(root_path, "build", "tor")
exe_path = os.path.join(working_path, exe_filename)
dist_path = os.path.join(
os.path.join(os.path.join(root_path, "dist"), "onionshare"), "tor"
)
dist_path = os.path.join(root_path, "src", "onionshare", "resources", "tor")
# Make sure the working folder exists
if not os.path.exists(working_path):
os.makedirs(working_path)
# Make sure the zip is downloaded
# Make sure Tor Browser is downloaded
if not os.path.exists(exe_path):
print("Downloading {}".format(exe_url))
r = requests.get(exe_url)
@ -71,26 +69,24 @@ def main():
sys.exit(-1)
# Extract the bits we need from the exe
cmd = [
subprocess.Popen([
"7z",
"e",
"-y",
exe_path,
"Browser\TorBrowser\Tor",
"-o%s" % os.path.join(working_path, "Tor"),
]
cmd2 = [
]).wait()
subprocess.Popen([
"7z",
"e",
"-y",
exe_path,
"Browser\TorBrowser\Data\Tor\geoip*",
"-o%s" % os.path.join(working_path, "Data"),
]
subprocess.Popen(cmd).wait()
subprocess.Popen(cmd2).wait()
]).wait()
# Copy into dist
# Copy into the onionshare resources
if os.path.exists(dist_path):
shutil.rmtree(dist_path)
os.makedirs(dist_path)