|
1 | 1 | """ self-contained to write legacy pickle files """
|
2 | 2 | from __future__ import print_function
|
3 | 3 |
|
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 |
| - |
10 | 4 | def _create_sp_series():
|
11 | 5 |
|
12 | 6 | import numpy as np
|
@@ -114,21 +108,35 @@ def write_legacy_pickles():
|
114 | 108 | import sys
|
115 | 109 | sys.path.insert(0,'.')
|
116 | 110 |
|
117 |
| - import os |
| 111 | + import os, os.path |
118 | 112 | import numpy as np
|
119 | 113 | import pandas
|
120 | 114 | import pandas.util.testing as tm
|
121 | 115 | import platform as pl
|
122 | 116 |
|
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])) |
124 | 126 |
|
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)) |
126 | 134 |
|
127 | 135 | # construct a reasonable platform name
|
128 | 136 | f = '_'.join([ str(version), str(pl.machine()), str(pl.system().lower()), str(pl.python_version()) ])
|
129 | 137 | pth = '{0}.pickle'.format(f)
|
130 | 138 |
|
131 |
| - fh = open(pth,'wb') |
| 139 | + fh = open(os.path.join(output_dir,pth),'wb') |
132 | 140 | pickle.dump(create_data(),fh,pickle.HIGHEST_PROTOCOL)
|
133 | 141 | fh.close()
|
134 | 142 |
|
|
0 commit comments