Skip to content

Commit f9a2aa5

Browse files
author
Asya Kamsky
committed
Restored compatibility with Python 2.6.0
Replacing subprocess.check_output and removing dictionary comprehensions restored ability to build with Python 2.6 and install Multicorn on CentOS 6 without any special steps.
1 parent d2ba40a commit f9a2aa5

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

META.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"runtime": {
3131
"requires": {
3232
"PostgreSQL": "9.2.0",
33-
"Python": "2.7.0"
33+
"Python": "2.6.0"
3434
}
3535
}
3636
},

doc/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Requirements
88
- Postgresql 9.1+
99
- Postgresql development packages
1010
- Python development packages
11-
- python 2.7 or >= python 3.3 as your default python
11+
- python 2.6 or >= python 3.3 as your default python
1212

1313
If you are using *PostgreSQL 9.1*, you should use the 0.9.1 release.
1414

preflight-check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ if [ ! -x "${PG_CONFIG}" ]; then
1616
exit 1
1717
fi
1818

19-
if [ ${PY_VERSION} != "2.7" ]; then
19+
if [ ${PY_VERSION} != "2.7" ] && [ ${PY_VERSION} != "2.6" ]; then
2020
if [ ${PY27_VERSION} != "2.7" ]; then
21-
echo "Found Python $PY_VERSION, but 2.7 is required."
21+
echo "Found Python $PY_VERSION, but 2.6 is required."
2222
exit 2
2323
fi
2424
fi

python/multicorn/fsfdw/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _item_from_dml(self, values):
276276
level=ERROR,
277277
hint="You can also insert an item by providing"
278278
" only the filename and content columns")
279-
values = {key: str(value) for key, value in values.items()}
279+
values = dict([(key, str(value)) for key, value in values.items()])
280280
item_from_values = self.structured_directory.create(**values)
281281
elif item_from_filename is None:
282282
log_to_postgres("The filename, or all pattern columns are needed.",
@@ -331,9 +331,9 @@ def update(self, oldfilename, newvalues):
331331
olditem.content = olditem.read()
332332
new_filename = newvalues.get(self.filename_column, oldfilename)
333333
filename_changed = new_filename != oldfilename
334-
values = {key: (None if value is None else str(value))
334+
values = dict([(key, (None if value is None else str(value)))
335335
for key, value in newvalues.items()
336-
if key not in (self.filename_column, self.content_column)}
336+
if key not in (self.filename_column, self.content_column)])
337337
values_changed = dict(olditem) != values
338338
# Check for null values in the "important" parts
339339
null_columns = [key for key in self.structured_directory.properties

python/multicorn/processfdw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ def _convert(self, key, value):
9292

9393
def execute(self, quals, columns):
9494
for process in psutil.process_iter():
95-
yield {key: self._convert(key, value)
96-
for key, value in process.as_dict(columns).items()}
95+
yield dict([(key, self._convert(key, value))
96+
for key, value in process.as_dict(columns).items()])

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
# hum... borrowed from psycopg2
55
def get_pg_config(kind, pg_config="pg_config"):
6-
r = subprocess.check_output([pg_config, '--%s' % kind])
7-
r = r.strip().decode('utf8')
6+
p = subprocess.Popen([pg_config, '--%s' % kind], stdout=subprocess.PIPE)
7+
r = p.communicate()
8+
r = r[0].strip().decode('utf8')
89
if not r:
910
raise Warning(p[2].readline())
1011
return r

0 commit comments

Comments
 (0)