Skip to content

[BUG] build_and_copy_rust_modules directory loop is broken and only catches the first module in the list #477

@dintorf

Description

@dintorf

Describe the bug
The build_and_copy_rust_modules function in the setup script does not properly loop through the module directory. The filter function is a generator and is executed on the fly, so since directory changes occur inside the loop the os.path.isdir(f) part of the loop breaks.

To Reproduce
Steps to reproduce the behavior:

  1. Add a new rust module in the rust directory that falls after the rust_example module alphabetically
  2. Build and run the docker image
  3. Shell into the running docker container
  4. Execute the setup script with python3 setup build --lang rust -p /usr/lib/memgraph/query_modules
  5. Observe that the new package is not built and copied to query_modules

Expected behavior
It's expected that all rust modules in the directory are built and copied to the output path except for rsmgp-sys.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
This can be fixed by changing the for loop in the build_and_copy_rust_modules function to the following:

for project in filter(
    lambda f: os.path.isdir(os.path.join(RS_DIRECTORY, f)) and f != "rsmgp-sys",
    os.listdir(RS_DIRECTORY),
)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions