Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3abe619

Browse files
committed
drop requirements.txt
1 parent eaba7a7 commit 3abe619

File tree

4 files changed

+62
-44
lines changed

4 files changed

+62
-44
lines changed

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ before_install:
1616
- echo "START=yes" | sudo tee -a /etc/default/beanstalkd > /dev/null
1717
- sudo service beanstalkd start
1818
install:
19-
- pip install --allow-all-external -r requirements.txt
20-
- pip install coveralls httpbin pyproxy>=0.1.6
21-
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then travis_retry pip install beanstalkc; fi
22-
- pip install -e .
19+
- pip install --allow-all-external -e .[all,test]
2320
script:
2421
- coverage run setup.py test
2522
after_success:

pyspider/message_queue/rabbitmq.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,25 @@
2424
def catch_error(func):
2525
"""Catch errors of rabbitmq then reconnect"""
2626
import amqp
27-
import pika.exceptions
27+
try:
28+
import pika.exceptions
29+
connect_exceptions = (
30+
pika.exceptions.ConnectionClosed,
31+
pika.exceptions.AMQPConnectionError,
32+
)
33+
except ImportError:
34+
connect_exceptions = ()
35+
36+
connect_exceptions += (
37+
select.error,
38+
socket.error,
39+
amqp.ConnectionError
40+
)
2841

2942
def wrap(self, *args, **kwargs):
3043
try:
3144
return func(self, *args, **kwargs)
32-
except (
33-
select.error,
34-
socket.error,
35-
pika.exceptions.ConnectionClosed,
36-
pika.exceptions.AMQPConnectionError,
37-
amqp.ConnectionError
38-
) as e:
45+
except connect_exceptions as e:
3946
logging.error('RabbitMQ error: %r, reconnect.', e)
4047
self.reconnect()
4148
return func(self, *args, **kwargs)

setup.py

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# http://binux.me
66
# Created on 2014-11-24 22:27:45
77

8+
9+
import sys
810
from setuptools import setup, find_packages
911
from codecs import open
1012
from os import path
@@ -13,8 +15,43 @@
1315
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
1416
long_description = f.read()
1517

16-
1718
import pyspider
19+
20+
install_requires = [
21+
'Flask>=0.10',
22+
'Jinja2>=2.7',
23+
'chardet>=2.2',
24+
'cssselect>=0.9',
25+
'lxml',
26+
'pycurl',
27+
'pyquery',
28+
'requests>=2.2',
29+
'tornado>=3.2',
30+
'Flask-Login>=0.2.11',
31+
'u-msgpack-python>=1.6',
32+
'click>=3.3',
33+
'six',
34+
]
35+
if sys.version_info < (3, 0):
36+
install_requires.extend([
37+
'wsgidav',
38+
])
39+
40+
extras_require_all = [
41+
'mysql-connector-python>=1.2.2',
42+
'amqp>=1.3.0',
43+
'pymongo>=2.7.2,<3.0',
44+
'SQLAlchemy>=0.9.7',
45+
'redis',
46+
'kombu',
47+
]
48+
if sys.version_info < (3, 0):
49+
extras_require_all.extend([
50+
'pika>=0.9.14',
51+
'beanstalkc',
52+
])
53+
54+
1855
setup(
1956
name='pyspider',
2057
version=pyspider.__version__,
@@ -53,33 +90,16 @@
5390

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

56-
install_requires=[
57-
'Flask>=0.10',
58-
'Jinja2>=2.7',
59-
'chardet>=2.2',
60-
'cssselect>=0.9',
61-
'lxml',
62-
'pycurl',
63-
'pyquery',
64-
'requests>=2.2',
65-
'tornado>=3.2',
66-
'Flask-Login>=0.2.11',
67-
'u-msgpack-python>=1.6',
68-
'click>=3.3',
69-
'six',
70-
],
93+
install_requires=install_requires,
7194

7295
extras_require={
73-
'all': [
74-
'mysql-connector-python>=1.2.2',
75-
'pika>=0.9.14',
76-
'amqp>=1.3.0',
77-
'pymongo>=2.7.2,<3.0',
96+
'all': extras_require_all,
97+
'test': [
7898
'unittest2>=0.5.1',
79-
'SQLAlchemy>=0.9.7',
80-
'redis',
81-
'kombu',
82-
],
99+
'coverage',
100+
'httpbin',
101+
'pyproxy>=0.1.6',
102+
]
83103
},
84104

85105
package_data={

tox.ini

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
[tox]
22
envlist = py26,py27,py33,py34
33
[testenv]
4-
deps =
5-
-rrequirements.txt
6-
coverage
7-
httpbin
8-
pyproxy>=0.1.6
9-
py{26,27}: beanstalkc
10-
install_command = pip install --allow-all-external {opts} {packages}
4+
install_command = pip install --allow-all-external {opts} -e .[all,test] {packages}
115
commands =
126
coverage erase
137
coverage run setup.py test []

0 commit comments

Comments
 (0)