mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-02 06:26:10 -04:00
Format all code using black
This commit is contained in:
parent
8010b279e7
commit
88e151d414
87 changed files with 4293 additions and 2374 deletions
|
@ -32,15 +32,22 @@ import shutil
|
|||
import subprocess
|
||||
import requests
|
||||
|
||||
|
||||
def main():
|
||||
exe_url = 'https://archive.torproject.org/tor-package-archive/torbrowser/8.5.5/torbrowser-install-8.5.5_en-US.exe'
|
||||
exe_filename = 'torbrowser-install-8.5.5_en-US.exe'
|
||||
expected_exe_sha256 = 'a3aa7e626d1d2365dcecc6f17055f467f31c4ff9558a769e51d4b90640e48bb0'
|
||||
exe_url = "https://archive.torproject.org/tor-package-archive/torbrowser/8.5.5/torbrowser-install-8.5.5_en-US.exe"
|
||||
exe_filename = "torbrowser-install-8.5.5_en-US.exe"
|
||||
expected_exe_sha256 = (
|
||||
"a3aa7e626d1d2365dcecc6f17055f467f31c4ff9558a769e51d4b90640e48bb0"
|
||||
)
|
||||
# Build paths
|
||||
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')
|
||||
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")
|
||||
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(
|
||||
os.path.join(os.path.join(root_path, "dist"), "onionshare"), "tor"
|
||||
)
|
||||
|
||||
# Make sure the working folder exists
|
||||
if not os.path.exists(working_path):
|
||||
|
@ -50,10 +57,10 @@ def main():
|
|||
if not os.path.exists(exe_path):
|
||||
print("Downloading {}".format(exe_url))
|
||||
r = requests.get(exe_url)
|
||||
open(exe_path, 'wb').write(r.content)
|
||||
open(exe_path, "wb").write(r.content)
|
||||
exe_sha256 = hashlib.sha256(r.content).hexdigest()
|
||||
else:
|
||||
exe_data = open(exe_path, 'rb').read()
|
||||
exe_data = open(exe_path, "rb").read()
|
||||
exe_sha256 = hashlib.sha256(exe_data).hexdigest()
|
||||
|
||||
# Compare the hash
|
||||
|
@ -64,8 +71,22 @@ def main():
|
|||
sys.exit(-1)
|
||||
|
||||
# Extract the bits we need from the exe
|
||||
cmd = ['7z', 'e', '-y', exe_path, 'Browser\TorBrowser\Tor', '-o%s' % os.path.join(working_path, 'Tor')]
|
||||
cmd2 = ['7z', 'e', '-y', exe_path, 'Browser\TorBrowser\Data\Tor\geoip*', '-o%s' % os.path.join(working_path, 'Data')]
|
||||
cmd = [
|
||||
"7z",
|
||||
"e",
|
||||
"-y",
|
||||
exe_path,
|
||||
"Browser\TorBrowser\Tor",
|
||||
"-o%s" % os.path.join(working_path, "Tor"),
|
||||
]
|
||||
cmd2 = [
|
||||
"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()
|
||||
|
||||
|
@ -73,8 +94,11 @@ def main():
|
|||
if os.path.exists(dist_path):
|
||||
shutil.rmtree(dist_path)
|
||||
os.makedirs(dist_path)
|
||||
shutil.copytree( os.path.join(working_path, 'Tor'), os.path.join(dist_path, 'Tor') )
|
||||
shutil.copytree( os.path.join(working_path, 'Data'), os.path.join(dist_path, 'Data', 'Tor') )
|
||||
shutil.copytree(os.path.join(working_path, "Tor"), os.path.join(dist_path, "Tor"))
|
||||
shutil.copytree(
|
||||
os.path.join(working_path, "Data"), os.path.join(dist_path, "Data", "Tor")
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue