diff --git a/.python-version b/.python-version new file mode 100644 index 00000000..572146f3 --- /dev/null +++ b/.python-version @@ -0,0 +1,3 @@ +system +3.4.5 +3.5.2 diff --git a/README.md b/README.md index 1065bb19..9418ff83 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [![Gitter](https://badges.gitter.im/pyupdater/Lobby.svg)](https://gitter.im/pyupdater/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) # PyUpdater -####An autoupdate framework for pyinstaller that enables simple, secure & efficient shipment of app updates. +#### An autoupdate framework for pyinstaller that enables simple, secure & efficient shipment of app updates. -####[Docs](http://www.pyupdater.org) - [Installation](http://www.pyupdater.org/installation) - [Changelog](http://www.pyupdater.org/changelog/) - [License](http://www.pyupdater.org/license/) +#### [Docs](http://www.pyupdater.org) - [Installation](http://www.pyupdater.org/installation) - [Changelog](http://www.pyupdater.org/changelog/) - [License](http://www.pyupdater.org/license/) +py diff --git a/docs/api.md b/docs/api.md index 9cfa0e01..20a8e558 100644 --- a/docs/api.md +++ b/docs/api.md @@ -65,7 +65,7 @@ then restart the application using the updated binary. Used to check if update has been downloaded. ######Returns (bool): True - File is already downloaded. -False - File hasn't been downloaded. +False - File has not been downloaded. ##### AppUpdate.restart() @@ -77,7 +77,7 @@ Deprecated: Used extract_restart instead. ##### AppUpdate.win_extract_overwrite() -Overwrite current binary with update bianry on windows. +Overwrite current binary with update binary on windows. Deprecated: Use extract_overwrite instead. @@ -203,5 +203,5 @@ complete update. Used to check if update has been downloaded. ######Returns (bool): True - File is already downloaded. -False - File hasn't been downloaded. +False - File has not been downloaded. diff --git a/docs/changelog.md b/docs/changelog.md index c3cdcc98..4b9cc487 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -600,7 +600,7 @@ - Client - Support for offline root keys - - Sanatizing url attributes + - Sanitizing url attributes - Patches clients up to 4 versions behind - Config is now a dict instead of class - Logging errors for 3rd party services @@ -856,7 +856,7 @@ - Potential incorrect comparison of pyinstaller versions - Archive version parsing - - Crashing if directory doesn't exists + - Crashing if directory does not exists - Pinning version of plugins - Initial support for pre release versions - Moved some uploader config to plugins. Check plugin docs for more info. @@ -869,7 +869,7 @@ - Plugins - from pyi_updater.uploader import BaseUploader - - from pyi_updater.uploader.commom import BaseUploader will + - from pyi_updater.uploader.common import BaseUploader will be remove in v0.22+ ###Fixed @@ -892,4 +892,4 @@ - PyUpdater - Some unused attributes on config object - - Unsed functions + - Unused functions diff --git a/docs/commands.md b/docs/commands.md index f3001f53..57ed81c9 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -15,7 +15,7 @@ optional arguments: Description: -The archive command will archive an external asset used by your application which will allow updating of the asset. An example of this would be if your application depended on ffmpeg but you didn't want to bundle ffmpeg within your app. See "Usage | CLI | Assets" & "Usage | Client | Assets" for more info. +The archive command will archive an external asset used by your application which will allow updating of the asset. An example of this would be if your application depended on ffmpeg but you did not want to bundle ffmpeg within your app. See "Usage | CLI | Assets" & "Usage | Client | Assets" for more info. Example: ``` diff --git a/pyupdater/client/__init__.py b/pyupdater/client/__init__.py index 595cd9a5..c54ac343 100644 --- a/pyupdater/client/__init__.py +++ b/pyupdater/client/__init__.py @@ -133,7 +133,7 @@ def init_app(self, obj, refresh=False, test=False, data_dir=None): update_urls = config.get('UPDATE_URLS', []) # List of URL to check for update data - self.update_urls = Client._sanatize_update_url(update_urls) + self.update_urls = Client._sanitize_update_url(update_urls) # Name of the running application self.app_name = config.get('APP_NAME', 'PyUpdater') @@ -516,15 +516,15 @@ def _setup(self): os.makedirs(d) @staticmethod - def _sanatize_update_url(urls): - sanatized_urls = [] + def _sanitize_update_url(urls): + sanitized_urls = [] # Adds trailing slash to end of url if not already provided. # Doing this so when requesting online resources we only - # need to add the resouce name to the end of the request. + # need to add the resource name to the end of the request. for u in urls: if not u.endswith('/'): - sanatized_urls.append(u + '/') + sanitized_urls.append(u + '/') else: - sanatized_urls.append(u) + sanitized_urls.append(u) # Removing duplicates - return list(set(sanatized_urls)) + return list(set(sanitized_urls)) diff --git a/pyupdater/client/downloader.py b/pyupdater/client/downloader.py index 867fea39..426b7f57 100644 --- a/pyupdater/client/downloader.py +++ b/pyupdater/client/downloader.py @@ -221,11 +221,11 @@ def _download_to_storage(self, check_hash=True): self.file_binary_type = 'memory' # Setting start point to show progress - recieved_data = 0 + received_data = 0 start_download = time.time() block = data.read(1) - recieved_data += len(block) + received_data += len(block) if self.file_binary_type == 'memory': self.file_binary_data = [block] else: @@ -260,21 +260,22 @@ def _download_to_storage(self, check_hash=True): hash_.update(block) # Total data we've received so far - recieved_data += len(block) + self.data = received_data + self.data += len(block) # If content length is None we will return a static percent # -.-% - percent = self._calc_progress_percent(recieved_data, + percent = self._calc_progress_percent(received_data, self.content_length) # If content length is None we will return a static time remaining # --:-- time_left = FileDownloader._calc_eta(start_download, time.time(), self.content_length, - recieved_data) + received_data) status = {'total': self.content_length, - 'downloaded': recieved_data, + 'downloaded': received_data, 'status': 'downloading', 'percent_complete': percent, 'time': time_left} @@ -283,7 +284,7 @@ def _download_to_storage(self, check_hash=True): self._call_progress_hooks(status) status = {'total': self.content_length, - 'downloaded': recieved_data, + 'downloaded': received_data, 'status': 'finished', 'percent_complete': percent, 'time': '00:00'} @@ -294,11 +295,11 @@ def _download_to_storage(self, check_hash=True): # Checks hash of downloaded file if self.hexdigest is None: # No hash provided to check. - # So just return any data recieved + # So just return any data received log.debug('No hash to verify') return None if self.file_binary_data is None: - # Exit quickly if we got nohting to compare + # Exit quickly if we got nothing to compare # Also I'm sure we'll get an exception trying to # pass None to get hash :) log.debug('Cannot verify file hash - No Data') @@ -390,9 +391,9 @@ def _calc_eta(start, now, total, current): return '--:--' return '%02d:%02d' % (eta_mins, eta_secs) - def _calc_progress_percent(self, recieved, total): + def _calc_progress_percent(self, received, total): if total is None: return '-.-%' - percent = float(recieved) / total * 100 + percent = float(received) / total * 100 percent = '%.1f' % percent return percent diff --git a/pyupdater/utils/__init__.py b/pyupdater/utils/__init__.py index 79926692..e2e00d06 100644 --- a/pyupdater/utils/__init__.py +++ b/pyupdater/utils/__init__.py @@ -341,7 +341,7 @@ def create_asset_archive(name, version): system.get_system(), version) # Only use zip on windows. - # Zip doens't preserve file permissions on nix & mac + # Zip does not preserve file permissions on nix & mac with paths.ChDir(file_dir): if system.get_system() == 'win': ext = '.zip' @@ -391,7 +391,7 @@ def make_archive(name, target, version): system.get_system(), version) # Only use zip on windows. - # Zip doens't preserve file permissions on nix & mac + # Zip does not preserve file permissions on nix & mac # tar.gz creates full file path with paths.ChDir(file_dir): if system.get_system() == 'win': @@ -498,7 +498,7 @@ def __iter__(self): return iter(i) @staticmethod - def _sanatize(data): + def _sanitize(data): _data = {} for k, v in data.items(): if hasattr(v, '__call__') is True: @@ -530,7 +530,7 @@ def sync(self, json_kw=None, force=False): if not (self._needs_sync or force): return False - data = JSONStore._sanatize(self._data) + data = JSONStore._sanitize(self._data) with io.open(self.path, 'w', encoding='utf-8') as json_file: data = json.dumps(data, ensure_ascii=False, indent=2) if six.PY2: diff --git a/tests/conftest.py b/tests/conftest.py index 223acb62..9eee24a0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,7 +32,7 @@ from SimpleHTTPServer import SimpleHTTPRequestHandler as RequestHandler try: import socketserver as socket_server -except: +except ImportError: import SocketServer as socket_server import pytest