Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
Mostly spell checking
Browse files Browse the repository at this point in the history
  • Loading branch information
JMSwag committed May 20, 2017
1 parent a7e98af commit 877ff1b
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
system
3.4.5
3.5.2
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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.

Expand Down Expand Up @@ -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.

8 changes: 4 additions & 4 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -892,4 +892,4 @@
- PyUpdater

- Some unused attributes on config object
- Unsed functions
- Unused functions
2 changes: 1 addition & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand Down
14 changes: 7 additions & 7 deletions pyupdater/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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))
23 changes: 12 additions & 11 deletions pyupdater/client/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand All @@ -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'}
Expand All @@ -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')
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions pyupdater/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 877ff1b

Please sign in to comment.