Skip to content

Commit

Permalink
Version 1.0.2 - add empty files check
Browse files Browse the repository at this point in the history
  • Loading branch information
kz26 committed Aug 23, 2016
1 parent 7093065 commit 9ff560f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

1.0.2
-----
* Raise exception when path is a directory and no files exist

1.0.1
-----

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# built documents.
#
# The short X.Y version.
version = '1.0.1'
version = '1.0.2'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
4 changes: 4 additions & 0 deletions dottorrent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def get_info(self):
fpath = os.path.normpath(os.path.join(x[0], fn))
total_size += os.path.getsize(fpath)
total_files += 1
if not total_files:
raise Exception("No files found in {}".format(self.path))
if self.piece_size:
ps = self.piece_size
else:
Expand Down Expand Up @@ -174,6 +176,8 @@ def generate(self, include_md5=False, callback=None):
fpath = os.path.normpath(os.path.join(x[0], fn))
fsize = os.path.getsize(fpath)
self._files.append((fpath, fsize, {}))
if not len(self._files):
raise Exception("No files found in {}".format(self.path))
total_size = sum([x[1] for x in self._files])
# set piece size if not already set
if self.piece_size is None:
Expand Down
2 changes: 1 addition & 1 deletion dottorrent/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.1'
__version__ = '1.0.2'

0 comments on commit 9ff560f

Please sign in to comment.