header_files = [] script_path = os.path.dirname(os.path.abspath(__file__)) include_directories = [get_numpy_include(), get_pybind_include(), get_pybind_include(user=True)] if len(existing_duckdb_dir) == 0: # no existing library supplied: compile everything from source source_files = ['duckdb_python.cpp'] # check if amalgamation exists if os.path.isfile(os.path.join(script_path, '..', '..', 'scripts', 'amalgamation.py')): # amalgamation exists: compiling from source directory # copy all source files to the current directory sys.path.append(os.path.join(script_path, '..', '..', 'scripts')) import package_build (source_list, include_list, original_sources) = package_build.build_package(os.path.join(script_path, 'duckdb'), extensions) duckdb_sources = [os.path.sep.join(package_build.get_relative_path(script_path, x).split('/')) for x in source_list] duckdb_sources.sort() original_sources = [os.path.join('duckdb', x) for x in original_sources] duckdb_includes = [os.path.join('duckdb', x) for x in include_list] duckdb_includes += ['duckdb'] # gather the include files import amalgamation header_files = amalgamation.list_includes_files(duckdb_includes) # write the source list, include list and git hash to separate files with open_utf8('sources.list', 'w+') as f:
script_path = os.path.dirname(os.path.abspath(__file__)) main_include_path = os.path.join(script_path, 'src', 'include') main_source_path = os.path.join(script_path, 'src') main_source_files = ['duckdb_python.cpp'] + [os.path.join('src', x) for x in os.listdir(main_source_path) if '.cpp' in x] include_directories = [main_include_path, get_numpy_include(), get_pybind_include(), get_pybind_include(user=True)] if len(existing_duckdb_dir) == 0: # no existing library supplied: compile everything from source source_files = main_source_files # check if amalgamation exists if os.path.isfile(os.path.join(script_path, '..', '..', 'scripts', 'amalgamation.py')): # amalgamation exists: compiling from source directory # copy all source files to the current directory sys.path.append(os.path.join(script_path, '..', '..', 'scripts')) import package_build (source_list, include_list, original_sources) = package_build.build_package(os.path.join(script_path, lib_name), extensions, False, unity_build) duckdb_sources = [os.path.sep.join(package_build.get_relative_path(script_path, x).split('/')) for x in source_list] duckdb_sources.sort() original_sources = [os.path.join(lib_name, x) for x in original_sources] duckdb_includes = [os.path.join(lib_name, x) for x in include_list] duckdb_includes += [lib_name] # gather the include files import amalgamation header_files = amalgamation.list_includes_files(duckdb_includes) # write the source list, include list and git hash to separate files with open_utf8('sources.list', 'w+') as f:
text = text.replace('{{ LINK_FLAGS }}', link_flags.strip()) # now write it to the output Makevars with open_utf8(os.path.join('src', 'Makevars'), 'w+') as f: f.write(text) exit(0) if not os.path.isfile(os.path.join('..', '..', 'scripts', 'amalgamation.py')): print("Could not find amalgamation script! This script needs to be launched from the subdirectory tools/rpkg") exit(1) target_dir = os.path.join(os.getcwd(), 'src', 'duckdb') linenr = bool(os.getenv("DUCKDB_R_LINENR", "")) (source_list, include_list, original_sources) = package_build.build_package(target_dir, extensions, linenr, unity_build) # object list, relative paths script_path = os.path.dirname(os.path.abspath(__file__)).replace('\\','/') duckdb_sources = [package_build.get_relative_path(os.path.join(script_path, 'src'), x) for x in source_list] object_list = ' '.join([x.rsplit('.', 1)[0] + '.o' for x in duckdb_sources]) # include list include_list = ' '.join(['-I' + 'duckdb/' + x for x in include_list]) include_list += ' -I' + os.path.join('..', 'inst', 'include') include_list += ' -Iduckdb' include_list += extension_list # read Makevars.in and replace the {{ SOURCES }} and {{ INCLUDES }} macros with open_utf8(os.path.join('src', 'Makevars.in'), 'r') as f: text = f.read()
text = text.replace('{{ SOURCES }}', '') text = text.replace('{{ INCLUDES }}', compile_flags.strip()) text = text.replace('{{ LINK_FLAGS }}', link_flags.strip()) # now write it to the output Makevars with open(os.path.join('src', 'Makevars'), 'w+') as f: f.write(text) exit(0) if not os.path.isfile(os.path.join('..', '..', 'scripts', 'amalgamation.py')): print("Could not find amalgamation script! This script needs to be launched from the subdirectory tools/rpkg") exit(1) target_dir = os.path.join(os.getcwd(), 'src', 'duckdb') (source_list, include_list, original_sources, githash) = package_build.build_package(target_dir) # object list, relative paths script_path = os.path.dirname(os.path.abspath(__file__)).replace('\\','/') duckdb_sources = [x.replace(script_path + '/src/', '') for x in source_list] object_list = ' '.join([x.rsplit('.', 1)[0] + '.o' for x in duckdb_sources]) # include list include_list = ' '.join(['-I' + 'duckdb/' + x for x in include_list]) include_list += ' -Iduckdb' # read Makevars.in and replace the {{ SOURCES }} and {{ INCLUDES }} macros with open(os.path.join('src', 'Makevars.in'), 'r') as f: text = f.read() text = text.replace('{{ SOURCES }}', object_list)
with open_utf8(os.path.join('src', 'Makevars'), 'w+') as f: f.write(text) exit(0) if not os.path.isfile(os.path.join('..', '..', 'scripts', 'amalgamation.py')): print( "Could not find amalgamation script! This script needs to be launched from the subdirectory tools/rpkg" ) exit(1) target_dir = os.path.join(os.getcwd(), 'src', 'duckdb') linenr = bool(os.getenv("DUCKDB_R_LINENR", "")) (source_list, include_list, original_sources) = package_build.build_package(target_dir, linenr) # object list, relative paths script_path = os.path.dirname(os.path.abspath(__file__)).replace('\\', '/') duckdb_sources = [ package_build.get_relative_path(os.path.join(script_path, 'src'), x) for x in source_list ] object_list = ' '.join([x.rsplit('.', 1)[0] + '.o' for x in duckdb_sources]) # include list include_list = ' '.join(['-I' + 'duckdb/' + x for x in include_list]) include_list += ' -Iduckdb' # read Makevars.in and replace the {{ SOURCES }} and {{ INCLUDES }} macros with open_utf8(os.path.join('src', 'Makevars.in'), 'r') as f:
if len(existing_duckdb_dir) == 0: # no existing library supplied: compile everything from source source_files = main_source_files # check if amalgamation exists if os.path.isfile( os.path.join(script_path, '..', '..', 'scripts', 'amalgamation.py')): # amalgamation exists: compiling from source directory # copy all source files to the current directory sys.path.append(os.path.join(script_path, '..', '..', 'scripts')) import package_build (source_list, include_list, original_sources) = package_build.build_package( os.path.join(script_path, 'duckdb'), extensions, False, unity_build) duckdb_sources = [ os.path.sep.join( package_build.get_relative_path(script_path, x).split('/')) for x in source_list ] duckdb_sources.sort() original_sources = [ os.path.join('duckdb', x) for x in original_sources ] duckdb_includes = [os.path.join('duckdb', x) for x in include_list] duckdb_includes += ['duckdb']
text = text.replace('{{ LINK_FLAGS }}', link_flags.strip()) # now write it to the output Makevars with open(os.path.join('src', 'Makevars'), 'w+') as f: f.write(text) exit(0) if not os.path.isfile(os.path.join('..', '..', 'scripts', 'amalgamation.py')): print("Could not find amalgamation script! This script needs to be launched from the subdirectory tools/rpkg") exit(1) target_dir = os.path.join(os.getcwd(), 'src', 'duckdb') linenr = bool(os.getenv("DUCKDB_R_LINENR", "")) (source_list, include_list, original_sources) = package_build.build_package(target_dir, linenr) # object list, relative paths script_path = os.path.dirname(os.path.abspath(__file__)).replace('\\','/') duckdb_sources = [package_build.get_relative_path(os.path.join(script_path, 'src'), x) for x in source_list] object_list = ' '.join([x.rsplit('.', 1)[0] + '.o' for x in duckdb_sources]) # include list include_list = ' '.join(['-I' + 'duckdb/' + x for x in include_list]) include_list += ' -Iduckdb' # read Makevars.in and replace the {{ SOURCES }} and {{ INCLUDES }} macros with open(os.path.join('src', 'Makevars.in'), 'r') as f: text = f.read() text = text.replace('{{ SOURCES }}', object_list)
] if len(existing_duckdb_dir) == 0: # no existing library supplied: compile everything from source source_files = ['duckdb_python.cpp'] # check if amalgamation exists if os.path.isfile( os.path.join(script_path, '..', '..', 'scripts', 'amalgamation.py')): # amalgamation exists: compiling from source directory # copy all source files to the current directory sys.path.append(os.path.join(script_path, '..', '..', 'scripts')) import package_build (source_list, include_list, original_sources, githash) = package_build.build_package( os.path.join(script_path, 'duckdb')) duckdb_sources = [ x.replace(script_path + os.path.sep, '') for x in source_list ] duckdb_sources.sort() original_sources = [ os.path.join('duckdb', x) for x in original_sources ] duckdb_includes = [os.path.join('duckdb', x) for x in include_list] duckdb_includes += ['duckdb'] # gather the include files import amalgamation