1
0
mirror of https://github.com/balkian/bitter.git synced 2024-12-21 08:08:12 +00:00

Changed versioning, added locks

This commit is contained in:
J. Fernando Sánchez 2016-09-28 01:05:13 +02:00
parent 39726a12d9
commit 09feb050a6
8 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,7 @@
include requirements.txt
include test-requirements.txt
include README.md
include bitter/VERSION
graft bitter/templates
graft bitter/static
graft test

1
bitter/VERSION Normal file
View File

@ -0,0 +1 @@
0.5.4

View File

@ -3,8 +3,15 @@ Bitter module. A library and cli for Twitter using python-twitter.
http://github.com/balkian/bitter
"""
from future.standard_library import install_aliases
install_aliases()
try:
from future.standard_library import install_aliases
install_aliases()
except ImportError:
# Avoid problems at setup.py and py3.x
pass
import os
from .version import __version__
__version__ = '0.5.0'
__all__ = ['cli', 'config', 'crawlers', 'models', 'utils' ]

View File

@ -8,6 +8,7 @@ logger = logging.getLogger(__name__)
from twitter import *
from collections import OrderedDict
from threading import Lock
from . import utils
from . import config
@ -41,6 +42,7 @@ class TwitterWorker(object):
self.name = name
self.client = client
self.throttled_time = False
self._lock = Lock()
self.busy = False
@property
@ -76,6 +78,7 @@ class TwitterQueue(AttrToFunc):
c = None
try:
c = self.next()
c._lock.acquire()
c.busy = True
logger.debug('Next: {}'.format(c.name))
ping = time.time()
@ -97,6 +100,7 @@ class TwitterQueue(AttrToFunc):
finally:
if c:
c.busy = False
c._lock.release()
@property

4
bitter/version.py Normal file
View File

@ -0,0 +1,4 @@
import os
with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as f:
__version__ = f.read().strip()

View File

@ -1 +1,2 @@
contextlib2
future

View File

@ -1,4 +1,3 @@
sqlalchemy
twitter
click
future

View File

@ -23,16 +23,12 @@ if sys.version_info <= (3, 0):
install_reqs = [str(ir.req) for ir in install_reqs]
test_reqs = [str(ir.req) for ir in test_reqs]
with open('bitter/__init__.py') as f:
exec(f.read())
from bitter import __version__
setup(
name="bitter",
packages=['bitter'],
description='''
Simplifying how researchers access Data.
It includes a CLI and a library.
''',
description=" Simplifying how researchers access Data. It includes a CLI and a library.",
author='J. Fernando Sanchez',
author_email='balkian@gmail.com',
url="http://balkian.com",