Skip to content

Commit 821c18a

Browse files
committed
Address review
- drop unnecessary function - use version instead of tag name - example version and version year
1 parent 78a9528 commit 821c18a

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

tools/ports/sqlite3.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
import shutil
88
import logging
99

10-
TAG = '3380500'
10+
# sqlite amalgamation download URL uses relase year and tag
11+
# 2022 and (3, 38, 5) -> '/2022/sqlite-amalgamation-3380500.zip'
12+
VERSION = (3, 38, 5)
13+
VERSION_YEAR = 2022
1114
HASH = '4fc2992e4c1ca1664a9b01e07c9b944003c4ed0612978e471eff262a7114e4a0699244d91e71ae4ad2b5e1fc9829917cd7d5f0313aa5859036905f974548d94a'
1215

1316
deps = []
@@ -22,13 +25,14 @@ def get_lib_name(settings):
2225

2326

2427
def get(ports, settings, shared):
25-
# TODO: This is an emscripten-hosted mirror of the sqlite repo from sqlite.prg.
26-
ports.fetch_project('sqlite3', 'https://www.sqlite.org/2022/sqlite-amalgamation-' + TAG + '.zip', 'sqlite-amalgamation-' + TAG, sha512hash=HASH)
28+
release = f'sqlite-amalgamation-{VERSION[0]}{VERSION[1]:02}{VERSION[2]:02}00'
29+
# TODO: Fetch the file from an emscripten-hosted mirror.
30+
ports.fetch_project('sqlite3', f'https://www.sqlite.org/{VERSION_YEAR}/{release}.zip', release, sha512hash=HASH)
2731

2832
def create(final):
2933
logging.info('building port: libsqlite3')
3034

31-
source_path = os.path.join(ports.get_dir(), 'sqlite3', 'sqlite-amalgamation-' + TAG)
35+
source_path = os.path.join(ports.get_dir(), 'sqlite3', release)
3236
dest_path = os.path.join(ports.get_build_dir(), 'sqlite3')
3337

3438
shutil.rmtree(dest_path, ignore_errors=True)
@@ -62,12 +66,14 @@ def create(final):
6266
'-DSQLITE_ENABLE_FTS5=1',
6367
'-DSQLITE_ENABLE_RTREE=1',
6468
'-DSQLITE_ENABLE_GEOPOLY=1',
65-
'-DSQLITE_OMIT_POPEN=1'
69+
'-DSQLITE_OMIT_POPEN=1',
6670
]
6771
if settings.USE_PTHREADS:
68-
flags += ['-sUSE_PTHREADS=1']
69-
flags += ['-DSQLITE_THREADSAFE=1']
70-
flags += ['-D_REENTRANT=1']
72+
flags += [
73+
'-sUSE_PTHREADS=1',
74+
'-DSQLITE_THREADSAFE=1',
75+
'-D_REENTRANT=1',
76+
]
7177
else:
7278
flags += ['-DSQLITE_THREADSAFE=0']
7379

@@ -80,10 +86,6 @@ def clear(ports, settings, shared):
8086
shared.Cache.erase_lib(get_lib_name(settings))
8187

8288

83-
def process_dependencies(settings):
84-
pass
85-
86-
8789
def process_args(ports):
8890
return []
8991

0 commit comments

Comments
 (0)