From 74a6791a6a2c8938af0d1734b546fb009a4dd3b5 Mon Sep 17 00:00:00 2001 From: Captain-Coder Date: Mon, 27 Jun 2016 14:57:36 +0000 Subject: [PATCH 01/10] Remove on_tunnel_remove notifier on multichain community unload --- Tribler/community/multichain/community.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tribler/community/multichain/community.py b/Tribler/community/multichain/community.py index 6aa6242fc3c..0a248e20266 100644 --- a/Tribler/community/multichain/community.py +++ b/Tribler/community/multichain/community.py @@ -385,6 +385,7 @@ def _get_latest_hash(self): def unload_community(self): self.logger.debug("Unloading the MultiChain Community.") + self.notifier.remove_observer(self.on_tunnel_remove) super(MultiChainCommunity, self).unload_community() # Close the persistence layer self.persistence.close() From e05c8575fdee3d9c78de60dc095aa04aced71ad4 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Sat, 25 Jun 2016 17:34:27 +0200 Subject: [PATCH 02/10] Closes #2340 --- Tribler/Core/Utilities/twisted_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tribler/Core/Utilities/twisted_utils.py b/Tribler/Core/Utilities/twisted_utils.py index 60b6bfcf29c..287d8a0cbe2 100644 --- a/Tribler/Core/Utilities/twisted_utils.py +++ b/Tribler/Core/Utilities/twisted_utils.py @@ -53,7 +53,8 @@ def isInThreadPool(): """ Check if we are currently on one of twisted threadpool threads. """ - return bool(reactor.threadpool) and current_thread() in reactor.threadpool.threads + threadpool = reactor.getThreadPool() + return threadpool is not None and current_thread() in threadpool.threads # From 31561c464b6ed258acd743fc1f8d05031b9dcbe1 Mon Sep 17 00:00:00 2001 From: Pim Veldhuisen Date: Wed, 29 Jun 2016 18:19:28 +0200 Subject: [PATCH 03/10] Workaround a bug were settings are written the wrong way on Windows --- Tribler/Main/Dialogs/systray.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tribler/Main/Dialogs/systray.py b/Tribler/Main/Dialogs/systray.py index b1c672a379a..c20774b02e2 100644 --- a/Tribler/Main/Dialogs/systray.py +++ b/Tribler/Main/Dialogs/systray.py @@ -1,5 +1,6 @@ # Author : Choopan RATTANAPOKA, Jie Yang, Arno Bakker # see LICENSE.txt for license information +import sys import wx from traceback import print_exc from Tribler.Main.Utility.utility import speed_format @@ -42,7 +43,11 @@ def updateTooltip(self, download_speed=0, upload_speed=0): def updateIcon(self, iconifying=False): remove = True - mintray = self.utility.read_config('mintray') + if sys.platform == 'win32': + mintray = 2 + else: + mintray = self.utility.read_config('mintray') + if (mintray >= 2) or ((mintray >= 1) and iconifying): remove = False From 77c2f2f2678031b0940109268a1c4effc66b8d95 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Wed, 29 Jun 2016 18:12:17 +0200 Subject: [PATCH 04/10] add Tribler.Policies module to setup.py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index fcd417e2df9..3b8bdc26189 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ 'Tribler.Main.Utility', 'Tribler.Main.vwxGUI', 'Tribler.Main.webUI', + 'Tribler.Policies', 'Tribler.Utilities', 'Tribler.community', 'Tribler.community.allchannel', From 60668fffab27b50fa0ad7d7c3f70ffd0e72acc08 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Wed, 29 Jun 2016 18:27:43 +0200 Subject: [PATCH 05/10] add Tribler.Core.Modules.restapi.channels module to setup.py --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 3b8bdc26189..700f86edb90 100644 --- a/setup.py +++ b/setup.py @@ -24,6 +24,7 @@ 'Tribler.Core.Modules', 'Tribler.Core.Modules.channel', 'Tribler.Core.Modules.restapi', + 'Tribler.Core.Modules.restapi.channels', 'Tribler.Core.TFTP', 'Tribler.Core.TorrentChecker', 'Tribler.Core.Upgrade', From fa662f6938203f0c1d28e67323c94f9da702f318 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Wed, 29 Jun 2016 19:05:45 +0200 Subject: [PATCH 06/10] update description --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 700f86edb90..f5f3fb50cea 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ url='https://github.com/Tribler/tribler', license='LICENSE.txt', - description='AT3 package for Python for Android', + description='Tribler', package_data={ 'Tribler': [ 'schema_sdb_v28.sql', @@ -70,5 +70,5 @@ 'bootstrap_stable', 'bootstrap_unstable'], }, - long_description='This is the core tribler functionality package which is used for the android app.', + long_description='Tribler core functionality package', ) From 677a533ab5b879bde82a7cf2f437225f3fe1898d Mon Sep 17 00:00:00 2001 From: Laurens Versluis Date: Thu, 30 Jun 2016 11:00:26 +0200 Subject: [PATCH 07/10] Refactored general excepts in LibtorrentDownloadImpl --- Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py b/Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py index 3fdff94b6c1..c0014a0eea4 100644 --- a/Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py +++ b/Tribler/Core/Libtorrent/LibtorrentDownloadImpl.py @@ -26,7 +26,7 @@ if sys.platform == "win32": try: import ctypes - except: + except ImportError: pass @@ -684,7 +684,7 @@ def set_selected_files(self, selected_files=None): if sys.platform == "win32": ctypes.windll.kernel32.SetFileAttributesW( unwanteddir_abs, 2) # 2 = FILE_ATTRIBUTE_HIDDEN - except: + except OSError: self._logger.error("LibtorrentDownloadImpl: could not create %s" % unwanteddir_abs) # Note: If the destination directory can't be accessed, libtorrent will not be able to store the files. # This will result in a DLSTATUS_STOPPED_ON_ERROR. From 8ac508cd4f1e29a124b4ba1ef08e7f52a863b0b1 Mon Sep 17 00:00:00 2001 From: Laurens Versluis Date: Thu, 30 Jun 2016 10:52:23 +0200 Subject: [PATCH 08/10] Refactored general except in startWorker --- Tribler/Main/Utility/GuiDBHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tribler/Main/Utility/GuiDBHandler.py b/Tribler/Main/Utility/GuiDBHandler.py index 3f6dedd9d7a..9b006236375 100644 --- a/Tribler/Main/Utility/GuiDBHandler.py +++ b/Tribler/Main/Utility/GuiDBHandler.py @@ -307,7 +307,7 @@ def startWorker( filename, line, function, _ = extract_stack(limit=2)[0] _, filename = os.path.split(filename) jobID = u"%s:%s (%s)" % (filename, line, function) - except: + except IndexError: pass result = ASyncDelayedResult(jobID) From 81953cbe593f6e49468d7664f3988917b68e5bf3 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Thu, 30 Jun 2016 14:52:24 +0200 Subject: [PATCH 09/10] update setup.py with readme and license --- setup.py | 147 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 55 deletions(-) diff --git a/setup.py b/setup.py index f5f3fb50cea..774fc395c3a 100644 --- a/setup.py +++ b/setup.py @@ -1,64 +1,101 @@ from distutils.core import setup from Tribler.Core.version import version_id + +with open('README.rst', 'r') as f: + long_description = f.read() + +with open('Tribler/LICENSE.txt', 'r') as f: + licenses = f.read() + +packages = [ + 'Tribler', + 'Tribler.Category', + 'Tribler.Core', + 'Tribler.Core.APIImplementation', + 'Tribler.Core.CacheDB', + 'Tribler.Core.Config', + 'Tribler.Core.DecentralizedTracking', + 'Tribler.Core.DecentralizedTracking.pymdht', + 'Tribler.Core.DecentralizedTracking.pymdht.core', + 'Tribler.Core.DecentralizedTracking.pymdht.plugins', + 'Tribler.Core.DecentralizedTracking.pymdht.profiler', + 'Tribler.Core.DecentralizedTracking.pymdht.profiler.parsers', + 'Tribler.Core.DecentralizedTracking.pymdht.ui', + 'Tribler.Core.DecentralizedTracking.pymdht.ut2mdht', + 'Tribler.Core.Libtorrent', + 'Tribler.Core.Modules', + 'Tribler.Core.Modules.channel', + 'Tribler.Core.Modules.restapi', + 'Tribler.Core.Modules.restapi.channels', + 'Tribler.Core.TFTP', + 'Tribler.Core.TorrentChecker', + 'Tribler.Core.Upgrade', + 'Tribler.Core.Utilities', + 'Tribler.Core.Video', + 'Tribler.Main', + 'Tribler.Main.Dialogs', + 'Tribler.Main.Emercoin', + 'Tribler.Main.Utility', + 'Tribler.Main.vwxGUI', + 'Tribler.Main.webUI', + 'Tribler.Policies', + 'Tribler.Utilities', + 'Tribler.community', + 'Tribler.community.allchannel', + 'Tribler.community.bartercast4', + 'Tribler.community.channel', + 'Tribler.community.demers', + 'Tribler.community.multichain', + 'Tribler.community.search', + 'Tribler.community.template', + 'Tribler.community.tunnel', + 'Tribler.community.tunnel.Socks5', + 'Tribler.community.tunnel.crypto', + 'Tribler.dispersy', + 'Tribler.dispersy.discovery', + 'Tribler.dispersy.libnacl.libnacl', + 'Tribler.dispersy.tool', + 'Tribler.dispersy.tracker', +] + +test_suite = [ + 'Tribler.dispersy.tests', + 'Tribler.dispersy.tests.debugcommunity', + 'Tribler.Test', + 'Tribler.Test.API', + 'Tribler.Test.Category', + 'Tribler.Test.Category.data.Tribler.Category', + 'Tribler.Test.Community', + 'Tribler.Test.Community.Bartercast', + 'Tribler.Test.Community.Multichain', + 'Tribler.Test.Community.Tunnel', + 'Tribler.Test.Core', + 'Tribler.Test.Core.data.config_files', + 'Tribler.Test.Core.data.libtorrent', + 'Tribler.Test.Core.data.sqlite_scripts', + 'Tribler.Test.Core.data.torrent_creation_files', + 'Tribler.Test.Core.data.upgrade_databases', + 'Tribler.Test.Core.Libtorrent', + 'Tribler.Test.Core.Modules', + 'Tribler.Test.Core.Modules.channel', + 'Tribler.Test.Core.Modules.Channel', + 'Tribler.Test.Core.Modules.RestApi', + 'Tribler.Test.Core.Modules.RestApi.Channels', + 'Tribler.Test.Core.Upgrade', + 'Tribler.Test.data', + 'Tribler.Test.data.41aea20908363a80d44234e8fef07fab506cd3b4', + 'Tribler.Test.data.contentdir', +] + setup( name='libtribler', + description='Tribler core functionality package', + long_description=long_description, + license=licenses, version=str(version_id), - author='Tribler', - packages=[ - 'Tribler', - 'Tribler.Category', - 'Tribler.Core', - 'Tribler.Core.APIImplementation', - 'Tribler.Core.CacheDB', - 'Tribler.Core.Config', - 'Tribler.Core.DecentralizedTracking', - 'Tribler.Core.DecentralizedTracking.pymdht', - 'Tribler.Core.DecentralizedTracking.pymdht.core', - 'Tribler.Core.DecentralizedTracking.pymdht.plugins', - 'Tribler.Core.DecentralizedTracking.pymdht.profiler', - 'Tribler.Core.DecentralizedTracking.pymdht.profiler.parsers', - 'Tribler.Core.DecentralizedTracking.pymdht.ui', - 'Tribler.Core.DecentralizedTracking.pymdht.ut2mdht', - 'Tribler.Core.Libtorrent', - 'Tribler.Core.Modules', - 'Tribler.Core.Modules.channel', - 'Tribler.Core.Modules.restapi', - 'Tribler.Core.Modules.restapi.channels', - 'Tribler.Core.TFTP', - 'Tribler.Core.TorrentChecker', - 'Tribler.Core.Upgrade', - 'Tribler.Core.Utilities', - 'Tribler.Core.Video', - 'Tribler.Main', - 'Tribler.Main.Dialogs', - 'Tribler.Main.Emercoin', - 'Tribler.Main.Utility', - 'Tribler.Main.vwxGUI', - 'Tribler.Main.webUI', - 'Tribler.Policies', - 'Tribler.Utilities', - 'Tribler.community', - 'Tribler.community.allchannel', - 'Tribler.community.bartercast4', - 'Tribler.community.channel', - 'Tribler.community.demers', - 'Tribler.community.multichain', - 'Tribler.community.search', - 'Tribler.community.template', - 'Tribler.community.tunnel', - 'Tribler.community.tunnel.Socks5', - 'Tribler.community.tunnel.crypto', - 'Tribler.dispersy', - 'Tribler.dispersy.discovery', - 'Tribler.dispersy.libnacl.libnacl', - 'Tribler.dispersy.tool', - 'Tribler.dispersy.tracker', - ], - url='https://github.com/Tribler/tribler', - license='LICENSE.txt', - description='Tribler', + author='Tribler team from Delft University of Technology', package_data={ 'Tribler': [ 'schema_sdb_v28.sql', @@ -70,5 +107,5 @@ 'bootstrap_stable', 'bootstrap_unstable'], }, - long_description='Tribler core functionality package', + packages=packages, ) From f067eb269490167fa2dadc0db5942f508a1c4425 Mon Sep 17 00:00:00 2001 From: Paul Brussee Date: Thu, 30 Jun 2016 19:13:21 +0200 Subject: [PATCH 10/10] fix unicode path warning on android --- Tribler/Core/osutils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Tribler/Core/osutils.py b/Tribler/Core/osutils.py index 02dc5f4f561..9674114ba73 100644 --- a/Tribler/Core/osutils.py +++ b/Tribler/Core/osutils.py @@ -133,16 +133,16 @@ def get_desktop_dir(): elif is_android(): def get_home_dir(): - return os.path.realpath(os.environ['ANDROID_PRIVATE']) + return os.path.realpath(unicode(os.environ['ANDROID_PRIVATE'])) def get_appstate_dir(): - return os.path.join(get_home_dir(), '.Tribler') + return os.path.join(get_home_dir(), u'.Tribler') def get_picture_dir(): - return os.path.join(get_desktop_dir(), 'DCIM') + return os.path.join(get_desktop_dir(), u'DCIM') def get_desktop_dir(): - return os.path.realpath(os.environ['EXTERNAL_STORAGE']) + return os.path.realpath(unicode(os.environ['EXTERNAL_STORAGE'])) else: # linux or darwin (mac)