Skip to content

Commit

Permalink
Use setuptools.
Browse files Browse the repository at this point in the history
  • Loading branch information
im-0 committed Mar 27, 2016
1 parent 6f56b5c commit 6f8ccf7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cometblue/cli.py
Expand Up @@ -6,6 +6,7 @@
import itertools
import json
import logging
import os
import sys

import click
Expand Down Expand Up @@ -455,7 +456,7 @@ def _device(ctx, address, pin, pin_file):
show_default=True,
default='error')
@click.pass_context
def main(ctx, adapter, channel_type, security_level, formatter, log_level):
def _main(ctx, adapter, channel_type, security_level, formatter, log_level):
_configure_logger(_get_log_level(log_level))

ctx.obj.adapter = adapter
Expand All @@ -469,6 +470,8 @@ def main(ctx, adapter, channel_type, security_level, formatter, log_level):
else:
ctx.obj.formatter = _ShellVarFormatter()

return os.EX_OK


class _SetterFunctions(object):
@staticmethod
Expand Down Expand Up @@ -619,13 +622,13 @@ def real_set_fn(ctx, value):
_device_set.add_command(set_fn)


if __name__ == '__main__':
def main():
_configure_logger()

_add_values()

main.add_command(_discover)
main.add_command(_device)
_main.add_command(_discover)
_main.add_command(_device)

_device.add_command(_device_get)
_device.add_command(_device_set)
Expand All @@ -636,4 +639,8 @@ def real_set_fn(ctx, value):
_device_set.add_command(_device_set_day)
_device_set.add_command(_device_set_holiday)

main(obj=_ContextObj())
return _main(obj=_ContextObj())


if __name__ == '__main__':
exit(main())
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,5 +1,6 @@
click
gattlib
pbr
shellescape
six
tabulate
18 changes: 18 additions & 0 deletions setup.cfg
@@ -0,0 +1,18 @@
[metadata]
name = cometblue
summary = Command line tool for "Comet Blue" radiator thermostat
author = Ivan Mironov
author-email = mironov.ivan@gmail.com
home-page = https://localhost/

[global]
setup-hooks =
pbr.hooks.setup_hook

[files]
packages =
cometblue

[entry_points]
console_scripts =
cometblue = cometblue.cli:main
9 changes: 9 additions & 0 deletions setup.py
@@ -0,0 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import setuptools


setuptools.setup(
setup_requires=['pbr'],
pbr=True)

0 comments on commit 6f8ccf7

Please sign in to comment.