Skip to content

Commit a54d161

Browse files
committed
Migrate setuptools plumbing to milksnake (closes #5)
1 parent d33da55 commit a54d161

10 files changed

Lines changed: 222 additions & 260 deletions

File tree

build-wheels.sh

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ function install_rust {
77
/tmp/rustup.sh -y --disable-sudo --channel=$1
88
}
99

10-
function update_certificates {
11-
# Update the Root CA bundle
12-
wget -q --no-check-certificate \
13-
-O /etc/pki/tls/certs/ca-bundle.crt \
14-
http://curl.haxx.se/ca/cacert.pem
15-
}
16-
1710
function clean_project {
1811
# Remove compiled files that might cause conflicts
1912
pushd /io/
@@ -30,13 +23,10 @@ RUST_CHANNEL=nightly
3023
# use the oldest supported one
3124
if [[ $1 == "osx" ]]; then
3225
brew update
33-
brew install mmv
26+
brew install
3427
pip install -U pip setuptools wheel
3528
install_rust $RUST_CHANNEL
3629
pip wheel . -w ./wheelhouse
37-
mmv "./wheelhouse/rust_fst-*-cp*-cp*-macosx*.whl" \
38-
"./wheelhouse/rust_fst-#1-py2.py3-none-macosx#4.whl"
39-
pip install cffi
4030
pip install -v rust_fst --no-index -f ./wheelhouse
4131
pip install -r "test-requirements.txt"
4232
cd ../
@@ -51,11 +41,8 @@ else
5141
# Remove old wheels
5242
rm -rf /io/wheelhouse/* || echo "No old wheels to delete"
5343

54-
# We don't support Python 2.6
55-
rm -rf /opt/python/cp26*
56-
5744
# Install libraries needed for compiling the extension
58-
yum -q -y install libffi-devel mmv
45+
yum -q -y install libffi-devel
5946

6047
# Compile wheel
6148
${PYBIN}/python -m pip wheel /io/ -w /wheelhouse/
@@ -69,10 +56,6 @@ else
6956
auditwheel repair $whl -w /io/wheelhouse/
7057
done
7158

72-
# Rename wheels to match all Python versions
73-
mmv "/io/wheelhouse/rust_fst-*-cp*-cp*-manylinux1_*.whl" \
74-
"/io/wheelhouse/rust_fst-#1-py2.py3-none-manylinux1_#4.whl"
75-
7659
# Set permissions on wheels
7760
chmod -R a+rw /io/wheelhouse
7861

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22

3-
name = "fst-wrapper"
3+
name = "rust_fst"
44
version = "0.3.0"
55
authors = ["Johannes Baiter <johannes.baiter@gmail.com>"]
66

77
[lib]
8-
name = "fstwrapper"
9-
crate-type = ["dylib"]
8+
name = "rust_fst"
9+
crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
libc = "0.2"

rust/rust_fst.h

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/** ===============================
2+
Utility
3+
=============================== **/
4+
5+
typedef struct {
6+
bool has_error;
7+
char* error_type;
8+
char* error_description;
9+
char* error_display;
10+
char* error_debug;
11+
} Context;
12+
13+
typedef struct BufWriter BufWriter;
14+
typedef struct Levenshtein Levenshtein;
15+
typedef struct Regex Regex;
16+
17+
Levenshtein* fst_levenshtein_new(Context*, char*, uint32_t);
18+
void fst_levenshtein_free(Levenshtein*);
19+
20+
Regex* fst_regex_new(Context*, char*);
21+
void fst_regex_free(Regex*);
22+
23+
Context* fst_context_new();
24+
void fst_context_free(Context*);
25+
26+
void fst_string_free(char*);
27+
28+
BufWriter* fst_bufwriter_new(Context*, char*);
29+
void fst_bufwriter_free(BufWriter*);
30+
31+
32+
/** ===============================
33+
Set
34+
=============================== **/
35+
36+
typedef struct FileSetBuilder FileSetBuilder;
37+
typedef struct MemSetBuilder MemSetBuilder;
38+
typedef struct Set Set;
39+
typedef struct SetStream SetStream;
40+
typedef struct SetLevStream SetLevStream;
41+
typedef struct SetRegexStream SetRegexStream;
42+
typedef struct SetOpBuilder SetOpBuilder;
43+
typedef struct SetUnion SetUnion;
44+
typedef struct SetIntersection SetIntersection;
45+
typedef struct SetDifference SetDifference;
46+
typedef struct SetSymmetricDifference SetSymmetricDifference;
47+
typedef struct SetStreamBuilder SetStreamBuilder;
48+
49+
FileSetBuilder* fst_filesetbuilder_new(Context*, BufWriter*);
50+
void fst_filesetbuilder_insert(Context*, FileSetBuilder*, char*);
51+
void fst_filesetbuilder_finish(Context*, FileSetBuilder*);
52+
53+
MemSetBuilder* fst_memsetbuilder_new();
54+
bool fst_memsetbuilder_insert(Context*, MemSetBuilder*, char*);
55+
Set* fst_memsetbuilder_finish(Context*, MemSetBuilder*);
56+
57+
Set* fst_set_open(Context*, char*);
58+
bool fst_set_contains(Set*, char*);
59+
size_t fst_set_len(Set*);
60+
bool fst_set_isdisjoint(Set*, Set*);
61+
bool fst_set_issubset(Set*, Set*);
62+
bool fst_set_issuperset(Set*, Set*);
63+
SetStream* fst_set_stream(Set*);
64+
SetLevStream* fst_set_levsearch(Set*, Levenshtein*);
65+
SetRegexStream* fst_set_regexsearch(Set*, Regex*);
66+
SetOpBuilder* fst_set_make_opbuilder(Set*);
67+
void fst_set_free(Set*);
68+
69+
char* fst_set_stream_next(SetStream*);
70+
void fst_set_stream_free(SetStream*);
71+
72+
char* fst_set_levstream_next(SetLevStream*);
73+
void fst_set_levstream_free(SetLevStream*);
74+
75+
char* fst_set_regexstream_next(SetRegexStream*);
76+
void fst_set_regexstream_free(SetRegexStream*);
77+
78+
void fst_set_opbuilder_push(SetOpBuilder*, Set*);
79+
void fst_set_opbuilder_free(SetOpBuilder*);
80+
SetUnion* fst_set_opbuilder_union(SetOpBuilder*);
81+
SetIntersection* fst_set_opbuilder_intersection(SetOpBuilder*);
82+
SetDifference* fst_set_opbuilder_difference(SetOpBuilder*);
83+
SetSymmetricDifference* fst_set_opbuilder_symmetricdifference(
84+
SetOpBuilder*);
85+
86+
char* fst_set_union_next(SetUnion*);
87+
void fst_set_union_free(SetUnion*);
88+
89+
char* fst_set_intersection_next(SetIntersection*);
90+
void fst_set_intersection_free(SetIntersection*);
91+
92+
char* fst_set_difference_next(SetDifference*);
93+
void fst_set_difference_free(SetDifference*);
94+
95+
char* fst_set_symmetricdifference_next(SetSymmetricDifference*);
96+
void fst_set_symmetricdifference_free(SetSymmetricDifference*);
97+
98+
SetStreamBuilder* fst_set_streambuilder_new(Set*);
99+
SetStreamBuilder* fst_set_streambuilder_add_ge(SetStreamBuilder*, char*);
100+
SetStreamBuilder* fst_set_streambuilder_add_lt(SetStreamBuilder*, char*);
101+
SetStream* fst_set_streambuilder_finish(SetStreamBuilder*);
102+
103+
104+
/** ===============================
105+
Map
106+
=============================== **/
107+
108+
typedef struct {
109+
char* key;
110+
uint64_t value;
111+
} MapItem;
112+
113+
typedef struct {
114+
size_t index;
115+
uint64_t value;
116+
} IndexedValue;
117+
118+
typedef struct {
119+
char* key;
120+
size_t num_values;
121+
IndexedValue* values;
122+
} MapOpItem;
123+
124+
125+
typedef struct FileMapBuilder FileMapBuilder;
126+
typedef struct MemMapBuilder MemMapBuilder;
127+
typedef struct Map Map;
128+
typedef struct MapStream MapStream;
129+
typedef struct MapLevStream MapLevStream;
130+
typedef struct MapRegexStream MapRegexStream;
131+
typedef struct MapKeyStream MapKeyStream;
132+
typedef struct MapValueStream MapValueStream;
133+
typedef struct MapOpBuilder MapOpBuilder;
134+
typedef struct MapUnion MapUnion;
135+
typedef struct MapIntersection MapIntersection;
136+
typedef struct MapDifference MapDifference;
137+
typedef struct MapSymmetricDifference MapSymmetricDifference;
138+
typedef struct MapStreamBuilder MapStreamBuilder;
139+
140+
FileMapBuilder* fst_filemapbuilder_new(Context*, BufWriter*);
141+
bool fst_filemapbuilder_insert(Context*, FileMapBuilder*, char*, uint64_t);
142+
bool fst_filemapbuilder_finish(Context*, FileMapBuilder*);
143+
144+
MemMapBuilder* fst_memmapbuilder_new();
145+
bool fst_memmapbuilder_insert(Context*, MemMapBuilder*, char*, uint64_t);
146+
Map* fst_memmapbuilder_finish(Context*, MemMapBuilder*);
147+
148+
Map* fst_map_open(Context*, char*);
149+
void fst_map_free(Map*);
150+
uint64_t fst_map_get(Context*, Map*, char*);
151+
size_t fst_map_len(Map*);
152+
bool fst_map_contains(Map*, char*);
153+
MapStream* fst_map_stream(Map*);
154+
MapKeyStream* fst_map_keys(Map*);
155+
MapValueStream* fst_map_values(Map*);
156+
MapLevStream* fst_map_levsearch(Map*, Levenshtein*);
157+
MapRegexStream* fst_map_regexsearch(Map*, Regex*);
158+
MapOpBuilder* fst_map_make_opbuilder(Map*);
159+
160+
MapItem* fst_mapstream_next(MapStream*);
161+
void fst_mapstream_free(MapStream*);
162+
void fst_mapitem_free(MapItem*);
163+
164+
char* fst_mapkeys_next(MapKeyStream*);
165+
void fst_mapkeys_free(MapKeyStream*);
166+
167+
uint64_t fst_mapvalues_next(Context*, MapValueStream*);
168+
void fst_mapvalues_free(MapValueStream*);
169+
170+
MapItem* fst_map_levstream_next(MapLevStream*);
171+
void fst_map_levstream_free(MapLevStream*);
172+
173+
MapItem* fst_map_regexstream_next(MapRegexStream*);
174+
void fst_map_regexstream_free(MapRegexStream*);
175+
176+
void fst_map_opbuilder_push(MapOpBuilder*, Map*);
177+
void fst_map_opbuilder_free(MapOpBuilder*);
178+
MapUnion* fst_map_opbuilder_union(MapOpBuilder*);
179+
MapIntersection* fst_map_opbuilder_intersection(MapOpBuilder*);
180+
MapDifference* fst_map_opbuilder_difference(MapOpBuilder*);
181+
MapSymmetricDifference* fst_map_opbuilder_symmetricdifference(
182+
MapOpBuilder*);
183+
void fst_map_opitem_free(MapOpItem*);
184+
185+
MapOpItem* fst_map_union_next(MapUnion*);
186+
void fst_map_union_free(MapUnion*);
187+
188+
MapOpItem* fst_map_intersection_next(MapIntersection*);
189+
void fst_map_intersection_free(MapIntersection*);
190+
191+
MapOpItem* fst_map_difference_next(MapDifference*);
192+
void fst_map_difference_free(MapDifference*);
193+
194+
MapOpItem* fst_map_symmetricdifference_next(MapSymmetricDifference*);
195+
void fst_map_symmetricdifference_free(MapSymmetricDifference*);
196+
197+
MapStreamBuilder* fst_map_streambuilder_new(Map*);
198+
MapStreamBuilder* fst_map_streambuilder_add_ge(MapStreamBuilder*, char*);
199+
MapStreamBuilder* fst_map_streambuilder_add_lt(MapStreamBuilder*, char*);
200+
MapStream* fst_map_streambuilder_finish(MapStreamBuilder*);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)