Skip to content

Commit

Permalink
Merge tag '2.3.0'
Browse files Browse the repository at this point in the history
version 2.3.0
  • Loading branch information
shad7 committed Jul 24, 2014
2 parents 9fcf959 + a11ada4 commit 11cee1b
Show file tree
Hide file tree
Showing 62 changed files with 1,387 additions and 335 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Expand Up @@ -56,3 +56,8 @@ doc/source/api/tests.*.rst
doc/source/api/autoindex.rst
doc/source/sourcecode

# Pycharm
.idea

# Vagrant
.vagrant
8 changes: 0 additions & 8 deletions .travis.yml
Expand Up @@ -6,11 +6,3 @@ install:
- pip install -r test-requirements.txt
script: tox
after_success: coveralls
deploy:
provider: pypi
user: Kenny.shad7
password:
secure: iwDQn9vzp0sfjM58B7FonDuFaWCI5EDZN+GisSSQ0B0DCa/u1qyyei7L6Btvw1m5YQxLyraebjgpfdbqI8/db2Ezkd5yswQJNmckDsnVIeWQH86U0xW2blpQedXtZqssW4hlpDcP6+PIqawcDYWTa5BXpAOv/CbAcIxkLWzlac0=
distributions: "sdist bdist_egg"
on:
tags: true
59 changes: 58 additions & 1 deletion ChangeLog
@@ -1,9 +1,66 @@
CHANGES
=======

2.2.4
2.3.0
-----

* Update to version v2.3.0
* removed deploy section; update_version.sh does this now as part of the tagging process
* updated documentation such that sphinx would format it correctly
* updated docstrings
* added classifiers for python 3.3 and 3.4
* added version badge to README
* added items related to vagrant and pycharm
* added debug to make sure check for mediafiles is working as expected
* added python34 and python33 to extend supported versions
* pep8 fix
* updated to be compliant with pyhton 3
* added TODO
* copied test code for bencode to make sure there is code coverage
* copied bencode into project to support python 3, and then updated custom parser to also support python 3
* removed pypi bencode from requirements
* copied and updated version to support python 3
* updated missing or incomplete docstrings
* moved private method to subclass where instance variable is defined
* removed unncessary priority and comparison methods
* added missing docstrings
* refactored setting log level for library code, and added missing docstrings
* removed unused parameter
* removed test case related to deleted code
* updated missing docstrings
* permissions got changed as part of move to vagrant
* corrected spelling of words in documentation
* refactored the writing of the stdout and stderr to further simplify
* replaced static method containing a single function call by calling function directly
* updated abstract to synchronize the signatures
* removed unncessary definition of variable to None
* updated process for logging stdout and stderr from external rsync process that works for both python2/python3
* leverage different name of torrents to avoid conflict between test threads
* fixed import order for pep8
* removed sorted() call as list is not sortable because the list holds classes and not instances
* removed unncessary call to getLevelName as setLevel already handles accepting named level
* include default values when accessing values from dict to support python2/python3
* updated access to dict to work for both python2 and python3
* leverage six iteritems for dict to support python2 and python3
* replaced warn with warning for python3 support
* replaced the use of map method with simple list extend method to suppot python3
* removed extra parentheses
* method expected a string, replaced None with empty string
* fixed class name
* converted print builtin calls to print function calls to be python3 compatiable
* fixed class name
* fixed naming of class
* fixed naming of class
* removed extra parentheses
* simplified variable comparison against 2 values
* updated method parameter name to be different than local variable used within the outter method
* converted print builtin calls to print function calls to be python3 compatiable
* converted print builtin calls to print function calls to be python3 compatiable
* converted print builtin calls to print function calls to be python3 compatiable
* changed name of parameter to avoid collision with outter method parameter
* removed extra parentheses
* moved global variable from inside function to module level
* changed local variable that shadows builtin to more descriptive variable name
* Update to version v2.2.4
* get_torrents_active did not take into account that the torrent contained media_files but to keep from processing the torrent and marking done and to keep query simple, added simple check if torrent contains media_files before adding to workflow list
* added script to handle packaging a new release, pushing to pypi, and releasing updates to remote git
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Expand Up @@ -13,6 +13,10 @@ SeedboxManager
:alt: Coverage


