Skip to content

Commit

Permalink
testing variables for zip url
Browse files Browse the repository at this point in the history
  • Loading branch information
jraymakers committed Jun 30, 2024
1 parent 6db6d57 commit fb077ee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
19 changes: 18 additions & 1 deletion alt/bindings/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,29 @@
{
'target_name': 'fetch_libduckdb',
'type': 'none',
'conditions': [
['OS=="linux"', {
'variables': {
'zip_url': 'https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-linux-amd64.zip',
},
}],
['OS=="mac"', {
'variables': {
'zip_url': 'https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-osx-universal.zip',
},
}],
['OS=="win"', {
'variables': {
'zip_url': 'https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-windows-amd64.zip',
},
}],
],
'actions': [
{
'action_name': 'run_fetch_libduckdb_script',
'message': 'Running fetch libduckdb script',
'inputs': [],
'action': ['python3', '<(module_root_dir)/scripts/fetch_libduckdb.py', '<(OS)', '<(module_root_dir)/libduckdb'],
'action': ['python3', '<(module_root_dir)/scripts/fetch_libduckdb.py', '<(OS)', '<(module_root_dir)/libduckdb', '<(zip_url)'],
'outputs': ['<(module_root_dir)/libduckdb/libduckdb.zip'],
},
],
Expand Down
25 changes: 16 additions & 9 deletions alt/bindings/scripts/fetch_libduckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@
"win": "https://github.com/duckdb/duckdb/releases/download/v1.0.0/libduckdb-windows-amd64.zip",
}

libduckdb_file_names_for_os = {
"linux": ["duckdb.h", "libduckdb.so"],
"mac": ["duckdb.h", "libduckdb.dylib"],
"win": ["duckdb.h", "libduckdb.lib", "libduckdb.dll"],
}
# libduckdb_file_names_for_os = {
# "linux": ["duckdb.h", "libduckdb.so"],
# "mac": ["duckdb.h", "libduckdb.dylib"],
# "win": ["duckdb.h", "libduckdb.lib", "libduckdb.dll"],
# }

os_name = sys.argv[1]
output_dir = sys.argv[2]
zip_url = sys.argv[3]

print("os_name: " + os_name)
print("output_dir: " + output_dir)
print("zip_url: " + zip_url)

libduckdb_zip_url = libduckdb_zip_url_for_os[os_name]
libduckdb_file_names = libduckdb_file_names_for_os[os_name]
# libduckdb_file_names = libduckdb_file_names_for_os[os_name]

libduckdb_zip_path = os.path.join(output_dir, "libduckdb.zip")
print("fetching: " + libduckdb_zip_url)
urllib.request.urlretrieve(libduckdb_zip_url, libduckdb_zip_path)

zip = zipfile.ZipFile(libduckdb_zip_path)
print("extracting: " + zip.namelist())
zip.extractall(output_dir)

for file_name in libduckdb_file_names:
print("extracting: " + file_name)
zip.extract(file_name, output_dir)
# for file_name in libduckdb_file_names:
# print("extracting: " + file_name)
# zip.extract(file_name, output_dir)

0 comments on commit fb077ee

Please sign in to comment.