use local tor if no registed version can be found

This commit is contained in:
j 2016-01-17 12:28:55 +05:30
parent 9fcd9491ac
commit 021c418622
2 changed files with 9 additions and 3 deletions

View file

@ -36,7 +36,9 @@ class Install(Thread):
from OpenSSL.SSL import TLSv1_2_METHOD from OpenSSL.SSL import TLSv1_2_METHOD
except: except:
print("To run Open Media Library on versions of Ubuntu before 15.10, you need to manually update pyOpenSSL.") print("To run Open Media Library on versions of Ubuntu before 15.10, you need to manually update pyOpenSSL.")
print("To install the current version of pyOpenSSL, run:\n\tsudo apt-get install python3-pip python3-dev libffi-dev libssl-dev\n\tsudo pip3 install -U pyOpenSSL") print("To install the current version of pyOpenSSL, run:")
print("\tsudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libevent-2.0-5")
print("\tsudo pip3 install -U pyOpenSSL")
self.failed = True self.failed = True
return return
apt_packages = '' apt_packages = ''
@ -167,5 +169,5 @@ if __name__ == '__main__':
install = Install(target) install = Install(target)
install.join() install.join()
if not install.failed: if not install.failed:
print("To launch Open Media Library, run: %s open"%os.path.join(target, 'ctl')) print("You can launch Open Media Library from the menu or run: %s open"%os.path.join(target, 'ctl'))
#subprocess.Popen([os.path.join(target, 'ctl'), 'open']) #subprocess.Popen([os.path.join(target, 'ctl'), 'open'])

View file

@ -215,7 +215,7 @@ def get_tor():
if sys.platform == 'darwin': if sys.platform == 'darwin':
for path in ( for path in (
'/Applications/TorBrowser.app/TorBrowser/Tor/tor', '/Applications/TorBrowser.app/TorBrowser/Tor/tor',
os.path.join(settings.base_dir, 'tor', 'TorBrowser.app/TorBrowser/Tor/tor') os.path.join(settings.base_dir, 'tor', 'TorBrowser.app', 'TorBrowser', 'Tor', 'tor')
): ):
if os.path.isfile(path) and os.access(path, os.X_OK): if os.path.isfile(path) and os.access(path, os.X_OK):
return path return path
@ -231,6 +231,10 @@ def get_tor():
return path return path
except: except:
pass pass
local_tor = os.path.normpath(os.path.join(settings.base_dir, '..',
'tor', 'tor-browser_en-US', 'Browser', 'TorBrowser', 'Tor', 'tor'))
if os.path.exists(local_tor):
return local_tor
return distutils.spawn.find_executable('tor') return distutils.spawn.find_executable('tor')
def install_tor(): def install_tor():