Skip to content

Commit 89b7026

Browse files
committed
BLD: add 0.13.0 pickles support
1 parent 3776c84 commit 89b7026

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

pandas/io/tests/generate_legacy_pickles.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
""" self-contained to write legacy pickle files """
22
from __future__ import print_function
33

4-
# make sure we are < 0.13 compat (in py3)
5-
try:
6-
from pandas.compat import zip, cPickle as pickle
7-
except:
8-
import pickle
9-
104
def _create_sp_series():
115

126
import numpy as np
@@ -114,21 +108,35 @@ def write_legacy_pickles():
114108
import sys
115109
sys.path.insert(0,'.')
116110

117-
import os
111+
import os, os.path
118112
import numpy as np
119113
import pandas
120114
import pandas.util.testing as tm
121115
import platform as pl
122116

123-
print("This script generates a pickle file for the current arch, system, and python version")
117+
# make sure we are < 0.13 compat (in py3)
118+
try:
119+
from pandas.compat import zip, cPickle as pickle
120+
except:
121+
import pickle
122+
123+
sys_version = version = pandas.__version__
124+
if len(sys.argv) < 2:
125+
exit("{0} <version> <output_dir>".format(sys.argv[0]))
124126

125-
version = pandas.__version__
127+
version = str(sys.argv[1])
128+
output_dir = str(sys.argv[2])
129+
130+
print("This script generates a pickle file for the current arch, system, and python version")
131+
print(" system version: {0}".format(sys_version))
132+
print(" output version: {0}".format(version))
133+
print(" output dir : {0}".format(output_dir))
126134

127135
# construct a reasonable platform name
128136
f = '_'.join([ str(version), str(pl.machine()), str(pl.system().lower()), str(pl.python_version()) ])
129137
pth = '{0}.pickle'.format(f)
130138

131-
fh = open(pth,'wb')
139+
fh = open(os.path.join(output_dir,pth),'wb')
132140
pickle.dump(create_data(),fh,pickle.HIGHEST_PROTOCOL)
133141
fh.close()
134142

pandas/io/tests/test_pickle.py

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def test_read_pickles_0_11_0(self):
8080
def test_read_pickles_0_12_0(self):
8181
self.read_pickles('0.12.0')
8282

83+
def test_read_pickles_0_13_0(self):
84+
self.read_pickles('0.13.0')
85+
8386
def test_round_trip_current(self):
8487

8588
for typ, dv in self.data.items():

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ def pxd(name):
555555
'tests/data/legacy_pickle/0.10.1/*.pickle',
556556
'tests/data/legacy_pickle/0.11.0/*.pickle',
557557
'tests/data/legacy_pickle/0.12.0/*.pickle',
558+
'tests/data/legacy_pickle/0.13.0/*.pickle',
558559
'tests/data/*.csv',
559560
'tests/data/*.dta',
560561
'tests/data/*.txt',

0 commit comments

Comments
 (0)