.. image:: https://badge.fury.io/py/SeedboxManager.svg
:target: http://badge.fury.io/py/SeedboxManager
:alt: Version


Links
=====
Expand Down
3 changes: 2 additions & 1 deletion doc/source/conf.py
Expand Up @@ -155,7 +155,8 @@ def find_autodoc_modules(module_name, sourcedir):
'pbr': ('http://docs.openstack.org/developer/pbr/', None),
'rarfile': ('https://rarfile.readthedocs.org/en/latest/', None),
'six': ('http://pythonhosted.org/six/', None),
'sqlalchemy': ('http://docs.sqlalchemy.org/en/rel_0_9/', None),
'sqlalchemy': ('http://docs.sqlalchemy.org/en/latest/',
None),
'stevedore': ('http://stevedore.readthedocs.org/en/latest/', None),
'xworkflows': ('http://xworkflows.readthedocs.org/en/latest/', None),
}
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
@@ -1,4 +1,3 @@
bencode
click
futures
oslo.config==1.2.1
Expand Down
2 changes: 1 addition & 1 deletion seedbox/cli.py
Expand Up @@ -35,7 +35,7 @@ def main():
cfg.CONF.log_opt_values(LOG, logging.DEBUG)

# need to create a lock to make sure multiple instances do not start at
# the sametime because we are running as a cron.
# the same time because we are running as a cron.
filelock = os.path.join(cfg.CONF.config_dir, 'seedmgr.lock')
lock = pidlockfile.PIDLockFile(filelock, timeout=10)
try:
Expand Down
17 changes: 17 additions & 0 deletions seedbox/common/timeutil.py
Expand Up @@ -75,6 +75,8 @@ def timed(method=None, logger=None, loglvl=None):
A decorator that times the execution of a method/function and logs
using the supplied logger at the specified loglevel.
:param method: the method being timed
:param logging.Logger logger: reference to logger
(defaults to logger of module holding the
decorated method or function)
Expand All @@ -101,6 +103,12 @@ def timed(method=None, logger=None, loglvl=None):
# like method name or doc.
@functools.wraps(method)
def timer(*args, **kwargs):
"""
Logs the execution time of the specified method.
:param args: the positional inputs to the method being timed
:param kwargs: the key-value inputs to the method being timed
:return: output of method being timed
"""
start = utcnow()
result = method(*args, **kwargs)
end = utcnow()
Expand All @@ -113,6 +121,15 @@ def timer(*args, **kwargs):


def nvl_date(dt, default=None):
"""
Determines if the provided date, time, or datetime has a value, and returns
the provided value back or the value of default (current time)
:param dt: an instance of a date, time, or datetime
:param default: value to return if provided dt has no value
:return: date, time, or datetime provided or default
:rtype: datetime
"""
_default = default if default else utcnow()
return dt if dt and isinstance(dt, datetime.datetime) else _default

Expand Down
4 changes: 4 additions & 0 deletions seedbox/common/tools.py
Expand Up @@ -13,6 +13,8 @@ def verify_path(path_entry):
"""
verify a path, if it exists make sure it is
an absolute path and return. else None
:param path_entry: path to file or directory on host
"""
if path_entry and os.path.exists(path_entry):
if os.path.isabs(path_entry):
Expand All @@ -27,6 +29,8 @@ def format_file_ext(filetypes):
"""
verifies that each item in the list of filetypes is a string
and starts with a '.'
:param list filetypes: a list of extensions representing types of files
"""

result_list = []
Expand Down
32 changes: 14 additions & 18 deletions seedbox/configs/generator.py
Expand Up @@ -59,12 +59,12 @@
def _write_output(output, outputfile):

if outputfile is None:
file = sys.stdout
outfile = sys.stdout
else:
file = open(outputfile, 'w')
outfile = open(outputfile, 'w')

for line in output:
print(line, file=file)
print(line, file=outfile)


