Skip to content

Commit

Permalink
drop requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Jun 3, 2015
1 parent eaba7a7 commit 3abe619
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 44 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ before_install:
- echo "START=yes" | sudo tee -a /etc/default/beanstalkd > /dev/null
- sudo service beanstalkd start
install:
- pip install --allow-all-external -r requirements.txt
- pip install coveralls httpbin pyproxy>=0.1.6
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install beanstalkc; fi
- pip install -e .
- pip install --allow-all-external -e .[all,test]
script:
- coverage run setup.py test
after_success:
Expand Down
23 changes: 15 additions & 8 deletions pyspider/message_queue/rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,25 @@
def catch_error(func):
"""Catch errors of rabbitmq then reconnect"""
import amqp
import pika.exceptions
try:
import pika.exceptions
connect_exceptions = (
pika.exceptions.ConnectionClosed,
pika.exceptions.AMQPConnectionError,
)
except ImportError:
connect_exceptions = ()

connect_exceptions += (
select.error,
socket.error,
amqp.ConnectionError
)

def wrap(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
except (
select.error,
socket.error,
pika.exceptions.ConnectionClosed,
pika.exceptions.AMQPConnectionError,
amqp.ConnectionError
) as e:
except connect_exceptions as e:
logging.error('RabbitMQ error: %r, reconnect.', e)
self.reconnect()
return func(self, *args, **kwargs)
Expand Down
70 changes: 45 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# http://binux.me
# Created on 2014-11-24 22:27:45


import sys
from setuptools import setup, find_packages
from codecs import open
from os import path
Expand All @@ -13,8 +15,43 @@
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()


import pyspider

install_requires = [
'Flask>=0.10',
'Jinja2>=2.7',
'chardet>=2.2',
'cssselect>=0.9',
'lxml',
'pycurl',
'pyquery',
'requests>=2.2',
'tornado>=3.2',
'Flask-Login>=0.2.11',
'u-msgpack-python>=1.6',
'click>=3.3',
'six',
]
if sys.version_info < (3, 0):
install_requires.extend([
'wsgidav',
])

extras_require_all = [
'mysql-connector-python>=1.2.2',
'amqp>=1.3.0',
'pymongo>=2.7.2,<3.0',
'SQLAlchemy>=0.9.7',
'redis',
'kombu',
]
if sys.version_info < (3, 0):
extras_require_all.extend([
'pika>=0.9.14',
'beanstalkc',
])


setup(
name='pyspider',
version=pyspider.__version__,
Expand Down Expand Up @@ -53,33 +90,16 @@

packages=find_packages(exclude=['data', 'tests*']),

install_requires=[
'Flask>=0.10',
'Jinja2>=2.7',
'chardet>=2.2',
'cssselect>=0.9',
'lxml',
'pycurl',
'pyquery',
'requests>=2.2',
'tornado>=3.2',
'Flask-Login>=0.2.11',
'u-msgpack-python>=1.6',
'click>=3.3',
'six',
],
install_requires=install_requires,

extras_require={
'all': [
'mysql-connector-python>=1.2.2',
'pika>=0.9.14',
'amqp>=1.3.0',
'pymongo>=2.7.2,<3.0',
'all': extras_require_all,
'test': [
'unittest2>=0.5.1',
'SQLAlchemy>=0.9.7',
'redis',
'kombu',
],
'coverage',
'httpbin',
'pyproxy>=0.1.6',
]
},

package_data={
Expand Down
8 changes: 1 addition & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
[tox]
envlist = py26,py27,py33,py34
[testenv]
deps =
-rrequirements.txt
coverage
httpbin
pyproxy>=0.1.6
py{26,27}: beanstalkc
install_command = pip install --allow-all-external {opts} {packages}
install_command = pip install --allow-all-external {opts} -e .[all,test] {packages}
commands =
coverage erase
coverage run setup.py test []
Expand Down

0 comments on commit 3abe619

Please sign in to comment.