]>
git.saurik.com Git - cycript.git/blob - libcycript.py
18 line
= sys
.stdin
.readline()
23 assert line
[-1] == '\n'
26 pipe
= line
.index('|')
30 quote
= line
.index('"')
31 flags
= int(line
[0:quote
])
32 code
= line
[quote
+1:-1]
34 key
= (name
, flags
, code
)
38 with sqlite3
.connect(db
) as sql
:
40 for name
, system
, flags
, code
in c
.execute('select name, system, flags, code from cache'):
41 key
= (name
, flags
, code
)
42 keys
[key
] = keys
.get(key
, 0) | system
44 if os
.path
.exists(dbfile
):
47 with sqlite3
.connect(dbfile
) as sql
:
50 c
.execute("create table cache (name text not null, system int not null, flags int not null, code text not null, primary key (name, system))")
51 c
.execute("create table module (name text not null, flags int not null, code blob not null, primary key (name))")
53 for name
in [js
[0:-3] for js
in os
.listdir(nodejs
) if js
.endswith('.js')]:
54 with open(nodejs
+ '/' + name
+ '.js', 'r') as file:
56 c
.execute("insert into module (name, flags, code) values (?, ?, ?)", [name
, 0, buffer(code
)])
59 for key
, system
in keys
.items():
60 name
, flags
, code
= key
61 many
.append((name
, system
, flags
, code
))
62 c
.executemany("insert into cache (name, system, flags, code) values (?, ?, ?, ?)", many
)