def _sanitize_default(name, value):
Expand All @@ -79,7 +79,6 @@ def _gen_opt_output(opt):
if not opt_help:
sys.stderr.write('WARNING: [%s] is missing help string.\n' % opt_name)
opt_help = ''
opt_type = None
try:
opt_type = OPTION_REGEX.search(str(type(opt))).group(0)
except (ValueError, AttributeError) as err:
Expand Down Expand Up @@ -144,7 +143,7 @@ def _gen_group_opts_output(group, opts_by_module):
output.append('#')
output.append('')
for opt in opts:
map(output.append, _gen_opt_output(opt))
output.extend(_gen_opt_output(opt))
output.append('')

return output
Expand All @@ -160,7 +159,7 @@ def _is_in_group(opt, group):
return False


def _guess_groups(opt, mod_obj):
def _guess_groups(opt):
# is it in the DEFAULT group?
if _is_in_group(opt, cfg.CONF):
return DEFAULT_GROUP
Expand Down Expand Up @@ -188,25 +187,25 @@ def _is_cli_opt(opt):


def _list_opts(obj):
def is_opt(o):
def _is_opt(o):
return (isinstance(o, cfg.Opt) and
not isinstance(o, cfg.SubCommandOpt))

opts = list()
for attr_str in dir(obj):
attr_obj = getattr(obj, attr_str)
if is_opt(attr_obj):
if _is_opt(attr_obj):
opts.append(attr_obj)
elif (isinstance(attr_obj, list) and
all(map(lambda x: is_opt(x), attr_obj))):
all(map(lambda x: _is_opt(x), attr_obj))):
opts.extend(attr_obj)

ret = {}
for opt in opts:
# do not include cli in the config file
if _is_cli_opt(opt):
continue
ret.setdefault(_guess_groups(opt, obj), []).append(opt)
ret.setdefault(_guess_groups(opt), []).append(opt)
return ret.items()


Expand All @@ -222,12 +221,12 @@ def _import_module(mod_str):
def _gen_output(opts_by_group, outputfile):

output = []
map(output.append, _gen_group_opts_output(DEFAULT_GROUP,
opts_by_group.pop(DEFAULT_GROUP,
[])))
output.extend(_gen_group_opts_output(DEFAULT_GROUP,
opts_by_group.pop(DEFAULT_GROUP,
[])))
for group in sorted(opts_by_group.keys()):
map(output.append, _gen_group_opts_output(group,
opts_by_group[group]))
output.extend(_gen_group_opts_output(group,
opts_by_group[group]))

_write_output(output, outputfile)

Expand Down Expand Up @@ -285,9 +284,6 @@ def main():
"""
Entry point into generator (from command line) to generate a
sample configuration file
:param list sys.argv: list of source files to process for
capturing options
"""
generate(sys.argv[1:])

Expand Down
11 changes: 11 additions & 0 deletions seedbox/db/__init__.py
@@ -1,3 +1,6 @@
"""
Provides access to the database API for interacting with the torrent data.
"""
import copy
import logging

Expand Down Expand Up @@ -37,6 +40,14 @@ def _get_connection(conf):


def dbapi(conf=cfg.CONF):
"""
Retrieves an instance of the configured database API.
:param oslo.config.cfg.ConfigOpts conf: an instance of the configuration
file
:return: database API instance
:rtype: :class:`~seedbox.db.api.DBApi`
"""
global _DBAPI

if _DBAPI is None:
Expand Down
12 changes: 11 additions & 1 deletion seedbox/db/admin.py
Expand Up @@ -12,7 +12,10 @@


def print_version(ctx, value):
"""Print the current version of sandman and exit."""
"""Print the current version of sandman and exit.
:param ctx: application context
:param value:
"""
if not value:
return
click.echo('SeedboxManager v%s' % (version.version_string()))
Expand All @@ -35,6 +38,13 @@ def print_version(ctx, value):
@click.argument('URI', metavar='<URI>')
def run(generate_pks, show_pks, host, port, debug, uri):
"""Connect sandman to <URI> and start the API server/admin
:param generate_pks: Have sandman generate primary keys for tables
without one
:param show_pks: Have sandman show primary key columns in the admin view
:param host: Hostname of database server to connect to
:param port: Port of database server to connect to
:param debug: Enable debug output from webserver
:param uri: database uri
interface."""
app.config['SQLALCHEMY_DATABASE_URI'] = uri
app.config['SANDMAN_GENERATE_PKS'] = generate_pks
Expand Down

0 comments on commit 11cee1b

Please sign in to comment.