pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python-beaver/python-beaver/commit/525b540899e6251a0636677a50333892df59ccec

link crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-b40ec823a1a6a1af.css" /> Improve Python 2.6 support · python-beaver/python-beaver@525b540 · GitHub
Skip to content

Commit 525b540

Browse files
committed
Improve Python 2.6 support
1 parent 54ed876 commit 525b540

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

beaver/beaver_config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import ConfigParser
2-
import collections
32
import os
43
import socket
54
import warnings
65

6+
try:
7+
from collections import OrderedDict
8+
except ImportError:
9+
from ordereddict import OrderedDict
10+
711

812
class BeaverConfig():
913

@@ -98,7 +102,7 @@ def _parse_beaver_config(self, args):
98102
else:
99103
config['hostname'] = socket.gethostname()
100104

101-
config = collections.OrderedDict(sorted(config.items()))
105+
config = OrderedDict(sorted(config.items()))
102106
return config
103107

104108
def get(self, key, default=None):
@@ -173,4 +177,3 @@ def check_for_deprecated_usage(self):
173177
if len(deprecated_env_var_usage) > 0:
174178
warnings.simplefilter('default')
175179
warnings.warn('ENV Variable support will be removed by version 20. Stop using: {0}'.format(", ".join(deprecated_env_var_usage)), DeprecationWarning)
176-

beaver/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ def setup_custom_logger(name, debug=False, formatter=None):
2323
if debug:
2424
logger.setLevel(logging.DEBUG)
2525
logger.info('Debug level is on')
26-
logging.captureWarnings(True)
26+
if hasattr(logging, 'captureWarnings'):
27+
# New in Python 2.7
28+
logging.captureWarnings(True)
2729
else:
2830
logger.setLevel(logging.INFO)
2931
logger.info('Info level is on')
30-
logging.captureWarnings(False)
32+
if hasattr(logging, 'captureWarnings'):
33+
# New in Python 2.7
34+
logging.captureWarnings(False)
3135

3236
return logger
3337

requirements/base26.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
argparse>=1.2.0
2+
pika>=0.9.5
3+
redis==2.4.11
4+
ujson==1.9
5+
ordereddict

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
2+
import sys
23

34
from beaver import __version__
45

@@ -7,6 +8,12 @@
78
except ImportError:
89
from distutils.core import setup
910

11+
12+
if sys.version_info[:2] <= (2, 6):
13+
requirements = open('requirements/base26.txt').readlines()
14+
else:
15+
requirements = open('requirements/base.txt').readlines()
16+
1017
setup(
1118
name='Beaver',
1219
version=__version__,
@@ -29,5 +36,5 @@
2936
open('CHANGES.rst').read(),
3037
tests_require=['nose'],
3138
test_suite='nose.collector',
32-
install_requires=open('requirements/base.txt').readlines(),
39+
install_requires=requirements,
3340
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy