Skip to content

Commit baa3093

Browse files
committedOct 16, 2015
Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version.
1 parent 28c933c commit baa3093

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1017
-84
lines changed
 

‎hacking/update_bundled.py

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/python2 -tt
2+
3+
import glob
4+
import json
5+
import os.path
6+
from distutils.version import LooseVersion
7+
8+
from ansible.module_utils.urls import open_url
9+
10+
basedir = os.path.dirname(__file__)
11+
12+
for filename in glob.glob(os.path.join(basedir, '../lib/ansible/compat/*/__init__.py')):
13+
if 'compat/tests' in filename:
14+
# compat/tests doesn't bundle any code
15+
continue
16+
17+
filename = os.path.normpath(filename)
18+
with open(filename, 'r') as module:
19+
for line in module:
20+
if line.strip().startswith('_BUNDLED_METADATA'):
21+
data = line[line.index('{'):].strip()
22+
break
23+
else:
24+
print('WARNING: {0} contained no metadata. Could not check for updates'.format(filename))
25+
continue
26+
metadata = json.loads(data)
27+
pypi_fh = open_url('https://pypi.python.org/pypi/{0}/json'.format(metadata['pypi_name']))
28+
pypi_data = json.loads(pypi_fh.read())
29+
if LooseVersion(metadata['version']) < LooseVersion(pypi_data['info']['version']):
30+
print('UPDATE: {0} from {1} to {2} {3}'.format(
31+
metadata['pypi_name'],
32+
metadata['version'],
33+
pypi_data['info']['version'],
34+
'https://pypi.python.org/pypi/{0}/'.format(metadata['pypi_name'])))

‎lib/ansible/cli/doc.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
import traceback
2525
import textwrap
2626

27-
from six import iteritems
27+
from ansible.compat.six import iteritems
2828

29-
from ansible import constants as C
3029
from ansible.errors import AnsibleError, AnsibleOptionsError
3130
from ansible.plugins import module_loader
3231
from ansible.cli import CLI

0 commit comments

Comments
 (0)
Please sign in to comment.